/// <summary> /// 转换分类视图和分类实体 /// </summary> /// <param name="data"></param> /// <returns></returns> private SellerProductRequestInfo CovertVMtoEntity(SellerProductRequestVM data) { SellerProductRequestInfo msg = data.ConvertVM <SellerProductRequestVM, SellerProductRequestInfo>(); msg.CategoryInfo = data.CategoryInfo.ConvertVM <CategoryVM, CategoryInfo>((v, t) => { t.CategoryName = new LanguageContent(v.CategoryName); }); msg.Brand = data.Brand.ConvertVM <BrandVM, BrandInfo>((v, t) => { t.BrandNameLocal = new LanguageContent(v.BrandNameLocal); }); msg.Manufacturer = data.Manufacturer.ConvertVM <ManufacturerVM, ManufacturerInfo>((v, t) => { t.ManufacturerNameLocal = new LanguageContent(v.ManufacturerNameLocal); }); msg.InUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.EditUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.Auditor = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.CompanyCode = CPApplication.Current.CompanyCode; msg.LanguageCode = data.LanguageCode; msg.SysNo = data.SysNo; return(msg); }
private void BindProperty(SellerProductRequestVM vm, ProductSellerPortalParameterControl sellControl) { ProductFacade _productFacade = new ProductFacade(); _productFacade.GetPropertyValueList(vm.SellerProductRequestPropertyList.Select(p => p.PropertySysno).ToList(), (ob, arg) => { if (arg.FaultsHandle()) { return; } foreach (var propertyVM in vm.SellerProductRequestPropertyList) { propertyVM.PropertyValueList = new List <PropertyValueVM>(); foreach (var i in arg.Result.Keys) { if (propertyVM.PropertySysno == i) { propertyVM.PropertyValueList = _productFacade.ConvertPropertyValueInfoToPropertyValueVM(arg.Result[i]); } } propertyVM.PropertyValueList.Insert(0, new PropertyValueVM { SysNo = 0, ValueDescription = "请选择..." }); } sellControl.dgPropertyQueryResult.ItemsSource = vm.SellerProductRequestPropertyList; sellControl.dgPropertyQueryResult.TotalCount = vm.SellerProductRequestPropertyList.Count; }); }
private void BindPage() { if (SysNo != null) { _facade = new ProductChannelInfoFacade(); _facade.GetProductChannelInfoBySysNo(SysNo.Value, (obj, args) => { if (args.FaultsHandle()) { return; } if (args.Result == null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("无法渠道商品信息.", MessageBoxType.Warning); return; } var vm = args.Result.Convert <ProductChannelInfo, ProductChannelVM>(); vm.ChannelInfo = args.Result.ChannelInfo.Convert <ChannelInfo, ChannelVM> ((v, t) => { t.ChannelName = v.ChannelName; }); _sysNo = SysNo.Value; DataContext = vm; if (cbIsAppointInventory.IsChecked.HasValue) { this.tb_ChannelSellCount.IsEnabled = cbIsAppointInventory.IsChecked.Value; } this.tb_SynProductID.IsEnabled = !vm.ChannelInfo.SysNo.Equals(ChannelSysNo); this.tb_TaoBaoSku.IsEnabled = !vm.ChannelInfo.SysNo.Equals(ChannelSysNo); if (!vm.ChannelInfo.SysNo.Equals(ChannelSysNo)) { this.lbl_TaoBao.Visibility = Visibility.Collapsed; this.tb_TaoBaoSku.Visibility = Visibility.Collapsed; this.lbl_TaoBaoLab.Visibility = Visibility.Collapsed; this.tb_SynProductID.IsEnabled = this.tb_SynProductID.Text.Equals(string.Empty); } }); } else { _sysNo = 0; var item = new SellerProductRequestVM(); DataContext = item; } }
private void BindPage() { if (SysNo != null) { _facade = new ProductChannelInfoFacade(); _facade.GetProductChannelInfoBySysNo(SysNo.Value, (obj, args) => { if (args.FaultsHandle()) { return; } if (args.Result == null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("无法渠道商品信息.", MessageBoxType.Warning); return; } var vm = args.Result.Convert <ProductChannelInfo, ProductChannelVM>(); vm.ChannelInfo = args.Result.ChannelInfo.Convert <ChannelInfo, ChannelVM> ((v, t) => { t.ChannelName = v.ChannelName; }); _sysNo = SysNo.Value; DataContext = vm; dgProductChannelPeriodPriceQueryResult.Bind(); }); } else { _sysNo = 0; var item = new SellerProductRequestVM(); DataContext = item; } }
private void BindPage() { if (SysNo != null) { _facade = new SellerProductRequestFacade(); _facade.GetSellerProductRequestBySysNo(SysNo.Value, (obj, args) => { if (args.FaultsHandle()) { return; } if (args.Result == null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("没有获得商家产品信息.", MessageBoxType.Warning); return; } var vm = args.Result.Convert <SellerProductRequestInfo, SellerProductRequestVM>(); vm.CategoryInfo = args.Result.CategoryInfo.Convert <CategoryInfo, CategoryVM> ((v, t) => { t.CategoryName = v.CategoryName.Content; }); vm.Brand = args.Result.Brand.Convert <BrandInfo, BrandVM> ((v, t) => { t.BrandNameLocal = v.BrandNameLocal.Content; }); vm.Manufacturer = args.Result.Manufacturer.Convert <ManufacturerInfo, ManufacturerVM> ((v, t) => { t.ManufacturerNameLocal = v.ManufacturerNameLocal.Content; }); _sysNo = SysNo.Value; DataContext = vm; foreach (SellerProductRequestFileVM item in vm.SellerProductRequestFileList) { Border border = new Border(); border.BorderThickness = new Thickness(1); SolidColorBrush brush = new SolidColorBrush(); brush.Color = Colors.LightGray; border.BorderBrush = brush; Image image = new Image(); image.Width = 150; image.Height = 130; image.Margin = new Thickness(2, 2, 2, 2); border.Child = image; image.Source = new System.Windows.Media.Imaging.BitmapImage(item.AbsolutePathOnServer); this.ImageListPanel.Children.Add(border); } }); } else { _sysNo = 0; var item = new SellerProductRequestVM(); DataContext = item; } }
/// <summary> /// 创建ID /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void CreateItemIDForNewProductRequest(SellerProductRequestVM data, EventHandler <RestClientEventArgs <SellerProductRequestInfo> > callback) { _restClient.Update(CreateItemIDRelativeUrl, CovertVMtoEntity(data), callback); }
/// <summary> /// 退回商品请求 /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void DenyProductRequest(SellerProductRequestVM data, EventHandler <RestClientEventArgs <SellerProductRequestInfo> > callback) { _restClient.Update(DenyRelativeUrl, CovertVMtoEntity(data), callback); }
private void BindPage() { if (!string.IsNullOrEmpty(ProductID) && SysNo != null) { //绑定原值 _facade = new SellerProductRequestFacade(); _facade.GetSellerProductRequestByProductID(ProductID, (objOld, argsOld) => { if (argsOld.FaultsHandle()) { return; } if (argsOld.Result == null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("没有获得商家产品信息.", MessageBoxType.Warning); return; } var vm = argsOld.Result.Convert <SellerProductRequestInfo, SellerProductRequestVM>(); _productID = ProductID; this.OldParameterDetail.DataContext = vm; if (vm.SellerProductRequestPropertyList.Count > 0) { BindProperty(vm, this.OldParameterDetail); } //绑定修改的值 _facade.GetSellerProductRequestBySysNo(SysNo.Value, (objNew, argsNew) => { if (argsNew.FaultsHandle()) { return; } if (argsNew.Result == null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("没有获得商家产品信息.", MessageBoxType.Warning); return; } var vmNew = argsNew.Result.Convert <SellerProductRequestInfo, SellerProductRequestVM>(); _sysNo = SysNo.Value; this.expander1.DataContext = vmNew; this.NewParameterDetail.DataContext = vmNew; this.NewParameterDetail.SetControlBackground(Colors.Yellow); ProductFacade _productFacade = new ProductFacade(); if (vmNew.SellerProductRequestPropertyList.Count > 0) { BindProperty(vmNew, this.NewParameterDetail); } else { this.NewParameterDetail.PropertySection.IsEnabled = false; this.OldParameterDetail.PropertySection.IsEnabled = false; } foreach (object item in this.NewParameterDetail.controlDetail.Children) { if (item.GetType() == typeof(TextBox)) { if (((TextBox)item).Text.Equals(((TextBox)this.OldParameterDetail.controlDetail.FindName(((TextBox)item).Name)).Text)) { ((TextBox)item).Visibility = System.Windows.Visibility.Collapsed; ((TextBox)this.OldParameterDetail.controlDetail.FindName(((TextBox)item).Name)).Visibility = System.Windows.Visibility.Collapsed; ((TextBlock)this.NewParameterDetail.controlDetail.FindName(((TextBox)item).Name + "Block")).Visibility = System.Windows.Visibility.Collapsed; ((TextBlock)this.OldParameterDetail.controlDetail.FindName(((TextBox)item).Name + "Block")).Visibility = System.Windows.Visibility.Collapsed; } } else if (item.GetType() == typeof(Combox)) { if (((Combox)item).SelectedValue.Equals((((Combox)this.OldParameterDetail.controlDetail.FindName(((Combox)item).Name)).SelectedValue))) { ((Combox)item).Visibility = System.Windows.Visibility.Collapsed; ((Combox)this.OldParameterDetail.controlDetail.FindName(((Combox)item).Name)).Visibility = System.Windows.Visibility.Collapsed; ((TextBlock)this.NewParameterDetail.controlDetail.FindName(((Combox)item).Name + "Block")).Visibility = System.Windows.Visibility.Collapsed; ((TextBlock)this.OldParameterDetail.controlDetail.FindName(((Combox)item).Name + "Block")).Visibility = System.Windows.Visibility.Collapsed; } } } }); }); } else { _sysNo = 0; var item = new SellerProductRequestVM(); DataContext = item; } }