예제 #1
0
        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);
            });
        }
예제 #2
0
        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);
            });
        }
예제 #3
0
        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);
        }
예제 #4
0
 private void ExecuteAssignCommand(ResponseBusinessmanInfo merchant)
 {
     LocalUIManager.AssignPos(merchant, (result) =>
     {
         if (result != null && result.Value)
         {
             Refresh(merchant);
         }
     });
 }
예제 #5
0
 private void ExecuteEditCommand(ResponseBusinessmanInfo merchant)
 {
     LocalUIManager.EditMerchant(merchant, new Action <bool?>((isOk) =>
     {
         if (isOk != null && isOk.Value)
         {
             Refresh(merchant);
         }
     }));
 }
예제 #6
0
        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;
        }
예제 #7
0
        /// <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;
        }
예제 #8
0
        /// <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;
        }
예제 #9
0
 private bool CanExecuteDeleteCommand(ResponseBusinessmanInfo info)
 {
     return(true);
 }
예제 #10
0
 private bool CanExecuteAssignCommand(ResponseBusinessmanInfo merchant)
 {
     return(true);
 }
예제 #11
0
 private void ExecuteDetailCommand(ResponseBusinessmanInfo merchant)
 {
     LocalUIManager.ShowMerchantInfo(merchant);
 }