public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); _facade = new FreeShippingChargeRuleFacade(this); _areaQueryFacade = new AreaQueryFacade(); _queryVM = new FreeShippingChargeRuleQueryVM(); GridQueryFilter.DataContext = _queryVM; _areaQueryFacade.QueryProvinceAreaList((obj, args) => { if (args.FaultsHandle()) { return; } List <AreaInfo> areaList = args.Result; if (areaList == null) { areaList = new List <AreaInfo>(); } areaList.Insert(0, new AreaInfo() { ProvinceName = ResCommonEnum.Enum_Select }); comArea.ItemsSource = areaList; }); }
private void UCFreeShippingChargeRule_Loaded(object sender, RoutedEventArgs e) { _facade = new FreeShippingChargeRuleFacade(CurrentPage); _areaQueryFacade = new AreaQueryFacade(); _areaQueryFacade.QueryProvinceAreaList((_, args) => { if (args.FaultsHandle()) { return; } List <AreaInfo> areaList = args.Result; if (areaList == null) { areaList = new List <AreaInfo>(); } areaList.Insert(0, new AreaInfo() { ProvinceName = ResCommonEnum.Enum_Select }); cmbArea.ItemsSource = areaList; }); if (_sysNo.HasValue && _sysNo.Value > 0) { _facade.Load(_sysNo.Value, (_, args) => { _model = args.Result; LayoutRoot.DataContext = _model; this.SetButtonState(); }); } else { _model = new FreeShippingChargeRuleVM() { Status = FreeShippingAmountSettingStatus.DeActive, IsGlobal = false }; LayoutRoot.DataContext = _model; this.SetButtonState(); } }
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); } }
void UCCustomerRange_Loaded(object sender, RoutedEventArgs e) { if (isLoaded) { return; } CouponsInfoViewModel vm = this.DataContext as CouponsInfoViewModel; if (vm.IsCustomerNoLimit.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Collapsed; gridUserIDSetting.Visibility = System.Windows.Visibility.Collapsed; PreLimitType = LimitType.NoLimit; } else if (vm.IsCustomerRank.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Visible; gridUserIDSetting.Visibility = System.Windows.Visibility.Collapsed; PreLimitType = LimitType.CustomerRank; } else if (vm.IsCustomerID.Value) { gridUserRankSetting.Visibility = System.Windows.Visibility.Collapsed; gridUserIDSetting.Visibility = System.Windows.Visibility.Visible; PreLimitType = LimitType.CustomerID; } if (vm.IsAreaNoLimit.Value) { gridArea.Visibility = System.Windows.Visibility.Collapsed; PreIsNoLimitArea = true; } else { gridArea.Visibility = System.Windows.Visibility.Visible; PreIsNoLimitArea = false; } ComboBoxItem defaultItem = new ComboBoxItem(); defaultItem.Content = "不限"; defaultItem.Tag = -1; defaultItem.IsSelected = false; cmbCustomerRank.Items.Add(defaultItem); foreach (var value in Enum.GetValues(typeof(CustomerRank))) { if (vm.CustomerCondition.RelCustomerRanks.CustomerRankList != null) { SimpleObjectViewModel sim = vm.CustomerCondition.RelCustomerRanks.CustomerRankList.FirstOrDefault(f => f.SysNo.Value == (int)value); if (sim != null) { CustomerRank cre = (CustomerRank)Enum.Parse(typeof(CustomerRank), value.ToString(), true); sim.Name = EnumConverter.GetDescription(cre); continue; } } ComboBoxItem item = new ComboBoxItem(); CustomerRank k = (CustomerRank)Enum.Parse(typeof(CustomerRank), value.ToString(), true); item.Content = EnumConverter.GetDescription(k); item.Tag = value; item.IsSelected = false; cmbCustomerRank.Items.Add(item); } if (cmbCustomerRank.Items.Count > 0) { cmbCustomerRank.SelectedIndex = 0; } AreaQueryFacade areaFacade = new AreaQueryFacade(); areaFacade.QueryProvinceAreaList((obj, args) => { if (args.FaultsHandle()) { return; } List <AreaInfo> areaList = args.Result; foreach (AreaInfo area in areaList) { if (vm.CustomerCondition.RelAreas.AreaList != null) { SimpleObjectViewModel sim = vm.CustomerCondition.RelAreas.AreaList.FirstOrDefault(f => f.SysNo == area.SysNo); if (sim != null) { sim.Name = area.ProvinceName; continue; } } ComboBoxItem item = new ComboBoxItem(); item.Content = area.ProvinceName; item.Tag = area.SysNo; item.IsSelected = false; cmbArea.Items.Add(item); } if (cmbArea.Items.Count > 0) { cmbArea.SelectedIndex = 0; } }); if (vm.IsOnlyViewMode) { OperationControlStatusHelper.SetControlsStatus(gridLayout, true); } isLoaded = true; }