Esempio n. 1
0
        private void hlEdit_Click(object sender, RoutedEventArgs e)
        {
            dynamic       d  = this.ProductLineResult.SelectedItem as dynamic;
            ProductLineVM vm = new ProductLineVM()
            {
                ProductLineName     = d.ProductLineName,
                SysNo               = d.SysNo,
                UseScopeDescription = d.Note,
                Priority            = Convert.ToString(d.PRI),
                Category            = new ProductLineCategoryVM()
                {
                    CategoryName = d.CategoryName, SysNo = d.CategorySysNo
                }
            };
            ProductLineMaintain item = new ProductLineMaintain();

            item.IsEdit = true;
            item.Data   = vm;
            item.Dialog = Window.ShowDialog("编辑", item, (s, args) =>
            {
                if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK)
                {
                    this.ProductLineResult.Bind();
                }
            }, new Size(400, 300));
        }
Esempio n. 2
0
        public void Update(ProductLineVM vm, EventHandler <RestClientEventArgs <ProductLineInfo> > callback)
        {
            string relativeUrl = "/IMService/ProductLine/Update";
            var    msg         = vm.ConvertVM <ProductLineVM, ProductLineInfo>();

            restClient.Update <ProductLineInfo>(relativeUrl, msg, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                callback(obj, args);
            });
        }
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            Window.MessageBox.Clear();
            var vm = new ProductLineVM();
            UCProductLineDetail uc     = new UCProductLineDetail(vm);
            IDialog             dialog = Window.ShowDialog("添加产品线", uc, (obj, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    this.ListControl.BindData(this.Filter);
                }
            });

            uc.Dialog = dialog;
        }
Esempio n. 4
0
        public void Create(ProductLineVM vm, EventHandler <RestClientEventArgs <ProductLineInfo> > callback)
        {
            string relativeUrl = "/IMService/ProductLine/Create";
            var    msg         = vm.ConvertVM <ProductLineVM, ProductLineInfo>();

            msg.CompanyCode = CPApplication.Current.CompanyCode;
            restClient.Create <ProductLineInfo>(relativeUrl, msg, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                callback(obj, args);
            });
        }
        public ProductLineMaintain()
        {
            InitializeComponent();
            this.Loaded += (sender, e) =>
            {
                facade = new ProductLineFacade();
                if (IsEdit)
                {
                    model = Data;
                }
                else
                {
                    model = new ProductLineVM();
                }
                List <ProductLineCategoryVM> templist = new List <ProductLineCategoryVM>();
                templist.Add(new ProductLineCategoryVM()
                {
                    CategoryName = "--请选择--", SysNo = 0
                });
                facade.GetAllProductLineCategory((obj, arg) =>
                {
                    if (arg.FaultsHandle())
                    {
                        return;
                    }

                    foreach (var item in arg.Result.Rows)
                    {
                        templist.Add(new ProductLineCategoryVM()
                        {
                            SysNo = item.SysNo, CategoryName = item.Name
                        });
                    }
                    model.CategoryList = templist;
                    if (!IsEdit) //新建时才需要默认请选择
                    {
                        model.Category = (from p in templist where p.SysNo == 0 select p).ToList().FirstOrDefault();
                    }
                    else
                    {
                        model.Category = (from p in templist where p.SysNo == Data.Category.SysNo select p).ToList().FirstOrDefault();
                    }
                    this.DataContext = model;
                });
                this.DataContext = model;
            };
        }
Esempio n. 6
0
 private ProductLineInfo ConvertToProductLine(ProductLineVM model)
 {
     return(new ProductLineInfo()
     {
         CompanyCode = CPApplication.Current.CompanyCode,
         LanguageCode = CPApplication.Current.LanguageCode,
         Priority = Convert.ToInt32(model.Priority),
         ProductLineCategorySysNo = model.Category.SysNo,
         ProductLineName = model.ProductLineName,
         User = new BizEntity.Common.UserInfo()
         {
             SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.DisplayName
         },
         UseScopeDescription = model.UseScopeDescription,
         SysNo = model.SysNo
     });
 }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            ProductLineVM vm = this.DataContext as ProductLineVM;

            if (!ValidationManager.Validate(this))
            {
                return;
            }
            if (vm.Category.SysNo == 0)
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("请选择产品线分类", MessageType.Error);
                return;
            }

            if (vm.SysNo > 0)
            {
                facade.UpdateProductLine(vm, (obj, arg) =>
                {
                    if (arg.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert("更新成功!");
                    CloseDialog(DialogResultType.OK);
                });
            }
            else
            {
                facade.CreateProductLine(vm, (obj, arg) =>
                {
                    if (arg.FaultsHandle())
                    {
                        return;
                    }
                    CPApplication.Current.CurrentPage.Context.Window.Alert("添加成功!");
                    CloseDialog(DialogResultType.OK);
                });
            }
        }
 public UCProductLineDetail(ProductLineVM vm)
     : this()
 {
     this.VM = vm;
 }
Esempio n. 9
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <param name="callback"></param>
        public void UpdateProductLine(ProductLineVM model, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            string UpdateProductLineUrl = "ExternalSYSService/ProductLine/UpdateProductLine";

            restClient.Update(UpdateProductLineUrl, ConvertToProductLine(model), callback);
        }