Exemple #1
0
 public ShoppingCartVM(ShopperHomeVM parent, Account acct)
 {
     Parent           = parent;
     LoggedInUser     = acct;
     AccountList      = PostgreSQL.getAllAccounts();
     AnimalCollection = PostgreSQL.getAllPets();
 }
        public ShopperHome(Account acct)
        {
            InitializeComponent();
            this.LoggedInShopper  = acct;
            WelcomeMessage.Header = $"Welcome to the Pet Shop, {acct.FirstName}!";
            ShopperHomeVM shopperHomeVM = new ShopperHomeVM(LoggedInShopper);

            DataContext = shopperHomeVM;
        }
Exemple #3
0
        public ShopperHome(ref User shopper)
        {
            InitializeComponent();
            PetView = MainPetDisplay.Content as ListView;
            ShopperHomeVM shopperWindow = new ShopperHomeVM(ref PetView, ref shopper);

            DataContext          = shopperWindow;
            Shopper              = shopper;
            ShopperLabel.Header  = $"Logged in as: {Shopper.Username}";
            WelcomeLabel.Content = $"Welcome to the Freshwater Snail Emporium, {Shopper.FirstName}!";
        }
Exemple #4
0
        public PlaceOrderVM(ShopperHomeVM parent, Account acct)
        {
            this.Parent          = parent;
            this.LoggedInShopper = acct;

            AnimalCollection = PostgreSQL.getAllPets();
            AccountList      = PostgreSQL.getAllAccounts();

            // Receipt Text
            string header = $"Receipt For {LoggedInShopper.FirstName} {LoggedInShopper.LastName}\n";

            this.ReceiptText = header;
            UpdateQuantities();
        }
        public PlaceOrder(ShopperHomeVM parent)
        {
            InitializeComponent();
            WindowParent = parent;
            Shopper      = parent.Shopper;
            CartPets     = parent.CartContents;
            PetList      = parent.PetView.ItemsSource.Cast <Pet>().ToList();

            BillingName.Content    = $"{Shopper.FirstName} {Shopper.LastName}";
            BillStreetAddr.Content = Shopper.Address;
            BillCityInfo.Content   = $"{Shopper.City}, {Shopper.State} {Shopper.Zip}";

            ShippingName.Content   = $"{Shopper.FirstName} {Shopper.LastName}";
            ShipStreetAddr.Content = Shopper.Address;
            ShipCityInfo.Content   = $"{Shopper.City}, {Shopper.State} {Shopper.Zip}";

            double subtotal = 0;

            foreach (Pet pet in CartPets)
            {
                subtotal += pet.purchasedAmt * pet.Price;

                Label qty = new Label();
                qty.Content             = pet.purchasedAmt;
                qty.HorizontalAlignment = HorizontalAlignment.Right;
                QtyStack.Children.Add(qty);

                Label name = new Label();
                name.Content = pet.Name;
                NameStack.Children.Add(name);

                Label price = new Label();
                price.Content             = pet.Price;
                price.HorizontalAlignment = HorizontalAlignment.Right;
                PriceStack.Children.Add(price);

                Label total = new Label();
                total.Content             = pet.total;
                total.HorizontalAlignment = HorizontalAlignment.Right;
                TotalStack.Children.Add(total);
            }

            double tax         = subtotal * 0.07;
            double order_total = subtotal + tax;

            SubLabel.Content   = string.Format("{0:N2}", subtotal);
            TaxLabel.Content   = string.Format("{0:N2}", tax);
            TotalLabel.Content = "$" + string.Format("{0:N2}", order_total);
        }
Exemple #6
0
 public ReviewOrderVM(ShopperHomeVM parent)
 {
     Parent = parent;
 }