示例#1
0
        public void UpdateGroupBuyingCategory(GroupBuyingCategoryVM vm, EventHandler <RestClientEventArgs <GroupBuyingCategoryInfo> > callback)
        {
            var msg = EntityConverter <GroupBuyingCategoryVM, GroupBuyingCategoryInfo> .Convert(vm);

            string relativeUrl = "/MKTService/GroupBuying/UpdateGroupBuyingCategory";

            restClient.Update(relativeUrl, msg, callback);
        }
示例#2
0
        private void hybtnEdit_Click(object sender, RoutedEventArgs e)
        {
            var link = sender as HyperlinkButton;
            var info = link.DataContext as GroupBuyingCategoryInfo;
            var vm   = EntityConverter <GroupBuyingCategoryInfo, GroupBuyingCategoryVM> .Convert(info);

            this.VM = vm;
        }
示例#3
0
        public void CreateGroupBuyingCategory(GroupBuyingCategoryVM vm, EventHandler <RestClientEventArgs <GroupBuyingCategoryInfo> > callback)
        {
            var msg = EntityConverter <GroupBuyingCategoryVM, GroupBuyingCategoryInfo> .Convert(vm);

            msg.CompanyCode = CPApplication.Current.CompanyCode;

            string relativeUrl = "/MKTService/GroupBuying/CreateGroupBuyingCategory";

            restClient.Create(relativeUrl, msg, callback);
        }
示例#4
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            this.VM     = new GroupBuyingCategoryVM();
            this.facade = new GroupBuyingFacade(this);
            facade.GetAllGroupBuyingCategory((s, a) =>
            {
                if (a.FaultsHandle())
                {
                    return;
                }
                this.DataGrid.ItemsSource = new ObservableCollection <GroupBuyingCategoryInfo>(a.Result);
            });
        }
示例#5
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            var source = this.DataGrid.ItemsSource as ObservableCollection <GroupBuyingCategoryInfo>;

            if (ValidationManager.Validate(this.GridMaintain))
            {
                if ((this.VM.SysNo ?? 0) > 0)
                {
                    facade.UpdateGroupBuyingCategory(this.VM, (o, a) =>
                    {
                        if (a.FaultsHandle())
                        {
                            return;
                        }

                        var item = source.FirstOrDefault(p => p.SysNo == VM.SysNo);
                        if (item != null)
                        {
                            int index = source.IndexOf(item);
                            source.RemoveAt(index);
                            source.Insert(index, a.Result);
                        }
                        //this.Window.Alert("保存成功!");
                        this.Window.Alert(ResGroupBuyingCategoryQuery.Info_SaveSuccess);
                    });
                }
                else
                {
                    facade.CreateGroupBuyingCategory(this.VM, (o, a) =>
                    {
                        if (a.FaultsHandle())
                        {
                            return;
                        }
                        if (source != null)
                        {
                            source.Add(a.Result);
                        }
                        //this.VM.SysNo = a.Result.SysNo;
                        this.VM = new GroupBuyingCategoryVM();
                        //this.Window.Alert("保存成功!");
                        this.Window.Alert(ResGroupBuyingCategoryQuery.Info_SaveSuccess);
                    });
                }
            }
        }
示例#6
0
 private void ButtonNew_Click(object sender, RoutedEventArgs e)
 {
     this.VM = new GroupBuyingCategoryVM();
 }