Esempio n. 1
0
        public void OnConfirmClickCommand()
        {
            var body = new Common.ErpBill {
                Total = TotalPrice, Products = BasketItems.Select(x => x.MiGuid).ToList(), User = LoginPageViewModel.User
            };

            Task <bool> task = Task.Run <bool>(async() => await Common.WebApiServerModule.WebApiCmd.Put("http://localhost:1234", "ERP", body));

            if (!task.Result)
            {
                App.Log.Info("Confirmation failed because the ERP system didn't responded");
                return;
            }
            App.Log.Info("Confirmation succeded");
            LoginPageViewModel.User = null;
            navigationService.Navigate(nameof(Views.Pages.LoginPage));
        }
Esempio n. 2
0
        public decimal TotalPrice()
        {
            var PriceBeforeDiscount = BasketItems.Select(i => i.UnitPrice).First() * BasketItems.Count();
            var DiscountedPrice     = PriceBeforeDiscount;

            if (HarryPotterBookCount() > 0)
            {
                return(DiscountedPrice =
                           ((BasketItems.Count() - HarryPotterBookCount())
                            * BasketItems.Select(i => i.UnitPrice).First())
                           + ((BasketItems.Select(i => i.UnitPrice).First()
                               * HarryPotterBookCount()) - ((BasketItems.Select(i => i.UnitPrice).First()
                                                             * HarryPotterBookCount())
                                                            * (Discount / 100))));
            }

            return(DiscountedPrice);
        }
Esempio n. 3
0
        public decimal BasketTotal()
        {
            decimal?total = BasketItems.Select(i => (int)i.Quantity * i.Product.Price).Sum();

            return(total ?? decimal.Zero);
        }