コード例 #1
0
        private void BtnAddSimilarClick(object sender, RoutedEventArgs e)
        {
            var productGroupFacade = new ProductGroupFacade();

            if (_vm.SelectedProduct.Any(p => p.IsChecked))
            {
                if (ValidationManager.Validate(dgProductList))
                {
                    productGroupFacade.CreateSimilarProduct(_vm, (obj, args) =>
                    {
                        if (args.FaultsHandle())
                        {
                            return;
                        }
                        args.Result.SuccessProductList.ForEach(
                            p =>
                            VM.MainPageVM.ProductListVM.ProductGroupProductVMList.Add(
                                productGroupFacade.ConvertProductInfoEntityToProductGroupProductVM(p)));
                        CloseDialog(DialogResultType.OK, args.Result.ErrorProductList);
                    });
                }
            }
            else
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("请至少选择一个商品!", MessageType.Warning);
            }
        }
コード例 #2
0
        public void C3SelectChangedClick(object sender, EventArgs e)
        {
            var cmbSelect = (Combox)sender;

            if (cmbSelect.SelectedValue != null)
            {
                var productGroupFacade = new ProductGroupFacade();
                productGroupFacade.GetCategorySetting((int)cmbSelect.SelectedValue, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    var categoryPropertyList = productGroupFacade.ConvertCategoryPropertyListToPropertyVMList(
                        args.Result.CategoryProperties.Where(
                            property => property.PropertyType == PropertyType.Grouping));

                    categoryPropertyList.Insert(0, new PropertyVM
                    {
                        SysNo        = 0,
                        PropertyName = "请选择..."
                    });

                    var currentPage = (Views.ProductGroupMaintain)CPApplication.Current.CurrentPage;
                    currentPage.VM.PropertyVM.CategoryPropertyList = categoryPropertyList;
                    RefreshProductGroupSettingVM(currentPage.VM.PropertyVM.ProductGroupSettings[0]);
                    RefreshProductGroupSettingVM(currentPage.VM.PropertyVM.ProductGroupSettings[1]);
                });
            }
        }
コード例 #3
0
        private void dgProductGroupQueryResult_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            ProductGroupFacade facade = new ProductGroupFacade(this);

            facade.QueryProductGroupInfo(model, e.PageSize, e.PageIndex, e.SortField, (obj, args) =>
            {
                _vmList = DynamicConverter <ProductGroupVM> .ConvertToVMList <List <ProductGroupVM> >(args.Result.Rows);
                this.dgProductGroupQueryResult.ItemsSource = _vmList;
                this.dgProductGroupQueryResult.TotalCount  = args.Result.TotalCount;
            });
        }
コード例 #4
0
        private void BtnSaveClick(object sender, RoutedEventArgs e)
        {
            _productGroupFacade = new ProductGroupFacade(this);

            if (ValidationManager.Validate(this))
            {
                if (!CheckSaveCondition())
                {
                    return;
                }

                if (VM.CreateFlag)
                {
                    _productGroupFacade.CreateProductGroupInfo(VM, (obj, args) =>
                    {
                        if (args.FaultsHandle())
                        {
                            return;
                        }
                        if (!args.Result.SysNo.HasValue)
                        {
                            Window.MessageBox.Show("商品组创建异常,请查系统日志", MessageBoxType.Error);
                            return;
                        }
                        Window.MessageBox.Show("商品组创建成功", MessageBoxType.Success);
                        VM.CreateFlag        = false;
                        VM.ProductGroupSysNo = args.Result.SysNo.Value;
                    });
                }
                else
                {
                    _productGroupFacade.UpdateProductGroupInfo(VM, (obj, args) =>
                    {
                        if (args.FaultsHandle())
                        {
                            return;
                        }
                        Window.MessageBox.Show("商品组更新成功", MessageBoxType.Success);
                    });
                }
            }
        }
コード例 #5
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            int productGroupSysNo;

            _vm = new ProductGroupMaintainVM();

            if (Int32.TryParse(Request.Param, out productGroupSysNo))
            {
                _productGroupFacade = new ProductGroupFacade(this);

                _vm.CreateFlag = false;

                ucProductGroupMaintainBasicInfo.ucCategoryPicker
                .LoadCategoryCompleted += (s, arg)
                                          => _productGroupFacade.GetProductGroupInfoBySysNo(productGroupSysNo, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    if (args.Result == null || !args.Result.SysNo.HasValue || args.Result.ProductList.Count == 0)
                    {
                        Window.MessageBox.Show("无此商品组或商品组数据完整性有误,请联系管理员检查", MessageBoxType.Error);
                        return;
                    }
                    ucProductGroupMaintainBasicInfo.ucCategoryPicker.cmbCategory3SelectionChanged -= ucProductGroupMaintainBasicInfo.C3SelectChangedClick;
                    _vm.ProductGroupSysNo = args.Result.SysNo.Value;
                    _vm.BasicInfoVM       =
                        _productGroupFacade.ConvertProductGroupEntityToProductGroupMaintainBasicInfoVM(args.Result);
                    _vm.ProductListVM =
                        _productGroupFacade.ConvertProductGroupEntityToProductGroupMaintainProductListVM(args.Result);
                    var sysNo = args.Result.ProductList.First().ProductBasicInfo.ProductCategoryInfo.SysNo;
                    if (sysNo.HasValue)
                    {
                        _productGroupFacade.GetCategorySetting(sysNo.Value, (o, a) =>
                        {
                            if (a.FaultsHandle())
                            {
                                return;
                            }

                            var categoryPropertyList = _productGroupFacade.
                                                       ConvertCategoryPropertyListToPropertyVMList
                                                           (a.Result.CategoryProperties.Where(property => property.PropertyType == PropertyType.Grouping));

                            categoryPropertyList.Insert(0, new PropertyVM
                            {
                                SysNo        = 0,
                                PropertyName = "请选择..."
                            });

                            _vm.PropertyVM =
                                _productGroupFacade.ConvertProductGroupEntityToProductGroupMaintainPropertySettingVM(
                                    args.Result);

                            _vm.PropertyVM.CategoryPropertyList
                                = categoryPropertyList;

                            DataContext = _vm;
                            ucProductGroupMaintainProductList.dgProductGroupProductList.ItemsSource =
                                _vm.ProductListVM.ProductGroupProductVMList;
                        });
                    }
                });
            }
            else
            {
                _vm.CreateFlag = true;
                DataContext    = _vm;
            }
        }