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); }
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; }
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); }
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); }); }
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); }); } } }
private void ButtonNew_Click(object sender, RoutedEventArgs e) { this.VM = new GroupBuyingCategoryVM(); }