public ActionResult ProductInfoDetail(string spu) { ProductAuditingViewModel result = new ProductAuditingViewModel(); ViewBag.SpuId = spu; try { ViewBag.KeyNames = CommonBLL.GetDicsInfoByKey("ProductAttributes"); result = productBll.GetProductAndCustomInfoOnline(spu); if (result == null || result.SpuBaseInfo == null) { result.PackingInfo = new ProductPackingModel(); result.ProductAttrsInfos = new Dictionary <Models.Enums.LanguageEnum, Dictionary <string, string> >(); result.ProductCustomInfos = new List <ProductSkuCustomInfoModel>(); result.ProductImgs = new List <ProductImgInfoModel>(); result.SpuBaseInfo = new Dictionary <Models.Enums.LanguageEnum, ProductBaseInfoModel>(); result.SysInfo = new ProductSysPropertyModel(); } ViewBag.AuditLog = productBll.GetProductAuditLog(spu); } catch (Exception ext) { LogHelper.Error(ext); } return(View(result)); }
public ActionResult AuditingProduct(string spu) { var dtNow = DateTime.Now; var pqm = new ProductAuditingQuyModel() { EditType = Request["EditType"] == null ? 0 : Convert.ToInt32(Request["EditType"].ToString()), ProductName = Request["ProductName"] == null ? "" : Request["ProductName"].ToString(), CreateTimeEnd = Request["EndTime"] == null ? dtNow : Convert.ToDateTime(Request["EndTime"].ToString()), CreateTimeStart = Request["StartTime"] == null?dtNow.AddMonths(-6) : Convert.ToDateTime(Request["StartTime"].ToString()), ReportStatus = Request["ReportStatus"] == null ? 0 : Convert.ToInt32(Request["ReportStatus"].ToString()), SalesTerritory = Request["SalesTerritory"] == null ? 0 : Convert.ToInt32(Request["SalesTerritory"].ToString()), Sku = Request["Sku"] == null ? "" : Request["Sku"].ToString(), Spu = Request["SpuNo"] == null ? "" : Request["SpuNo"].ToString(), SupplierId = Request["SupplierId"] == null ? 0 : Convert.ToInt32(Request["SupplierId"].ToString()) }; ViewBag.PageNo = Request["PageNo"] == null ? 1 : Convert.ToInt32(Request["PageNo"].ToString()); ViewBag.PageSize = Request["PageSize"] == null ? 50 : Convert.ToInt32(Request["PageSize"].ToString()); ViewBag.QueryParas = pqm; ProductAuditingViewModel result = new ProductAuditingViewModel(); ViewBag.SpuId = spu; try { ViewBag.KeyNames = CommonBLL.GetDicsInfoByKey("ProductAttributes"); result = productBll.GetProductAndCustomInfo(spu); if (result == null || result.SpuBaseInfo == null) { result.PackingInfo = new ProductPackingModel(); result.ProductAttrsInfos = new Dictionary <Models.Enums.LanguageEnum, Dictionary <string, string> >(); result.ProductCustomInfos = new List <ProductSkuCustomInfoModel>(); result.ProductImgs = new List <ProductImgInfoModel>(); result.SpuBaseInfo = new Dictionary <Models.Enums.LanguageEnum, ProductBaseInfoModel>(); result.SysInfo = new ProductSysPropertyModel(); } } catch (Exception ext) { LogHelper.Error(ext); } return(View(result)); }
private ProductAuditingViewModel ProductAuditingModelToProductAuditingViewModel(ProductAuditingModel proAuditModel) { if (proAuditModel == null && proAuditModel.ProductBaseInfos == null && proAuditModel.ProductBaseInfos.Count == 0) { return(new ProductAuditingViewModel()); } var result = new ProductAuditingViewModel(); if (proAuditModel.ProductBaseInfos != null && proAuditModel.ProductBaseInfos.Count > 0) { result.SpuBaseInfo = new Dictionary <LanguageEnum, ProductBaseInfoModel>(); foreach (var bi in proAuditModel.ProductBaseInfos) { if (result.SpuBaseInfo.ContainsKey((LanguageEnum)bi.LanguageVersion)) { result.SpuBaseInfo[(LanguageEnum)bi.LanguageVersion] = bi; } else { result.SpuBaseInfo.Add((LanguageEnum)bi.LanguageVersion, bi); } } } if (proAuditModel.ProductSysInfo != null) { var sysInfo = proAuditModel.ProductSysInfo; result.PackingInfo = new ProductPackingModel() { Height = sysInfo.Height, Length = sysInfo.Length, Volume = sysInfo.Volume, Weight = sysInfo.Weight, Width = sysInfo.Width }; result.SysInfo = new ProductSysPropertyModel() { CategoryName = sysInfo.CategoryName, CommissionInCHINA = sysInfo.CommissionInCHINA, CommissionInHK = sysInfo.CommissionInHK, CompanyName = sysInfo.CompanyName, IsExchangeInCHINA = sysInfo.IsExchangeInCHINA, IsExchangeInHK = sysInfo.IsExchangeInHK, IsReturn = sysInfo.IsReturn, MinForOrder = sysInfo.MinForOrder, ModifyTime = sysInfo.ModifyTime, PreOnSaleTime = sysInfo.PreOnSaleTime, SalesTerritory = sysInfo.SalesTerritory, Spu = sysInfo.Spu, }; } if (proAuditModel.ProductCustomInfos != null && proAuditModel.ProductCustomInfos.Count > 0) { result.ProductCustomInfos = proAuditModel.ProductCustomInfos; } if (proAuditModel.ProductAttrsInfos != null && proAuditModel.ProductAttrsInfos.Count > 0) { result.ProductAttrsInfos = new Dictionary <LanguageEnum, Dictionary <string, string> >(); foreach (var pa in proAuditModel.ProductAttrsInfos) { var dic = ReflectionHelper.ReflectionKeyValue <ProductAttrInfoModel>(pa); if (!result.ProductAttrsInfos.Keys.Contains((LanguageEnum)pa.LanguageVersion)) { result.ProductAttrsInfos.Add((LanguageEnum)pa.LanguageVersion, dic); } else { var value = result.ProductAttrsInfos[(LanguageEnum)pa.LanguageVersion]; var keyCount = value.Keys.Count(); foreach (var key in value.Keys.ToArray()) { var tempValue = value[key]; var dicValue = dic[key]; var valueTmpList = value[key].ToString().Split(',').ToList(); if (!String.IsNullOrWhiteSpace(dicValue) && !valueTmpList.Contains(dicValue)) { tempValue = tempValue + "," + dicValue; value[key] = tempValue; } } } } } if (proAuditModel.ProductImgs != null && proAuditModel.ProductImgs.Count > 0) { result.ProductImgs = proAuditModel.ProductImgs; } return(result); }