本文整理汇总了C#中DataClasses1DataContext.getCommodityByOreder方法的典型用法代码示例。如果您正苦于以下问题:C# DataClasses1DataContext.getCommodityByOreder方法的具体用法?C# DataClasses1DataContext.getCommodityByOreder怎么用?C# DataClasses1DataContext.getCommodityByOreder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataClasses1DataContext
的用法示例。
在下文中一共展示了DataClasses1DataContext.getCommodityByOreder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOreders
//获得发向用户的订单8 ok
public List<Order> GetOreders(String UserID)
{
List<Order> OrderList = new List<Order>();
//数据访存器
DatabaseAccess.DataClasses1DataContext DBAccessor = new DataClasses1DataContext();
try
{
ISingleResult<getOrderByUsertoResult> resultList = DBAccessor.getOrderByUserto(UserID);
foreach (getOrderByUsertoResult result in resultList)
{
Order order = new Order();
order.ID = result.id;
order.userTo.UserName = result.userto;
//下面获得发订单的用户
order.userFrom.UserName = result.userfrom;
//发订单用户的信息
ISingleResult<getUserByUserNameResult> UserInfoList = DBAccessor.getUserByUserName(result.userfrom);
foreach (getUserByUserNameResult UserInfo in UserInfoList)
{
order.userFrom.NickName = UserInfo.nickname;
order.userFrom.Phone = UserInfo.phone;
order.userFrom.Address = UserInfo.address;
order.userFrom.Email = UserInfo.email;
order.userFrom.City = UserInfo.city;
order.userFrom.Portrait = UserInfo.portraitPath;
}
//查找次订单所对应的所有商品
ISingleResult<getCommodityByOrederResult> commmodityListresult = DBAccessor.getCommodityByOreder(result.id);
//获得订单所对应的商品列表
foreach (getCommodityByOrederResult commmodityResult in commmodityListresult)
{
Commodity commodity = new Commodity();
commodity.ID = commmodityResult.id;
commodity.Name = commmodityResult.name;
commodity.UserName = commmodityResult.userfrom;
commodity.kind = (CommodityKind)(int)commodity.kind;
commodity.StartTime = (DateTime)commmodityResult.starttime;
commodity.EndTime = (DateTime)commmodityResult.endtime;
commodity.description = commmodityResult.discription;
commodity.ImageUrl = commmodityResult.picturepath;
commodity.Price = (int)commmodityResult.price;
//获得商品的tag列表
ISingleResult<getTagByCommodityResult> tagResultList = DBAccessor.getTagByCommodity(commmodityResult.id);
foreach (getTagByCommodityResult tagResult in tagResultList)
{
Tag tag = new Tag();
tag.name = tagResult.id;
tag.popularity = (int)tagResult.popularity;
//加入商品的Tag列表
commodity.tagList.Add(tag);
}
//把商品加入订单的商品列表
order.commodityList.Add(commodity);
}
//订单加入订单列表
OrderList.Add(order);
}
}
catch (Exception e)
{
}
return OrderList;
}