public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); DataContext = new ProductCreateSingleVM(); (new ProductCreateFacade()).GetProductCountryList((obj, arg) => { if (arg.FaultsHandle()) { return; } ucProductCreateSingle.cmbOrgin.ItemsSource = arg.Result; ucProductCreateSingle.cmbOrgin.SelectedIndex = 0; }); ucProductCreateSingle.cmbConsignFlag.SelectedIndex = 0; ucProductCreateSingle.cmbProductType.SelectedIndex = 0; base.OnPageLoad(sender, e); }
private void BtnSaveClick(object sender, RoutedEventArgs e) { ProductCreateSingleVM vm = DataContext as ProductCreateSingleVM; if (vm == null) { return; } ValidationManager.Validate(this); if (vm.ValidationErrors.Count != 0) { return; } if (vm.BrandSysNo == null || vm.BrandSysNo <= 0) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("请至少选择一个品牌!", MessageBoxType.Warning); return; } if (vm.C3SysNo == null || vm.C3SysNo <= 0) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("请至少选择一个三级类别!", MessageBoxType.Warning); return; } vm.BrandSysNo = Convert.ToInt32(ucProductCreateSingle.ucBrandPicker.SelectedBrandSysNo); vm.BrandName = ucProductCreateSingle.ucBrandPicker.SelectedBrandName; vm.OrginCode = ucProductCreateSingle.cmbOrgin.SelectedValue.ToString(); new ProductCreateFacade().CreateProduct(vm, (obj, args) => { if (args.FaultsHandle()) { return; } //Window.MessageBox(Alert(ResProductCreate.Info_SaveSuccessfully); Window.MessageBox.Show("创建商品成功!商品编号为 " + args.Result.ProductID, MessageBoxType.Success); }); }
private ProductInfo CovertVMtoEntity(ProductCreateSingleVM data) { var product = new ProductInfo(); product.PromotionTitle = new LanguageContent(String.Empty); product.ProductConsignFlag = (VendorConsignFlag)data.ConsignFlag; product.ProductStatus = ProductStatus.InActive_UnShow; product.ProductPOInfo = new ProductPOInfo() { MinPackNumber = 1 }; product.ProductPayType = ProductPayType.MoneyOnly; product.Merchant = new Merchant { SysNo = 1 }; //泰隆优选商品 product.OperateUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.UserSysNo, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; product.CompanyCode = CPApplication.Current.CompanyCode; product.LanguageCode = ConstValue.BizLanguageCode; product.ProductPriceInfo = new ProductPriceInfo { BasicPrice = 999999, CashRebate = 0, CurrentPrice = 999999, DiscountAmount = 0, MaxCountPerDay = 999999, MinCountPerOrder = 1, PayType = ProductPayType.MoneyOnly, Point = 0, ProductRankPrice = new List <ProductRankPriceInfo>(), ProductWholeSalePriceInfo = new List <ProductWholeSalePriceInfo>(), UnitCost = 999999, UnitCostWithoutTax = 999999, VirtualPrice = Math.Round(Convert.ToDecimal(data.VirtualPrice), 2) }; product.ProductWarrantyInfo = new ProductWarrantyInfo { HostWarrantyDay = 0, IsNoExtendWarranty = true, OfferVATInvoice = OfferVATInvoice.Yes, PartWarrantyDay = 0, ServiceInfo = String.Empty, ServicePhone = String.Empty, Warranty = new LanguageContent(String.Empty), WarrantyShow = WarrantyShow.No }; product.ProductBasicInfo = new ProductBasicInfo { Attention = new LanguageContent(String.Empty), IsAccessoryShow = ProductIsAccessoryShow.No, IsTakePicture = data.IsTakePictures ? ProductIsTakePicture.Yes : ProductIsTakePicture.No, IsVirtualPic = ProductIsVirtualPic.No, Keywords = new LanguageContent(data.KeyWord), LongDescription = new LanguageContent(String.Empty), Note = String.Empty, PackageList = new LanguageContent(String.Empty), Performance = String.Empty, PhotoDescription = new LanguageContent(String.Empty), ProductBrandInfo = new BrandInfo { SysNo = data.BrandSysNo }, ProductBriefAddition = new LanguageContent(String.Empty), ProductBriefTitle = new LanguageContent(data.ProductTitle), ProductCategoryInfo = new CategoryInfo { SysNo = data.C3SysNo }, ProductDimensionInfo = new ProductDimensionInfo { Height = 0, Length = 0, Weight = 0, Width = 0 }, ProductInfoFinishStatus = ProductInfoFinishStatus.No, ProductLink = String.Empty, ProductModel = new LanguageContent(data.ProductModel), ProductProperties = new List <ProductProperty>(), ProductTitle = new LanguageContent(data.ProductTitle), ShortDescription = new LanguageContent(String.Empty), UPCCode = data.UPCCode, BMCode = data.BMCode, TradeType = TradeType.Internal //泰隆银行默认为国内商品 }; ProductType productType; switch (data.ProductType) { case "1": product.ProductBasicInfo.ProductType = ProductType.OpenBox; break; case "2": product.ProductBasicInfo.ProductType = ProductType.Bad; break; case "3": product.ProductBasicInfo.ProductType = ProductType.Virtual; break; default: product.ProductBasicInfo.ProductType = ProductType.Normal; break; } //product.ProductBasicInfo.ProductType = Enum.TryParse(data.ProductType, out productType) ? productType : ProductType.Normal; product.OrginCode = data.OrginCode; return(product); }
/// <summary> /// 创建单个商品(创建不基于组的商品) /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void CreateProduct(ProductCreateSingleVM data, EventHandler <RestClientEventArgs <ProductInfo> > callback) { string relativeUrl = "/IMService/Product/CreateProduct"; restClient.Create(relativeUrl, CovertVMtoEntity(data), callback); }