Exemplo n.º 1
0
        public void Checkout()
        {
            var processvm = IoC.Get <ProcessViewModel>();

            processvm.Content = "Processing...";

            processvm.ProcessAction = () =>
            {
                var invoice = new Invoice
                {
                    DateTime   = DateTimeOffset.Now,
                    CustomerId = Customer.Id
                };

                var invoiceItems = new List <InvoiceItem>(Products
                                                          .Where(o => o.Quantity > 0)
                                                          .Select((o, i) => new InvoiceItem
                {
                    ItemNumber = i + 1,
                    ProductId  = o.Product.Id,
                    Quantity   = o.Quantity,
                    Price      = o.Product.Price,
                    Discount   = o.Discount
                }));

                InvoiceService.AddInvoice(invoice, invoiceItems, IsCashAccount ? Total : 0.0m);

                Customer.Balance = CustomerService.GetCustomer(Customer.Id).Balance;
            };

            processvm.CompleteAction = () =>
            {
                var message = IoC.Get <MessageBoxViewModel>();
                message.Content = new CustomerTransactionInfo {
                    Customer = Customer, NewBalance = Customer.Balance
                };
                message.DismissAction  = () => ScreenCoordinator.NavigateToHome();
                message.DismissTimeout = 2500;

                ScreenCoordinator.NavigateToScreen(message);
            };

            ScreenCoordinator.NavigateToScreen(processvm);
        }
Exemplo n.º 2
0
 public void SelectItem(HomeOption item)
 {
     if (item.Option == HomeOption.OptionEnum.Account)
     {
         ScreenCoordinator.NavigateToScreen(IoC.Get <AccountsViewModel>(), true);
     }
     else if (item.Option == HomeOption.OptionEnum.Cash)
     {
         ScreenCoordinator.NavigateToCashHome(CashCustomer);
     }
 }
Exemplo n.º 3
0
 public void GoHome()
 {
     if (IsCashAccount || CardSession)
     {
         ScreenCoordinator.NavigateToHome();
     }
     else
     {
         ScreenCoordinator.NavigateToScreen(IoC.Get <AccountsViewModel>(), true);
     }
 }
Exemplo n.º 4
0
        public void CompleteLoan()
        {
            var processvm = IoC.Get <ProcessViewModel>();

            processvm.Content = "Processing...";

            processvm.ProcessAction = () =>
            {
                var transaction = new CustomerTransaction
                {
                    Id         = Guid.NewGuid(),
                    CustomerId = Customer.Id,
                    DateTime   = DateTimeOffset.Now,
                    Type       = CustomerTransactionType.Loan,
                    Amount     = Total
                };

                CustomerService.AddTransaction(transaction);

                Customer.Balance = CustomerService.GetCustomer(Customer.Id).Balance;
            };

            processvm.CompleteAction = () =>
            {
                var message = IoC.Get <MessageBoxViewModel>();
                message.Content = new CustomerTransactionInfo {
                    Customer = Customer, NewBalance = Customer.Balance
                };
                message.DismissAction  = () => ScreenCoordinator.NavigateToHome();
                message.DismissTimeout = 2500;

                ScreenCoordinator.NavigateToScreen(message);
            };

            ScreenCoordinator.NavigateToScreen(processvm);
        }