private void BindPage()
 {
     if (SysNo >= 0)
     {
         _facade = new CategoryPropertyFacade();
         _facade.GetCategoryPropertyBySysNo(SysNo, (obj, args) =>
         {
             if (args.FaultsHandle())
             {
                 return;
             }
             if (args.Result == null)
             {
                 CPApplication.Current.CurrentPage.Context.Window.Alert("获取属性分类失败");
                 return;
             }
             var vm           = args.Result.Convert <CategoryProperty, CategoryPropertyVM>();
             vm.Property      = args.Result.Property.Convert <PropertyInfo, PropertyVM>();
             vm.PropertyGroup = args.Result.PropertyGroup.Convert <PropertyGroupInfo, PropertyGroupInfoVM>
                                    ((v, t) =>
             {
                 t.PropertyGroupName = v.PropertyGroupName.Content;
             });
             DataContext = vm;
         });
     }
     else
     {
         CPApplication.Current.CurrentPage.Context.Window.Alert("获取属性分类失败");
         return;
     }
 }
Example #2
0
 public CategoryPropertyBatEdit()
 {
     InitializeComponent();
     this.Loaded += (sender, e) =>
     {
         this.dgCategoryPropertyResult.ItemsSource = DataSource;
         facade = new CategoryPropertyFacade();
     };
 }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            //有效性验证
            if (!ValidateCondition())
            {
                return;
            }

            var vm = DataContext as CategoryPropertyVM;

            if (vm == null)
            {
                return;
            }
            ValidationManager.Validate(this);
            if (vm.ValidationErrors.Count != 0)
            {
                return;
            }

            if (vm.PropertyGroup == null || vm.PropertyGroup.PropertyGroupName == null)
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("属性分类组名不能为空");
                return;
            }
            _facade = new CategoryPropertyFacade();
            _facade.UpdateCategoryProperty(vm, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    var errorMsg = args.Error.Faults[0].ErrorDescription;
                    CPApplication.Current.CurrentPage.Context.Window.Alert(errorMsg);
                    return;
                }
                CPApplication.Current.CurrentPage.Context.Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                CloseDialog(DialogResultType.OK);
            });
        }
Example #4
0
        private void BtnCopy_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as CategoryPropertyQueryVM;

            if (!ValidationManager.Validate(this))
            {
                return;
            }
            if (vm.CategorySysNo == vm.SourceCategorySysNo)
            {
                Window.Alert("自己不能复制自己!", MessageType.Error);
                return;
            }
            CategoryPropertyFacade facade = new CategoryPropertyFacade(this);

            facade.CopyCategoryOutputTemplateProperty(vm, (obj, arg) => {
                if (arg.FaultsHandle())
                {
                    return;
                }
                Window.Alert("复制成功!");
                dgCategoryPropertyQueryResult.Bind();
            });
        }