private void Refresh(ResponseBusinessmanInfo merchant) { IsBusy = true; Action action = () => { CommunicateManager.Invoke <ITPosService>(service => { var result = service.GetBusinessmanInfo(merchant.Id); var index = Merchants.IndexOf(merchant); if (index >= 0) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Merchants[index] = result; })); } }, UIManager.ShowErr); }; Task.Factory.StartNew(action).ContinueWith((task) => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
private void ExecuteDeleteCommand(ResponseBusinessmanInfo info) { var result = UIManager.ShowMessageDialog("确认删除商户?"); if (result == null || result.Value == false) { return; } IsBusy = true; Action action = () => { CommunicateManager.Invoke <ITPosService>(service => { service.DeleteBusinessman(info.Id); UIManager.ShowMessage("删除成功"); if (Merchants.Contains(info)) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Merchants.Remove(info); })); } }, UIManager.ShowErr); }; Task.Factory.StartNew(action).ContinueWith((task) => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
private RequestBusinessmanInfo Transfer(ResponseBusinessmanInfo info) { RequestBusinessmanInfo result = new RequestBusinessmanInfo(); result.Id = info.Id; result.Address = info.Address; result.Bank = new RequestBusinessmanInfo.RequestBankInfo() { Address = new RequestBusinessmanInfo.RequestBankAddress() { City = info.City, Province = info.Province, Subbranch = info.Subbranch }, BankName = info.BankName, Cardholder = info.Cardholder, CardNo = info.CardNo, BankId = info.BankId }; result.BusinessmanName = info.BusinessmanName; result.LinkMan = info.LinkMan; result.LinkPhone = info.LinkPhone; result.LinkTel = info.LinkTel; result.PosRate = info.PosRate; return(result); }
private void ExecuteAssignCommand(ResponseBusinessmanInfo merchant) { LocalUIManager.AssignPos(merchant, (result) => { if (result != null && result.Value) { Refresh(merchant); } }); }
private void ExecuteEditCommand(ResponseBusinessmanInfo merchant) { LocalUIManager.EditMerchant(merchant, new Action <bool?>((isOk) => { if (isOk != null && isOk.Value) { Refresh(merchant); } })); }
internal static void ShowMerchantInfo(ResponseBusinessmanInfo merchant) { MerchantInfoWindow window = new MerchantInfoWindow(); window.Owner = Application.Current.MainWindow; MerchantAddEditViewModel vm = new MerchantAddEditViewModel(); vm.LoadInfo(merchant.Id); window.DataContext = vm; var result = window.ShowDialog(); window.DataContext = null; }
/// <summary> /// 修改商户 /// </summary> /// <param name="call">The action.</param> /// <exception cref="System.NotImplementedException"></exception> internal static void EditMerchant(ResponseBusinessmanInfo merchant, Action <bool?> call) { MerchantEditWindow window = new MerchantEditWindow(); window.Owner = Application.Current.MainWindow; MerchantAddEditViewModel vm = new MerchantAddEditViewModel(); vm.LoadInfo(merchant.Id); window.DataContext = vm; var result = window.ShowDialog(); if (call != null) { call(result); } window.DataContext = null; }
/// <summary> /// 给指定商户分配POS机 /// </summary> /// <param name="merchant">The merchant.</param> /// <exception cref="System.NotImplementedException"></exception> internal static void AssignPos(ResponseBusinessmanInfo merchant, Action <bool?> call) { AssignPosWindow window = new AssignPosWindow(); window.Owner = Application.Current.MainWindow; AssignPosViewModel vm = new AssignPosViewModel(); window.DataContext = vm; vm.Merchant = merchant; vm.Initialize(); var result = window.ShowDialog(); if (call != null) { call(result); } window.DataContext = null; }
private bool CanExecuteDeleteCommand(ResponseBusinessmanInfo info) { return(true); }
private bool CanExecuteAssignCommand(ResponseBusinessmanInfo merchant) { return(true); }
private void ExecuteDetailCommand(ResponseBusinessmanInfo merchant) { LocalUIManager.ShowMerchantInfo(merchant); }