示例#1
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtCategoryID.Text))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert(ResManufacturerIndexPageCategory.Msg_CategoryIDIsEmpty, MessageType.Warning);
                return;
            }
            int categodyID;

            if (!int.TryParse(txtCategoryID.Text, out categodyID))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert(ResManufacturerIndexPageCategory.Msg_CategoryIDIsInvalid, MessageType.Warning);
                return;
            }
            var brandShipCategory = new BrandShipCategory();
            int categoryID;

            int.TryParse(txtCategoryID.Text, out categoryID);
            brandShipCategory.BrandShipCategoryID = categoryID;
            brandShipCategory.ManufacturerSysNo   = ManufacturerSysNo;
            if (brandShipCategory.BrandShipCategoryID != 0 && ManufacturerSysNo != 0)
            {
                var facade = new ManufacturerFacade();
                facade.CreateBrandShipCategory(brandShipCategory, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResManufacturerIndexPageCategory.Msg_AddSuccessfully);
                    dgManufacturerIndexPageCategory.Bind();
                });
            }
        }
示例#2
0
 private void HyperlinkDelete_Click(object sender, RoutedEventArgs e)
 {
     CPApplication.Current.CurrentPage.Context.Window.Confirm(ResManufacturerIndexPageCategory.Msg_IsDeleteCategory, (o, a) =>
     {
         if (a.DialogResult == DialogResultType.OK)
         {
             var brandShipCategory = this.dgManufacturerIndexPageCategory.SelectedItem as dynamic;
             int sysNo             = brandShipCategory.SysNo;
             var facade            = new ManufacturerFacade();
             if (brandShipCategory != null)
             {
                 facade.DeleteBrandShipCategory(sysNo, (obj, args) => dgManufacturerIndexPageCategory.Bind());
             }
         }
     });
 }
示例#3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var vm = DataContext as ManufacturerVM;

            if (vm == null)
            {
                return;
            }
            //ValidationManager.Validate(ChildLayoutRoot);
            if (!ValidationManager.Validate(this))
            {
                return;
            }

            _facade  = new ManufacturerFacade();
            vm.SysNo = _sysNo;
            if (vm.SysNo == null || vm.SysNo.Value <= 0)
            {
                _facade.CreateManufacturer(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    vm.SysNo          = args.Result.SysNo;
                    vm.ManufacturerID = Convert.ToString(args.Result.SysNo);
                    Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                });
            }
            else
            {
                _facade.UpdateManufacturer(vm, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    Window.Alert(ResBrandMaintain.Info_SaveSuccessfully);
                });
            }
        }
示例#4
0
 private void BindPage(string brandSysNo)
 {
     if (!String.IsNullOrEmpty(brandSysNo))
     {
         _facade = new ManufacturerFacade();
         if (!int.TryParse(brandSysNo, out _sysNo))
         {
             Window.MessageBox.Show("生产商编号无效.", MessageBoxType.Warning);
         }
         ;
         _facade.GetManufacturerBySysNo(_sysNo, (obj, args) =>
         {
             if (args.FaultsHandle())
             {
                 return;
             }
             if (args.Result == null)
             {
                 Window.MessageBox.Show("没有获得生产商信息.", MessageBoxType.Warning);
                 return;
             }
             var vm         = args.Result.Convert <ManufacturerInfo, ManufacturerVM>();
             vm.SupportInfo = args.Result.SupportInfo.Convert <ManufacturerSupportInfo, ManufacturerSupportVM>();
             DataContext    = vm;
         });
     }
     else
     {
         _sysNo = 0;
         var brand = new ManufacturerVM {
             SupportInfo = new ManufacturerSupportVM()
         };
         DataContext = brand;
         cmbManufacturerStatusList.SelectedIndex = 0;
     }
 }
示例#5
0
 public ManufacturerController(
     ManufacturerFacade manufacturerFacade)
 {
     this.manufacturerFacade = manufacturerFacade;
 }