private void btnSave_Click(object sender, RoutedEventArgs e) { if (ValidationManager.Validate(this.LayoutRoot)) { var facade = new ProductLineFacade(CPApplication.Current.CurrentPage); this.VM.BackupPMList = this.VM.BackupAllPMList.Where(p => p.IsChecked).ToList().Select(p => p.UserSysNo).ToList(); if (this.VM.SysNo > 0) { this.VM.EditUser = CPApplication.Current.LoginUser.DisplayName; facade.Update(this.VM, (obj, args) => { if (args.FaultsHandle()) { return; } CloseDialog(); CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("保存成功", MessageBoxType.Success); }); } else { this.VM.InUser = CPApplication.Current.LoginUser.DisplayName; facade.Create(this.VM, (obj, args) => { if (args.FaultsHandle()) { return; } this.VM.SysNo = args.Result.SysNo; CloseDialog(); CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("创建成功", MessageBoxType.Success); }); } } }
public ProductLineManagement() { InitializeComponent(); this.ProductLineResult.LoadingDataSource += new EventHandler <LoadingDataEventArgs>(ProductLineResult_LoadingDataSource); this.Loaded += (sender, e) => { model = new ProductLineQueryVM(); facade = new ProductLineFacade(); this.DataContext = model; }; }
/// <summary> /// 数据全部导出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void QueryResultGrid_ExportAllClick(object sender, EventArgs e) { var filter = this.dataProductLineList.QueryCriteria as ProductLineQueryVM; if (filter == null || dataProductLineList.TotalCount < 1) { Page.Context.Window.MessageBox.Show("导出失败,请先查询需要导出的结果集。"); return; } ColumnSet col = new ColumnSet(this.dataProductLineList); ProductLineFacade facade = new ProductLineFacade(); facade.ExportExcelFile(filter, new ColumnSet[] { col }); }
public ProductLineMaintain() { InitializeComponent(); this.Loaded += (sender, e) => { facade = new ProductLineFacade(); if (IsEdit) { model = Data; } else { model = new ProductLineVM(); } List <ProductLineCategoryVM> templist = new List <ProductLineCategoryVM>(); templist.Add(new ProductLineCategoryVM() { CategoryName = "--请选择--", SysNo = 0 }); facade.GetAllProductLineCategory((obj, arg) => { if (arg.FaultsHandle()) { return; } foreach (var item in arg.Result.Rows) { templist.Add(new ProductLineCategoryVM() { SysNo = item.SysNo, CategoryName = item.Name }); } model.CategoryList = templist; if (!IsEdit) //新建时才需要默认请选择 { model.Category = (from p in templist where p.SysNo == 0 select p).ToList().FirstOrDefault(); } else { model.Category = (from p in templist where p.SysNo == Data.Category.SysNo select p).ToList().FirstOrDefault(); } this.DataContext = model; }); this.DataContext = model; }; }
public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); #region 2012-12-18 Jack.G.tang Update /* *修改目的:点击商品列表中的价格链接到此页面,并选中价格tab 其他tab禁用 * 新加一个方法(SetTabFocus)和以下代码 */ string opertionType = string.Empty; string tempSysNo = string.Empty; string cookieTabIndex = string.Empty; if (this.Request.QueryString != null) { opertionType = this.Request.QueryString["operation"]; tempSysNo = this.Request.QueryString["ProductSysNo"]; } if (!string.IsNullOrEmpty(Request.Param)) { tempSysNo = Request.Param; } #endregion this.ucProductMaintainProperty.MyWindow = Window; this.ucProductMaintainAccessory.MyWindow = Window; this.productEntryInfo.MyWindow = Window; int productSysNo; if (Int32.TryParse(tempSysNo, out productSysNo)) { _productFacade = new ProductFacade(this); _vm = new ProductVM(); //cookieTabIndex = GetCookie("CookieTabIndex"); _productLineFacade = new ProductLineFacade(this); ucProductMaintainBasicInfo.ucSpecificationInfo.ucCategoryPicker.LoadCategoryCompleted += (s, args2) => _productFacade.GetProductInfo(productSysNo, (obj, args) => { if (args.FaultsHandle()) { return; } if (args.Result == null || args.Result.ProductBasicInfo == null) { Window.MessageBox.Show("无此商品或商品数据完整性有误,请联系管理员检查", MessageBoxType.Error); return; } if (!_vm.HasItemMaintainAllTypePermission && args.Result.ProductBasicInfo.ProductType != ProductType.OpenBox) { Window.MessageBox.Show("该商品不是二手品,无此商品访问权限!", MessageBoxType.Error); return; } var pmQueryFacade = new PMQueryFacade(CPApplication.Current.CurrentPage); var pmQueryFilter = new ProductManagerQueryFilter { UserName = CPApplication.Current.LoginUser.LoginName, CompanyCode = CPApplication.Current.CompanyCode }; if (AuthMgr.HasFunctionPoint(AuthKeyConst.IM_SeniorPM_Query))//高级权限 { pmQueryFilter.PMQueryType = PMQueryType.All.ToString(); } else if (AuthMgr.HasFunctionPoint(AuthKeyConst.IM_JuniorPM_Query)) { pmQueryFilter.PMQueryType = PMQueryType.SelfAndInvalid.ToString(); } else { pmQueryFilter.PMQueryType = PMQueryType.None.ToString(); } int c3sysno = args.Result.ProductBasicInfo.ProductCategoryInfo.SysNo.HasValue ? args.Result.ProductBasicInfo.ProductCategoryInfo.SysNo.Value : 0; int brandsysno = args.Result.ProductBasicInfo.ProductBrandInfo.SysNo.HasValue ? args.Result.ProductBasicInfo.ProductBrandInfo.SysNo.Value : 0; int usersysno = CPApplication.Current.LoginUser.UserSysNo.Value; _productLineFacade.HasRightByPMUser(usersysno , c3sysno , brandsysno, (pmobj, pmargs) => { if (pmargs.FaultsHandle()) { return; } bool userright = AuthMgr.HasFunctionPoint(AuthKeyConst.IM_SeniorPM_Query); if (!userright) { if (!pmargs.Result) { Window.MessageBox.Show("无此商品访问权限!", MessageBoxType.Error); return; } } _vm.ProductSysNo = args.Result.SysNo; #region 商品退换货信息需要productSysNo productRmaPolicy.ProductSysNo = _vm.ProductSysNo; #endregion _vm.Note = args.Result.ProductBasicInfo.Note; _vm.ProductMaintainBasicInfo = new ProductMaintainBasicInfoVM { ProductMaintainBasicInfoSpecificationInfo = _productFacade.ConvertProductEntityToProductMaintainBasicInfoSpecificationInfoVM(args.Result), ProductMaintainBasicInfoDisplayInfo = _productFacade.ConvertProductEntityToProductMaintainBasicInfoDisplayInfoVM(args.Result), ProductMaintainBasicInfoStatusInfo = _productFacade.ConvertProductEntityToProductMaintainBasicInfoStatusInfoVM(args.Result), ProductMaintainBasicInfoChannelInfo = _productFacade.ConvertProductEntityToProductMaintainBasicInfoChannelInfoVM(args.Result), ProductMaintainBasicInfoDescriptionInfo = _productFacade.ConvertProductEntityToProductMaintainBasicInfoDescriptionInfoVM(args.Result), ProductMaintainBasicInfoOther = _productFacade.ConvertProductEntityToProductMaintainBasicInfoOtherVM(args.Result) }; _vm.ProductMaintainDescription = _productFacade.ConvertProductEntityToProductMaintainDescriptionVM(args.Result); _vm.ProductMaintainBatchManagementInfo = _productFacade.ConvertProductEntityToProductMaintainBatchManagementInfoVM(args.Result); _vm.ProductMaintainAccessory = new ProductMaintainAccessoryVM { ProductAccessoryList = _productFacade.ConvertProductEntityToProductMaintainAccessoryProductAccessoryVMList(args.Result), IsAccessoryShow = args.Result.ProductBasicInfo.IsAccessoryShow }; _vm.ProductMaintainImage = _productFacade.ConvertProductEntityToProductMaintainImageVM(args.Result); var priceInfo = _productFacade.ConvertProductEntityToProductMaintainPriceInfoVM(args.Result); if (args.Result.ProductConsignFlag == VendorConsignFlag.Consign && args.Result.Merchant.SysNo != -1) { priceInfo.ProductMaintainPriceInfoBasicPrice.HasMinCommissionVisible = "Visible"; } _vm.ProductMaintainPriceInfo = priceInfo; //_vm.ProductMaintainThirdPartyInventory = _productFacade.ConvertProductEntityToProductMaintainThirdPartyInventoryVM(args.Result); _productFacade.GetProductGroup(productSysNo, (o, group) => { if (@group.FaultsHandle()) { return; } _vm.ProductMaintainCommonInfo = @group.Result.SysNo.HasValue ? _productFacade.ConvertProductGroupEntityToProductMaintainCommonInfoVM(@group.Result, args.Result) : _productFacade.ConvertProductEntityToProductMaintainCommonInfoVM(args.Result); _vm.ProductMaintainProperty = _productFacade.ConvertProductEntityToProductMaintainPropertyVM(args.Result, group.Result); _productFacade.GetPropertyValueList(args.Result.ProductBasicInfo.ProductProperties.Select(p => p.Property.PropertyInfo.SysNo.HasValue ? p.Property.PropertyInfo.SysNo.Value : 0).ToList(), (ob, arg) => { if (args.FaultsHandle()) { return; } foreach (var productMaintainPropertyPropertyValueVM in _vm.ProductMaintainProperty.ProductPropertyValueList) { productMaintainPropertyPropertyValueVM.PropertyValueList = new List <PropertyValueVM>(); foreach (var i in arg.Result.Keys) { if (productMaintainPropertyPropertyValueVM.Property.SysNo == i) { productMaintainPropertyPropertyValueVM.PropertyValueList = _productFacade.ConvertPropertyValueInfoToPropertyValueVM(arg.Result[i]); } } productMaintainPropertyPropertyValueVM.PropertyValueList.Insert(0, new PropertyValueVM { SysNo = 0, ValueDescription = "请选择..." }); } DataContext = _vm; }); _vm.ProductMaintainWarranty = _productFacade.ConvertProductEntityToProductMaintainWarrantyVM(args.Result); _vm.ProductMaintainDimension = _productFacade.ConvertProductEntityToProductMaintainDimensionVM(args.Result); _vm.ProductMaintainPurchaseInfo = _productFacade.ConvertProductEntityToProductMaintainPurchaseInfoVM(args.Result); _vm.ProductMaintainSalesArea = new ProductMaintainSalesAreaVM { ProductMaintainSalesAreaSaveList = _productFacade.ConvertProductInfoEntityToProductMaintainSalesAreaSelectVM(args.Result) }; DataContext = _vm; ucProductMaintainCommonInfo.dgRelatedProduct.ItemsSource = _vm.ProductMaintainCommonInfo.GroupProductList; foreach (var control in VM.ProductMaintainImage.ProductImageList.Select(i => new ProductMaintainProductImageSingle { VM = i })) { ucProductMaintainImage.ImageListPanel.Children.Add(control); } //Ocean.20130523. 记录上次打开的Tab,会引起商品属性的加载,暂时屏蔽此功能 //int cookieTabIndexVal = 0; //if (!string.IsNullOrEmpty(cookieTabIndex) && int.TryParse(cookieTabIndex, out cookieTabIndexVal)) //{ // ucProductTabList.SelectedIndex = cookieTabIndexVal; //} var areaFacade = new AreaQueryFacade(); areaFacade.QueryProvinceAreaList((areaObj, areaArgs) => { if (areaArgs.FaultsHandle()) { return; } List <ProvinceVM> provinceList = _productFacade.ConvertAreaInfoEntityToProvinceVM(areaArgs.Result); provinceList.Insert(0, new ProvinceVM { ProvinceSysNo = 0, ProvinceName = "请选择..." }); ucProductMaintainSalesArea.cmbProvinceList.ItemsSource = provinceList; ucProductMaintainSalesArea.cmbProvinceList.SelectedValue = 0; List <CityVM> cityList = new List <CityVM>(); cityList.Insert(0, new CityVM { CitySysNo = 0, CityName = "请选择..." }); ucProductMaintainSalesArea.cmbCityList.ItemsSource = cityList; ucProductMaintainSalesArea.cmbCityList.SelectedValue = 0; SetTabFocus(opertionType); }); _facade = new ProductPriceRequestFacade(); _facade.GetProductStepPricebyProductSysNo(productSysNo, (priceobj, priceargs) => { if (priceargs.FaultsHandle()) { return; } VM.ProductMaintainStepPrice.QueryResultList = priceargs.Result; VM.ProductMaintainStepPrice.ProductSysNo = VM.ProductSysNo; }); }); }); if (args.Result.ProductConsignFlag == VendorConsignFlag.GroupBuying || (args.Result.ProductBasicInfo != null && args.Result.ProductBasicInfo.TradeType == TradeType.Internal)) { productEntryInfo_tab.Visibility = System.Windows.Visibility.Collapsed; } }); //TLYH去除商品备案功能 by Key on 2015/7/23 //if (AuthMgr.HasFunctionPoint(AuthKeyConst.IM_ProductMaintain_ItemProductMaintainEntryInfo)) //{ // productEntryInfo_tab.Visibility = System.Windows.Visibility.Visible; //} } else { Window.MessageBox.Show("无效商品编号", MessageBoxType.Error); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { Page.Window.MessageBox.Clear(); if (this.VM.ProductLineList == null || this.VM.ProductLineList.Count == 0) { string infostring = "请先选择批量更新的数据,之后再进行更新操作!"; if (this.VM.IsEmptyC2Create) { infostring = "请先选择批量创建的数据,之后再进行更新操作!"; } Page.Window.MessageBox.Show(infostring, MessageBoxType.Warning); return; } if (this.VM.IsEmptyC2Create) { if (this.ucPMPicker.SelectedPMSysNo == null) { Page.Window.MessageBox.Show("请选择产品经理!", MessageBoxType.Warning); return; } if (this.ucMerchandiserPicker.SelectedPMSysNo == null) { Page.Window.MessageBox.Show("请选择跟单员!", MessageBoxType.Warning); return; } } else { this.VM.BakPMUpdateType = "Append"; if (OperatorType2.IsChecked.Value) { this.VM.BakPMUpdateType = "Remove"; } } this.VM.BackupPMList = this.VM.BackupAllPMList.Where(p => p.IsChecked).ToList().Select(p => p.UserSysNo).ToList(); ProductLineFacade facade = new ProductLineFacade(); facade.BatchUpdate(this.VM, (obj, args) => { MessageBoxType messagetype = MessageBoxType.Success; string errorstring = string.Empty; if (args.Error != null) { bool isBizException = true; messagetype = MessageBoxType.Warning; errorstring = GetError(args.Error, ref isBizException); if (!isBizException) { messagetype = MessageBoxType.Error; } } else { errorstring = "更新成功"; if (this.VM.IsEmptyC2Create) { errorstring = "创建成功"; } this.Dialog.Close(); } Page.Window.MessageBox.Show(errorstring, messagetype); Page.ListControl.BindData(Page.Filter); }); }