Пример #1
0
        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);
        }
Пример #2
0
        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);
        }