private void dgPMQueryResult_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e) { PMQueryFacade facade = new PMQueryFacade(this); facade.QueryPM(model, e.PageSize, e.PageIndex, e.SortField, (obj, args) => { _vmList = DynamicConverter <PMVM> .ConvertToVMList <List <PMVM> >(args.Result.Rows); this.dgPMQueryResult.ItemsSource = _vmList; this.dgPMQueryResult.TotalCount = args.Result.TotalCount; }); }
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); } }