Beispiel #1
0
 private bool isExist = false; //图片地址是否存在
 public BrandAuthorizedMaintain()
 {
     InitializeComponent();
     this.BrandAuthorizedResult.LoadingDataSource += new EventHandler <LoadingDataEventArgs>(BrandAuthorizedResult_LoadingDataSource);
     this.Loaded += (e, sender) =>
     {
         facade           = new BrandFacade();
         model            = new BrandAuthorizedVM();
         this.DataContext = model;
         this.BrandAuthorizedResult.Bind();
     };
 }
Beispiel #2
0
        private void BtnSaveClick(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as BrandVM;

            if (vm == null)
            {
                return;
            }

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

            /*
             * if (vm.ManufacturerInfo == null || vm.ManufacturerInfo.SysNo == null)
             * {
             *  Window.MessageBox.Show("生产商不空为能.", MessageBoxType.Warning);
             *  return;
             * }*/
            _facade  = new BrandFacade();
            vm.SysNo = _sysNo;
            if (vm.SysNo == null || vm.SysNo.Value <= 0)
            {
                _facade.CreateBrand(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    vm.SysNo   = args.Result.SysNo;
                    vm.BrandID = Convert.ToString(vm.SysNo);
                    Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                });
            }
            else
            {
                _facade.UpdateBrand(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                });
            }
        }
Beispiel #3
0
 private void BindPage(string brandSysNo)
 {
     if (!String.IsNullOrEmpty(brandSysNo))
     {
         _facade = new BrandFacade();
         if (!int.TryParse(brandSysNo, out _sysNo))
         {
             Window.MessageBox.Show("无效品牌编号.", MessageBoxType.Warning);
             return;
         }
         _facade.GetBrandBySysNo(_sysNo, (obj, args) =>
         {
             if (args.FaultsHandle())
             {
                 return;
             }
             if (args.Result == null)
             {
                 Window.MessageBox.Show("没有获得品牌信息.", MessageBoxType.Warning);
                 return;
             }
             var vm = args.Result.Convert <BrandInfo, BrandVM>();
             vm.BrandSupportInfo = args.Result.BrandSupportInfo.Convert <BrandSupportInfo, BrandSupportVM>();
             if (args.Result.Manufacturer != null)
             {
                 vm.ManufacturerInfo = args.Result.Manufacturer.Convert <ManufacturerInfo, ManufacturerVM>();
                 vm.ManufacturerInfo.ManufacturerNameLocal = args.Result.Manufacturer.ManufacturerNameLocal.Content;
             }
             vm.BrandID  = Convert.ToString(vm.SysNo);
             DataContext = vm;
             //ucManufacturerPicker.IsEnabled = false;
         });
     }
     else
     {
         _sysNo = 0;
         var brand = new BrandVM {
             ManufacturerInfo = new ManufacturerVM(), BrandSupportInfo = new BrandSupportVM()
         };
         DataContext = brand;
         cmbBrandStatusLis.SelectedIndex = 0;
         ucManufacturerPicker.IsEnabled  = true;
     }
 }