public static ItemBean ParseGoodsToItemBean(Goods goods) { var item = new ItemBean(); var brandId = JpConfig.GetCateByTitle(JpConfig.BrandList, goods.BrandName)?.Value ?? "0"; item.brand_id = Int32.Parse(brandId); item.category_id = JpConfig.GetCateByTitle(JpConfig.Categories, goods.CategoryName)?.Value ?? "0"; //配送 var liao = JpConfig.GetCateByTitle(JpConfig.ShippingType, goods.ShippingLiao)?.Value ?? "0"; item.carry_fee_type = Int32.Parse(liao); item.carry_method = JpConfig.GetCateByTitle(JpConfig.ShippingMethods, goods.ShippingMethod)?.Value ?? "0"; //日期 var day = JpConfig.GetCateByTitle(JpConfig.ShippingDates, goods.ShippingMethod)?.Value ?? "0"; item.send_date_standard = Int32.Parse(day); item.area = goods.Area; item.size_id = Int32.Parse(goods.Size); item.title = goods.Title; item.explanation = goods.Desc; item.no_price_flag = 0; item.rot_status = 2; item.input_price = goods.Price; item.private_member_id = 0; item.private_flag = 0; return(item); }
/// <summary> /// 解析 /// </summary> /// <param name="item"></param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public static Goods ParseBeanToGoods(ItemBean item) { var goods = new Goods(); goods.MemberId = item.member_id; goods.GoodsNo = item.item_id; goods.ItemId = item.item_id; goods.BrandId = item.brand_id + ""; goods.BrandName = item.brand; goods.CategoryId = item.category_id; goods.CategoryName = JpConfig.GetCategoryName(item.category_id); goods.ShippingLiao = JpConfig.GetCarryType(item.carry_fee_type + ""); //获取默认的第一 item.carry_method = item.carry_method.Split(',')[0]; goods.ShippingMethod = JpConfig.GetShippingMethodName(item.carry_method); goods.ShippingArea = item.area; goods.ShippingDate = JpConfig.GetShippingDateName(item.send_date_standard + ""); goods.Area = item.area; goods.Title = item.title; goods.Desc = item.explanation; goods.Price = item.input_price; goods.Images = item.picture.ConvertAll((pic) => pic.url).ToArray(); goods.Status = JpConfig.GetStatus(item.atr_status + ""); goods.Size = item.size_id + ""; //SIZE_ID goods.ImagesString = item.img_list; //图片 return(goods); }
public static SaleBean ParseGoodsToSaleBean(Goods goods) { var item = new SaleBean(); var brandId = JpConfig.GetCateByTitle(JpConfig.BrandList, goods.BrandName)?.Value ?? "0"; item.BrandId = Int32.Parse(brandId); item.CategoryId = JpConfig.GetCateByTitle(JpConfig.Categories, goods.CategoryName)?.Value ?? "0"; //快递方式 var method = Int32.Parse(JpConfig.GetCateByTitle(JpConfig.ShippingMethods, goods.ShippingMethod)?.Value ?? "0"); item.CarryMethod = new List <CarryMethod> { new CarryMethod { MethodId = method } }; //配送料,自动对应 var lia = JpConfig.GetCateByTitle(JpConfig.ShippingType, goods.ShippingLiao)?.Value ?? "0"; item.CarryFeeType = method <= 10 ? 0 : 1; //和ShippingMethod对应 //日期 var day = JpConfig.GetCateByTitle(JpConfig.ShippingDates, goods.ShippingDate)?.Value ?? "0"; item.SendDateStandard = Int32.Parse(day); //区域 var areaId = JpConfig.GetCateByTitle(JpConfig.Areas, goods.Area)?.Value ?? "0"; item.Prefecture = Int32.Parse(areaId); //商品状态 var statId = JpConfig.GetCateByTitle(JpConfig.StatusType, goods.Status)?.Value ?? "0"; item.AtrStatus = Int32.Parse(statId); //TODO item.SizeId = Int32.Parse(goods.Size); item.SizeId = 0; item.Title = goods.Title; item.Explanation = goods.Desc; item.NoPriceFlag = 0; //1没价格, item.RotStatus = 2; item.InputPrice = goods.Price; item.PrivateMemberId = null; item.PrivateFlag = 0; item.ItemId = goods.ItemId; //如果是创建就指0 item.Mode = 2; //?? 1=预览,2=发布 item.RotStatus = 2; //默认 return(item); }