예제 #1
0
        private void loadDiscounts()
        {
            cmboxDiscounts.Items.Clear();
            String[] discountList = ServiceDiscount.getallDiscountNames();

            for (int i = 0; i < discountList.Length; i++)
            {
                cmboxDiscounts.Items.Add(discountList[i]);
                System.Diagnostics.Debug.WriteLine("Discount??? " + discountList[i]);
            }
        }
예제 #2
0
 public DiscountsWindow()
 {
     InitializeComponent();
     UniversalFunctions.setUpWindow(this);
     String[] products = ServiceProducts.getAllProductsName();
     loadDiscounts();
     for (int i = 0; i < products.Length; i++)
     {
         cmboxProduct.Items.Add(products[i]);
         System.Diagnostics.Debug.WriteLine("suppliers??? " + products[i]);
     }
     DataDiscountHistory.DataContext = ServiceDiscount.getAllDiscountHistoryToDisplay().DefaultView;
 }
예제 #3
0
        private void btnDiscountPage_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("Adding a Discount");
            Boolean isSuccessful = ServiceDiscount.createDiscount(txtDiscountName.Text, int.Parse(tbxDiscount.Text));

            if (isSuccessful)
            {
                Console.WriteLine("Added Discount");
                txtDiscountName.Text = "";
                tbxDiscount.Text     = "";
                discount             = 0;
                loadDiscounts();
            }
            else
            {
                Console.WriteLine("FAIL");
            }
        }
예제 #4
0
        private void btnDiscountProdcut_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("Selected product" + cmboxProduct.SelectedItem.ToString());
            Boolean isSuccessful = ServiceDiscount.discountProduct(cmboxProduct.SelectedItem.ToString(), cmboxDiscounts.SelectedItem.ToString(), txtStartDate.Text, txtEndDate.Text);

            if (isSuccessful)
            {
                Console.WriteLine("Added Discount to product");
                txtEndDate.Text                 = "";
                txtStartDate.Text               = "";
                cmboxProduct.Text               = "";
                cmboxDiscounts.Text             = "";
                DataDiscountHistory.DataContext = ServiceDiscount.getAllDiscountHistoryToDisplay().DefaultView;
            }
            else
            {
                Console.WriteLine("FAIL");
            }
        }