コード例 #1
0
        /// <summary>
        /// 删除商品品牌
        /// </summary>
        /// <param name="commodityId"></param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO DelComInnerBrandExt(System.Guid commodityId)
        {
            ResultDTO result = new ResultDTO()
            {
                isSuccess = true
            };

            try
            {
                var model = CommodityInnerBrand.ObjectSet().Where(s => s.CommodityId == commodityId).FirstOrDefault();
                if (model != null)
                {
                    model.EntityState = EntityState.Deleted;
                    ContextFactory.CurrentThreadContext.SaveObject(model);
                    ContextFactory.CurrentThreadContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                result.isSuccess = false;
                result.Message   = "删除商品品牌失败";
                LogHelper.Error(string.Format("删除商品品牌失败:DelComInnerBrandExt:{0}", commodityId), ex);
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 添加商品品牌
        /// </summary>
        /// <param name="brandWallDto">商品品牌实体</param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddComInnerBrandExt(Jinher.AMP.BTP.Deploy.CommodityInnerBrandDTO innerBrandDto)
        {
            ResultDTO dto = null;

            try
            {
                ContextSession contextSession = ContextFactory.CurrentThreadContext;
                var            combrand       = CommodityInnerBrand.CreateCommodityInnerBrand();
                combrand.AppId       = innerBrandDto.AppId;
                combrand.BrandId     = innerBrandDto.BrandId;
                combrand.CommodityId = innerBrandDto.CommodityId;
                combrand.Name        = innerBrandDto.Name;
                combrand.AppId       = innerBrandDto.AppId;
                combrand.SubId       = innerBrandDto.SubId;
                combrand.SubTime     = DateTime.Now;
                combrand.ModifiedOn  = innerBrandDto.SubTime;
                combrand.EntityState = System.Data.EntityState.Added;
                contextSession.SaveObject(combrand);
                contextSession.SaveChanges();
                dto = new ResultDTO {
                    ResultCode = 0, Message = "保存成功", isSuccess = true
                };
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("商品品牌信息保存异常。AddComInnerBrandExt:{0}", ex.Message));
                dto = new ResultDTO {
                    ResultCode = 1, Message = ex.Message, isSuccess = false
                };
            }
            return(dto);
        }
コード例 #3
0
 /// <summary>
 /// 根据商品Id查询商品品牌
 /// </summary>
 /// <param name="commodityId"></param>
 /// <returns></returns>
 public Jinher.AMP.BTP.Deploy.CommodityInnerBrandDTO GetComInnerBrandExt(System.Guid commodityId)
 {
     try
     {
         CommodityInnerBrandDTO combrand    = null;
         CommodityInnerBrand    combrandDto = CommodityInnerBrand.ObjectSet().Where(p => p.CommodityId == commodityId).FirstOrDefault();
         if (combrandDto == null)
         {
             return(combrand);
         }
         combrand             = new CommodityInnerBrandDTO();
         combrand.Id          = combrandDto.Id;
         combrand.Name        = combrandDto.Name;
         combrand.CommodityId = combrandDto.CommodityId;
         combrand.AppId       = combrandDto.AppId;
         return(combrand);
     }
     catch (Exception ex)
     {
         LogHelper.Error(string.Format("获取商品品牌详情异常。commodityId:{0}", commodityId), ex);
         return(null);
     }
 }
コード例 #4
0
        /// <summary>
        /// 获取指定品牌下的商品
        /// </summary>
        /// <param name="BrandID"></param>
        /// <returns></returns>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <System.Collections.Generic.IList <Jinher.AMP.BTP.Deploy.CommodityDTO> > getBrandCommodityExt(System.Guid BrandID)
        {
            ResultDTO <IList <CommodityDTO> > dto = null;

            try
            {
                var list = (from b in Brandwall.ObjectSet()
                            join cib in CommodityInnerBrand.ObjectSet() on b.Id equals cib.BrandId into cib_join
                            from brand in cib_join.DefaultIfEmpty()
                            join c in Commodity.ObjectSet() on brand.CommodityId equals c.Id into cb_join
                            from cb in cb_join.DefaultIfEmpty()
                            where b.Id.Equals(BrandID) && b.Brandstatu.Equals(1)
                            select new CommodityDTO()
                {
                    Name = cb.Name,
                    Code = cb.Code,
                    SubId = cb.SubId,
                    Price = cb.Price,
                    No_Number = cb.No_Number,
                    Stock = cb.Stock,
                    PicturesPath = cb.PicturesPath,
                    Description = cb.Description,
                    State = cb.State,
                    IsDel = cb.IsDel,
                    AppId = cb.AppId,
                    No_Code = cb.No_Code,
                    TotalReview = cb.TotalReview,
                    Salesvolume = cb.Salesvolume,
                    GroundTime = cb.GroundTime,
                    ComAttribute = cb.ComAttribute,
                    CategoryName = cb.CategoryName,
                    SortValue = cb.SortValue,
                    FreightTemplateId = cb.FreightTemplateId,
                    MarketPrice = cb.MarketPrice,
                    IsEnableSelfTake = cb.IsEnableSelfTake,
                    Weight = cb.Weight,
                    PricingMethod = cb.PricingMethod,
                    SaleAreas = cb.SaleAreas,
                    SharePercent = cb.SharePercent,
                    CommodityType = cb.CommodityType,
                    HtmlVideoPath = cb.HtmlVideoPath,
                    MobileVideoPath = cb.MobileVideoPath,
                    VideoPic = cb.VideoPic,
                    VideoName = cb.VideoName,
                    ScorePercent = cb.ScorePercent,
                    Duty = cb.Duty,
                    SpreadPercent = cb.SpreadPercent,
                    ScoreScale = cb.ScoreScale,
                    TaxRate = cb.TaxRate,
                    TaxClassCode = cb.TaxClassCode,
                    InputRax = cb.InputRax,
                    Unit = cb.Unit,
                    Barcode = cb.Barcode,
                    JDCode = cb.JDCode,
                    CostPrice = cb.CostPrice,
                    TechSpecs = cb.TechSpecs,
                    SaleService = cb.SaleService,
                    IsAssurance = cb.IsAssurance,
                    Assurance = cb.Assurance,
                    IsReturns = cb.IsReturns,
                    Type = cb.Type,
                    YJCouponActivityId = cb.YJCouponActivityId,
                    YJCouponType = cb.YJCouponType,
                    Isnsupport = cb.Isnsupport,
                    RefundFreightTemplateId = cb.RefundFreightTemplateId,
                    BasketCount = cb.BasketCount,
                    OrderWeight = cb.OrderWeight
                }).ToList();
                dto = new ResultDTO <IList <CommodityDTO> >()
                {
                    Data       = list.ToList(),
                    isSuccess  = true,
                    Message    = "Sucess",
                    ResultCode = 0
                };

                return(dto);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("获取指定品牌下的商品错误getBrandCommodityExt-BrandID", BrandID), ex);
                dto = new ResultDTO <IList <CommodityDTO> >()
                {
                    Data       = null,
                    isSuccess  = false,
                    Message    = "fail",
                    ResultCode = 1
                };
                return(dto);
            }
        }