当前位置: 首页>>代码示例>>C#>>正文


C# DataClasses1DataContext.getOrderByUserto方法代码示例

本文整理汇总了C#中DataClasses1DataContext.getOrderByUserto方法的典型用法代码示例。如果您正苦于以下问题:C# DataClasses1DataContext.getOrderByUserto方法的具体用法?C# DataClasses1DataContext.getOrderByUserto怎么用?C# DataClasses1DataContext.getOrderByUserto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataClasses1DataContext的用法示例。


在下文中一共展示了DataClasses1DataContext.getOrderByUserto方法的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;
        }
开发者ID:xiasiliang-hit,项目名称:purchase_shop,代码行数:70,代码来源:RegisterUserService.cs


注:本文中的DataClasses1DataContext.getOrderByUserto方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。