本文整理汇总了C#中MicroEmall.Models.WMContext类的典型用法代码示例。如果您正苦于以下问题:C# WMContext类的具体用法?C# WMContext怎么用?C# WMContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WMContext类属于MicroEmall.Models命名空间,在下文中一共展示了WMContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Delete
public static bool Delete(string id)
{
if (!General.IsNullable(id))
{
string fileName = null;
using (WMContext context = new WMContext())
{
GoodBrands model = context.GoodBrands.Find(id);
if (model != null)
{
if (!General.IsNullable(model.Logo))
fileName = "~" + model.Logo;
context.GoodBrands.Remove(model);
context.SaveChanges();
}
}
if (!General.IsNullable(fileName))
return Jumpcity.IO.FileHelper.DeleteFile(fileName);
return true;
}
return false;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:28,代码来源:WMGoodBrands.cs
示例2: Get
public static WMOrderGoods Get(string id)
{
WMOrderGoods model = null;
if (!General.IsNullable(id))
{
using (WMContext context = new WMContext())
{
model = (
from og in context.OrderGoods
join g in context.Goods on og.GoodId equals g.Id
where og.Id.Equals(id)
select new WMOrderGoods
{
Id = og.Id,
OrderId = og.OrderId,
GoodId = og.GoodId,
GoodName = g.Name,
GoodFigure = context.GoodImages.Where(gi => gi.GoodId.Equals(og.GoodId) && gi.IsCover).Select(gi => gi.URL).FirstOrDefault(),
GoodInteSubTotal = (g.Integral * og.Count),
Price = og.Price,
Count = og.Count
}
).FirstOrDefault();
}
}
return model;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:29,代码来源:WMOrderGoods.cs
示例3: AddList
/// <summary>
/// 用购物车的数据填充订单商品表
/// </summary>
/// <param name="orderId">订单ID</param>
/// <param name="shopCars">购物车数据</param>
/// <returns>添加成功返回TRUE,否则返回FALSE</returns>
public static bool AddList(string orderId, List<WMShopCars> shopCars)
{
if (!General.IsNullable(orderId) && !General.IsNullable(shopCars))
{
WMOrderGoods model = null;
using (WMContext context = new WMContext())
{
foreach (WMShopCars item in shopCars)
{
model = new WMOrderGoods {
Id = General.UniqueString(),
OrderId = orderId,
GoodId = item.GoodId,
Price = item.Price,
Count = item.Count
};
context.OrderGoods.Add(model);
}
context.SaveChanges();
}
return true;
}
return false;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:34,代码来源:WMOrderGoods.cs
示例4: Clear
public static bool Clear(string userId)
{
if (!General.IsNullable(userId))
{
using (WMContext context = new WMContext())
{
var list = (
from car in context.ShopCars
where car.UserId.Equals(userId)
select car
);
if (list != null)
{
foreach (var item in list)
context.ShopCars.Remove(item);
context.SaveChanges();
return true;
}
}
}
return false;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:25,代码来源:WMShopCars.cs
示例5: Get
public static WMAdministrators Get(int adminId)
{
WMAdministrators admin = null;
if (adminId > 0)
{
using (WMContext context = new WMContext())
{
admin = (
from ad in context.Administartors
join r in context.Options on ad.RoleId equals r.Id
join s in context.Options on ad.StatusId equals s.Id
where ad.Id == adminId
select new WMAdministrators
{
Id = ad.Id,
RoleId = ad.RoleId,
RoleName = r.Name,
UserName = ad.UserName,
Password = ad.Password,
StatusId = ad.StatusId,
StatusName = s.Name,
AddDate = ad.AddDate
}
).FirstOrDefault();
}
}
return admin;
}
开发者ID:honj51,项目名称:micro-emall,代码行数:30,代码来源:WMAdministrators.cs
示例6: Get
public static WMUserSets Get(string id)
{
WMUserSets userSet = null;
if (!General.IsNullable(id))
{
DateTime now = DateTime.Now;
using (WMContext context = new WMContext())
{
userSet = (
from us in context.UserSets
join g in context.Goods on us.GoodId equals g.Id
join t in context.Options on us.TypeId equals t.Id
where us.Id.Equals(id)
select new WMUserSets
{
Id = us.Id,
TypeId = us.TypeId,
TypeName = t.Name,
UserId = us.UserId,
GoodId = us.GoodId,
GoodName = g.Name,
GoodFigure = context.GoodImages.Where(gi => gi.GoodId.Equals(us.GoodId) && gi.IsCover).Select(gi => gi.URL).FirstOrDefault(),
AddDate = us.AddDate
}
).FirstOrDefault();
}
}
return userSet;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:31,代码来源:WMUserSets.cs
示例7: GetList
public static List<WMOrderExpress> GetList(out int pageCount, string name = null, int pageIndex = 0, int pageSize = 0)
{
List<WMOrderExpress> list = null;
bool isName = !General.IsNullable(name);
pageCount = 0;
using (WMContext context = new WMContext())
{
var query = (
from oe in context.OrderExpress
where (isName ? oe.Name.Contains(name) : true)
orderby oe.AddDate descending
select new WMOrderExpress
{
Id = oe.Id,
Name = oe.Name,
URL = oe.URL,
AddDate = oe.AddDate
}
);
if (query != null)
{
pageCount = query.Count();
if (pageIndex >= 0 && pageSize > 0)
query = query.Skip(pageIndex * pageSize).Take(pageSize);
list = query.ToList();
}
}
return list;
}
开发者ID:honj51,项目名称:micro-emall,代码行数:34,代码来源:WMOrderExpress.cs
示例8: Get
public static WMUserBonus Get(string id)
{
WMUserBonus model = null;
if (!General.IsNullable(id))
{
using(WMContext context = new WMContext())
{
model = (
from ub in context.UserBonus
where ub.Id.Equals(id)
select new WMUserBonus
{
Id = ub.Id,
UserId = ub.UserId,
OrderId = ub.OrderId,
BonusSum = ub.BonusSum,
AddDate = ub.AddDate
}
).FirstOrDefault();
}
}
return model;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:25,代码来源:WMUserBonus.cs
示例9: Get
public static WMGoodImages Get(string id)
{
WMGoodImages image = null;
if (!General.IsNullable(id))
{
using (WMContext context = new WMContext())
{
image = (
from gi in context.GoodImages
where gi.Id.Equals(id)
select new WMGoodImages
{
Id = gi.Id,
GoodId = gi.GoodId,
URL = gi.URL,
IsCover = gi.IsCover,
AddDate = gi.AddDate
}
).FirstOrDefault();
}
}
return image;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:25,代码来源:WMGoodImages.cs
示例10: Get
public static UserIntegrals Get(string id)
{
UserIntegrals integral = null;
if (!General.IsNullable(id))
{
using (WMContext context = new WMContext())
{
integral = (
from ui in context.UserIntegrals
join s in context.Options on ui.SourceId equals s.Id
where ui.Id.Equals(id)
select new WMUserIntegrals
{
Id = ui.Id,
SourceId = ui.SourceId,
SourceName = s.Name,
UserId = ui.UserId,
Integral = ui.Integral,
AddDate = ui.AddDate
}
).FirstOrDefault();
}
}
return integral;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:27,代码来源:WMUserIntegrals.cs
示例11: GetList
public static List<WMGoodBrands> GetList(out int pageCount, string name = null, int pageIndex = 0, int pageSize = 0)
{
List<WMGoodBrands> list = null;
bool isName = !General.IsNullable(name);
pageCount = 0;
using (WMContext context = new WMContext())
{
var query = (
from gb in context.GoodBrands
where (isName ? gb.Name.Contains(name) : true)
orderby gb.Logo descending
select new WMGoodBrands
{
Id = gb.Id,
Name = gb.Name,
Logo = gb.Logo,
URL = gb.URL
}
);
if (query != null)
{
pageCount = query.Count();
if (pageIndex >= 0 && pageSize > 0)
query = query.Skip(pageIndex * pageSize).Take(pageSize);
list = query.ToList();
}
}
return list;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:34,代码来源:WMGoodBrands.cs
示例12: GetList
public static List<WMOrderPay> GetList()
{
List<WMOrderPay> list = null;
using (WMContext context = new WMContext())
{
list = (
from r in context.Options
where r.Group.Equals(groupName)
select new WMOrderPay
{
PayId = r.Id,
PayName = r.Name
}
).ToList();
}
return list;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:19,代码来源:WMOrderPay.cs
示例13: Delete
public static bool Delete(int adminId)
{
if (adminId > 0)
{
using (WMContext context = new WMContext())
{
Administartors model = context.Administartors.Find(adminId);
if (model != null)
{
model.StatusId = 203;
context.SaveChanges();
return true;
}
}
}
return false;
}
开发者ID:honj51,项目名称:micro-emall,代码行数:19,代码来源:WMAdministrators.cs
示例14: GetList
public static List<WMGoodState> GetList()
{
List<WMGoodState> list = null;
using (WMContext context = new WMContext())
{
list = (
from r in context.Options
where r.Group.Equals(groupName)
select new WMGoodState
{
StateId = r.Id,
StateName = r.Name
}
).ToList();
}
return list;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:19,代码来源:WMGoodState.cs
示例15: Delete
public static bool Delete(string userId)
{
if (!General.IsNullable(userId))
{
using (WMContext context = new WMContext())
{
Users model = context.Users.Find(userId);
if (model != null)
{
model.StatusId = 203;
context.SaveChanges();
return true;
}
}
}
return false;
}
开发者ID:honj51,项目名称:micro-emall,代码行数:19,代码来源:WMUsers.cs
示例16: Delete
public static bool Delete(string id)
{
if (!General.IsNullable(id))
{
using (WMContext context = new WMContext())
{
UserSets model = context.UserSets.Find(id);
if (model != null)
{
context.UserSets.Remove(model);
context.SaveChanges();
return true;
}
}
}
return false;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:19,代码来源:WMUserSets.cs
示例17: GetList
public static List<WMUserClicks> GetList(out int pageCount, string promoterId = null, int pageIndex = 0, int pageSize = 0)
{
List<WMUserClicks> list = null;
bool flag = !General.IsNullable(promoterId);
pageCount = 0;
using (WMContext context = new WMContext())
{
var query = (
from uc in context.UserClicks
join p in context.Users on uc.PromoterId equals p.Id
join c in context.Users on uc.CustomerId equals c.Id
join g in context.Goods on uc.GoodId equals g.Id
where (flag ? uc.PromoterId.Equals(promoterId) : true)
orderby uc.AddDate descending
select new WMUserClicks
{
Id = uc.Id,
PromoterId = uc.PromoterId,
PromoterName = p.NickName,
CustomerId = uc.CustomerId,
CustomerName = c.NickName,
GoodId = uc.GoodId,
GoodName = g.Name,
GoodFigure = context.GoodImages.Where(gi => gi.GoodId.Equals(uc.GoodId) && gi.IsCover).Select(gi => gi.URL).FirstOrDefault(),
AddDate = uc.AddDate
}
);
if (query != null)
{
pageCount = query.Count();
if (pageIndex >= 0 && pageSize > 0)
query = query.Skip(pageIndex * pageSize).Take(pageSize);
list = query.ToList();
}
}
return list;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:42,代码来源:WMUserClicks.cs
示例18: GetList
public static List<WMOrderState> GetList()
{
List<WMOrderState> list = null;
using (WMContext context = new WMContext())
{
list = (
from r in context.Options
where r.Group.Equals(groupName)
select new WMOrderState
{
StateId = r.Id,
StateName = r.Name,
StateCount = context.Orders.Count(o => o.StatusId == r.Id)
}
).ToList();
}
return list;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:20,代码来源:WMOrderState.cs
示例19: GetList
public static List<WMAdministrators> GetList(out int pageCount, int roleId = 0, int stateId = 0, int pageIndex = 0, int pageSize = 0)
{
List<WMAdministrators> list = null;
pageCount = 0;
using (WMContext context = new WMContext())
{
var query = (
from ad in context.Administartors
join r in context.Options on ad.RoleId equals r.Id
join s in context.Options on ad.StatusId equals s.Id
where ad.StatusId != 203
&& (roleId > 0 ? ad.RoleId == roleId : true)
&& (stateId > 0 ? ad.StatusId == stateId : true)
orderby ad.StatusId ascending, ad.AddDate descending
select new WMAdministrators
{
Id = ad.Id,
RoleId = ad.RoleId,
RoleName = r.Name,
UserName = ad.UserName,
Password = ad.Password,
StatusId = ad.StatusId,
StatusName = s.Name,
AddDate = ad.AddDate
}
);
if (query != null)
{
pageCount = query.Count();
if (pageIndex >= 0 && pageSize > 0)
query = query.Skip(pageIndex * pageSize).Take(pageSize);
list = query.ToList();
}
}
return list;
}
开发者ID:honj51,项目名称:micro-emall,代码行数:41,代码来源:WMAdministrators.cs
示例20: GetClickCount
public static int GetClickCount(string promoterId, string goodId = null)
{
int count = 0;
if (!General.IsNullable(promoterId))
{
bool isGood = !General.IsNullable(goodId);
using (WMContext context = new WMContext())
{
count = (
from uc in context.UserClicks
where uc.PromoterId.Equals(promoterId)
&& (isGood ? uc.GoodId.Equals(goodId) : true)
select uc.Id
).Count();
}
}
return count;
}
开发者ID:chinaq,项目名称:micro-emall,代码行数:21,代码来源:WMUserClicks.cs
注:本文中的MicroEmall.Models.WMContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论