void UCAddPayType_Loaded(object sender, RoutedEventArgs e) { facade = new PayTypeFacade(CPApplication.Current.CurrentPage); if (_sysNo.HasValue) { facade.LoadPayType(_sysNo, (obj, args) => { VM = args.Result; VM.IsEdit = true; LayoutRoot.DataContext = VM; if (VM.IsNetEnum == SYNStatus.Yes) { VM.IsNetPay = true; } comIsNet.SelectionChanged += new SelectionChangedEventHandler(comIsNet_SelectionChanged); }); } else { VM = new PayTypeVM() { IsEdit = false, IsNetEnum = SYNStatus.No }; LayoutRoot.DataContext = VM; comIsPayWhenRecv.SelectedIndex = 0; comIsOnlineShow.SelectedIndex = 0; } }
public void UpdatePayType(PayTypeVM _viewInfo, EventHandler <RestClientEventArgs <dynamic> > callback) { string relativeUrl = "/CommonService/PayType/Update"; var msg = _viewInfo.ConvertVM <PayTypeVM, PayType>(); restClient.Update(relativeUrl, msg, callback); }
public void LoadPayType(int?sysNo, EventHandler <RestClientEventArgs <PayTypeVM> > callback) { string relativeUrl = "/CommonService/PayType/Load/" + sysNo; if (sysNo.HasValue) { restClient.Query <PayType>(relativeUrl, (obj, args) => { if (args.FaultsHandle()) { return; } PayTypeVM _viewModel = null; PayType entity = args.Result; if (entity == null) { _viewModel = new PayTypeVM(); } else { _viewModel = entity.Convert <PayType, PayTypeVM>(); } callback(obj, new RestClientEventArgs <PayTypeVM>(_viewModel, restClient.Page)); }); } }
public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); this.QueryVM = new PayTypeVM(); this.gridSearchCondition.DataContext = this.QueryVM; }