//获得用户的收藏19 ok
        public List<Commodity> GetUserCollectItems(String UserName)
        {
            List<Commodity> CommodityiList = new List<Commodity>();
            //数据访存器
            DatabaseAccess.DataClasses1DataContext DBAccessor = new DataClasses1DataContext();

            try
            {
                ISingleResult<getCollectByUserResult> resultList = DBAccessor.getCollectByUser(UserName);

                foreach (getCollectByUserResult result in resultList)
                {
                    Commodity commodity = new Commodity();
                    commodity.ID = result.id;
                    commodity.Name = result.name;
                    commodity.UserName = result.userfrom;
                    commodity.description = result.discription;
                    commodity.StartTime = (DateTime)result.starttime;
                    commodity.EndTime = (DateTime)result.endtime;
                    commodity.kind = (CommodityKind)(int)result.kind;
                    commodity.Price = (double)result.price;
                    commodity.ImageUrl = result.picturepath;
                    commodity.popularity = (int)result.popularity;
                    commodity.tagList = new List<Tag>();
                    //下面获得商品的Tag列表
                    ISingleResult<getTagByCommodityResult> TagResultList = DBAccessor.getTagByCommodity(result.id);

                    foreach (getTagByCommodityResult Tagresult in TagResultList)
                    {
                        Tag tag = new Tag();
                        tag.name = Tagresult.id;
                        tag.popularity = (int)Tagresult.popularity;
                        commodity.tagList.Add(tag);
                    }
                    CommodityiList.Add(commodity);
                }
            }
            catch(Exception e)
            {

            }

            return CommodityiList;
        }
        //获得用户发布的商品列表24 OK
        public List<Commodity> GetUserPublishCommoditys(String UserName)
        {
            List<Commodity> commodityList = new List<Commodity>();
            //数据访存器
            DatabaseAccess.DataClasses1DataContext DBAccessor = new DataClasses1DataContext();

            try
            {
                ISingleResult<getCommodityByUserResult> resultList = DBAccessor.getCommodityByUser(UserName);

                foreach (getCommodityByUserResult result in resultList)
                {
                    Commodity commodity = new Commodity();

                    commodity.ID = result.id;
                    commodity.Name = result.name;
                    commodity.UserName = result.userfrom;
                    commodity.StartTime = (DateTime)result.starttime;   //等亮亮的返回参数
                    commodity.EndTime = (DateTime)result.endtime;
                    commodity.description = result.discription;
                    commodity.kind = (CommodityKind)((int)result.kind);
                    commodity.ImageUrl = result.picturepath;
                    commodity.Price = (double)result.price;
                    commodity.popularity = (int)result.popularity;
                    commodity.tagList = new List<Tag>();

                    //查找属于商品的Tag列表
                    ISingleResult<getTagByCommodityResult> TagList = DBAccessor.getTagByCommodity(result.id);
                    foreach (getTagByCommodityResult atag in TagList)
                    {
                        Tag tag = new Tag();
                        tag.name = atag.id;//id就是tag名数据库中做主码
                        tag.popularity = (int)atag.popularity;

                        commodity.tagList.Add(tag); //加入tag列表
                    }

                    commodityList.Add(commodity);   //加入商品列表
                }
            }
            catch (Exception e)
            {

            }

            return commodityList;
        }
        //获得发向用户的订单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;
        }