private void btnAudit_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as SellerProductRequestVM;

            if (vm == null)
            {
                return;
            }

            _facade  = new SellerProductRequestFacade();
            vm.SysNo = _sysNo;
            if (vm.SysNo == null || vm.SysNo.Value <= 0)
            {
                return;
            }
            else
            {
                _facade.ApproveProductRequest(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);

                    CloseDialog(DialogResultType.OK);
                });
            }
        }
        private void btnDeny_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as SellerProductRequestVM;

            if (vm == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(vm.Memo))
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("必须输入退回理由.", MessageBoxType.Warning);
                return;
            }

            _facade  = new SellerProductRequestFacade();
            vm.SysNo = _sysNo;
            if (vm.SysNo == null || vm.SysNo.Value <= 0)
            {
                return;
            }
            else
            {
                _facade.DenyProductRequest(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);

                    BindPage();
                });
            }
        }
        private void btnCreateID_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as SellerProductRequestVM;

            if (vm == null)
            {
                return;
            }

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

            if (vm.CategoryInfo == null || vm.CategoryInfo.SysNo == null || string.IsNullOrEmpty(vm.CategoryInfo.CategoryName))
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("类别信息不正确.", MessageBoxType.Warning);
                return;
            }

            if (vm.Brand == null || vm.Brand.SysNo == null)
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("品牌信息不正确.", MessageBoxType.Warning);
                return;
            }

            if (vm.PMUser == null || vm.PMUser.SysNo == null || vm.PMUser.SysNo == 0)
            {
                CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show("PM信息不正确.", MessageBoxType.Warning);
                return;
            }

            _facade  = new SellerProductRequestFacade();
            vm.SysNo = _sysNo;
            if (vm.SysNo == null || vm.SysNo.Value <= 0)
            {
                return;
            }
            else
            {
                _facade.CreateItemIDForNewProductRequest(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);

                    CloseDialog(DialogResultType.OK);
                });
            }
        }
        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;
            }
        }
Example #5
0
        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;
            }
        }