Beispiel #1
0
        private void YesOnClickCont()
        {
            if (Amount == "" || Amount == null)
            {
                return;
            }

            decimal amount = 0;
            bool    result = decimal.TryParse(Amount, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo, out amount);

            if (!result)
            {
                ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_NONDECIMAL_VALUE_ERROR_BODY).ToString(), null, false, 5);
                return;
            }

            string          type    = ChangeTracker.PaymentFlowOperationType;
            PaymentFlowData request = new PaymentFlowData();

            if (type == "credit")
            {
                request.type = "CREDIT";
            }
            else
            {
                request.type = "PAYMENT";
            }

            //decimal tempAmount = 0;
            //Decimal.TryParse(Amount, NumberStyles.AllowDecimalPoint, NumberFormatInfo.InvariantInfo, out tempAmount);

            request.amount        = amount;
            request.comment       = Comment;
            request.stationNumber = StationRepository.StationNumber;

            if (ChangeTracker.CurrentUser is OperatorUser)
            {
                request.operatorName = ((OperatorUser)ChangeTracker.CurrentUser).Username;
            }
            else
            {
                request.operatorName = "";
            }

            try
            {
                WsdlRepository.AddPaymentFlow(request);

                bool isPrinted = PrinterHandler.PrintShopPaymentReciept(ChangeTracker.PaymentFlowOperationType, amount, ChangeTracker.CurrentUser.AccountId, ChangeTracker.CurrentUser.Username);
                if (!isPrinted)
                {
                    ShowPrinterErrorMessage();
                }
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }

            MyRegionManager.NavigatBack(RegionNames.UsermanagementContentRegion);
        }
 public bool AddPaymentFlow(PaymentFlowData request)
 {
     throw new NotImplementedException();
 }
Beispiel #3
0
        public void OpenShopPaymentsViewModelNavigateBackTest()
        {
            DataBinding          = MockRepository.GenerateStub <IDataBinding>();
            AuthorizationService = MockRepository.GenerateStub <IAuthorizationService>();
            StationRepository    = MockRepository.GenerateStub <IStationRepository>();
            LanguageRepository   = MockRepository.GenerateStub <ILanguageRepository>();
            LineProvider         = MockRepository.GenerateStub <ILineProvider>();
            BusinessPropsHelper  = MockRepository.GenerateStub <IBusinessPropsHelper>();
            IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope();
            IoCContainer.Kernel.Bind <IAuthorizationService>().ToConstant <IAuthorizationService>(AuthorizationService).InSingletonScope();
            IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(StationRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILanguageRepository>().ToConstant <ILanguageRepository>(LanguageRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILineProvider>().ToConstant <ILineProvider>(LineProvider).InSingletonScope();
            IoCContainer.Kernel.Bind <IBusinessPropsHelper>().ToConstant <IBusinessPropsHelper>(BusinessPropsHelper).InSingletonScope();



            StationRepository.TurnOffCashInInit = true;
            StationRepository.Expect(x => x.IsReady).Return(true);
            StationRepository.Expect(x => x.StationNumber).Return("0024");
            StationRepository.Expect(x => x.SyncInterval).Return(20000);
            StationRepository.Expect(x => x.HubSettings).Return(new Dictionary <string, string>());



            Dispatcher.Invoke(() =>
            {
                Window = MyRegionManager.FindWindowByViewModel <MainViewModel>();
                Window.Show();
            });

            ChangeTracker.CurrentUser = new OperatorUser("111")
            {
                Permissions = new string[] { "read_shop_payments", "write_shop_payments" }
            };

            var userManagementViewModel = MyRegionManager.NavigateUsingViewModel <UserManagementViewModel>(RegionNames.ContentRegion);

            decimal paymentBalance       = 0;
            decimal locationCashPosition = 0;
            decimal totalLocationBalance = 0;

            PaymentFlowData[] list = new PaymentFlowData[3] {
                new PaymentFlowData(), new PaymentFlowData(), new PaymentFlowData(),
            };
            long total = 0;

            WsdlRepository.Expect(x => x.GetStationPaymentFlowData("0024", 0, 20, out paymentBalance, out locationCashPosition, out totalLocationBalance, out list, out total)).Return(10).OutRef(locationCashPosition, totalLocationBalance, paymentBalance, list, total).IgnoreArguments();

            Dispatcher.Invoke(() =>
            {
                userManagementViewModel.ShopPaymentsCommand.Execute(null);
            });
            Thread.Sleep(1000);
            var shopPayments = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as ShopPaymentsViewModel;

            while (shopPayments.Payments.Count < 3)
            {
                shopPayments = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as ShopPaymentsViewModel;
                Thread.Sleep(100);
            }
            for (int i = 0; i < 5; i++)
            {
                shopPayments = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as ShopPaymentsViewModel;

                while (!shopPayments.IsReady)
                {
                    Thread.Sleep(1);
                }

                Dispatcher.Invoke(() =>
                {
                    shopPayments.onAddPaymentClicked.Execute("");
                });

                var addcreditModel = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as AddCreditPaymentViewModel;
                while (!addcreditModel.IsReady)
                {
                    Thread.Sleep(1);
                }
                Dispatcher.Invoke(() =>
                                  { addcreditModel.CloseCommand.Execute(""); });
            }


            shopPayments = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as ShopPaymentsViewModel;
            while (shopPayments.Payments.Count < 3)
            {
                shopPayments = MyRegionManager.CurrentViewModelInRegion(RegionNames.UsermanagementContentRegion) as ShopPaymentsViewModel;
                Thread.Sleep(100);
            }



            Dispatcher.Invoke(() =>
            {
                Window.Close();
            });
        }