Ejemplo n.º 1
0
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Product.SelectedIndex == -1)
                {
                    MessageBox.Show("Please select product.");
                }

                else if (PromoName.Text == "")
                {
                    MessageBox.Show("Please enter promotion name.");
                }

                else if (Percent.Text == "")
                {
                    MessageBox.Show("Please enter a percentage.");
                }

                else
                {
                    ComboBoxItem        comboBoxItem = Product.SelectedItem as ComboBoxItem;
                    Product             item         = comboBoxItem.Content as Product;
                    PromotionPercentile promo        = new PromotionPercentile(PromoName.Text, Convert.ToInt32(Percent.Text), item);
                    DB.AddPromotion(promo);
                    Content = new Checkout_Menu(DB);
                }
            }

            catch (FormatException exception)
            {
                MessageBox.Show("Please only use intergers for percentage");
            }
        }
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Product.SelectedIndex == -1)
                {
                    MessageBox.Show("Please select product.");
                }

                else if (PromoName.Text == "")
                {
                    MessageBox.Show("Please enter promotion name.");
                }

                else if (BuyAmount.Text == "")
                {
                    MessageBox.Show("Please enter an integer.");
                }

                else if (GetAmount.Text == "")
                {
                    MessageBox.Show("Please enter an integer.");
                }

                else
                {
                    ComboBoxItem comboBoxItem = Product.SelectedItem as ComboBoxItem;
                    Product      item         = comboBoxItem.Content as Product;

                    if (Convert.ToInt32(BuyAmount.Text) < Convert.ToInt32(GetAmount.Text))
                    {
                        MessageBox.Show("Buy amount can not be lower than the Get amount.");
                    }

                    else
                    {
                        PromotionBGF promo = new PromotionBGF(PromoName.Text, Convert.ToInt32(BuyAmount.Text), Convert.ToInt32(GetAmount.Text), item);
                        DB.AddPromotion(promo);
                        Product.Items.Clear();
                        Content = new Checkout_Menu(DB);
                    }
                }
            }

            catch (FormatException exception)
            {
                MessageBox.Show("Please only use intergers for percentage");
            }
        }
Ejemplo n.º 3
0
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Product.SelectedIndex == -1)
                {
                    MessageBox.Show("Please select product.");
                }

                else if (PromoName.Text == "")
                {
                    MessageBox.Show("Please enter promotion name.");
                }

                else if (Money.Text == "")
                {
                    MessageBox.Show("Please enter an amount.");
                }

                else
                {
                    ComboBoxItem comboBoxItem = Product.SelectedItem as ComboBoxItem;
                    Product      item         = comboBoxItem.Content as Product;

                    if (decimal.Parse(Money.Text) >= item.GetProdPrice())
                    {
                        MessageBox.Show("Amount can not equal or be more than the products price.");
                    }

                    else
                    {
                        PromotionSave promo = new PromotionSave(PromoName.Text, Decimal.Parse(Money.Text), item);
                        DB.AddPromotion(promo);
                        Content = new Checkout_Menu(DB);
                    }
                }
            }

            catch (FormatException exception)
            {
                MessageBox.Show("Please only use intergers for percentage");
            }
        }
Ejemplo n.º 4
0
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     Content = new Checkout_Menu(DB);
 }
 private void Confirm_Click(object sender, RoutedEventArgs e)
 {
     Content = new Checkout_Menu(DB);
 }