Beispiel #1
0
 private void SaleID_Search(object sender, EventArgs e)
 {
     SaleTable.Items.Clear();
     if (_PHPRepo.GetSaleById(SaleID) == null)
     {
         MessageBox.Show("Could not find sale", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         DisplaySales();
     }
     else
     {
         _sale = _PHPRepo.GetSaleById(SaleID);
         AddSaleToTable(_sale);
     }
 }
Beispiel #2
0
 private void SaleID_Search(object sender, EventArgs e)
 {
     enableTextBoxes();
     SaleTable.Items.Clear();
     if (_PHPRepo.GetSaleById(SaleID) == null)
     {
         MessageBox.Show("Could not find sale", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         DisplaySales();
     }
     else
     {
         _sale = _PHPRepo.GetSaleById(SaleID);
         AddSaleToTable(_sale);
         DateBox.Text = _sale.Sale_Date.ToString();
         CostBox.Text = _sale.Total_Cost.ToString();
         NameBox.Text = _sale.Customer_Name;
     }
 }
Beispiel #3
0
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            int id;

            if (int.TryParse(SaleID.Text, out id))
            {
                if (_pHPRepo.GetSaleById(id) != null)
                {
                    sale = _pHPRepo.GetSaleById(id);
                    _pHPRepo.RemoveSales(sale);
                    MessageBox.Show("Sucessful", "Sale has been deleted", MessageBoxButtons.OK, MessageBoxIcon.None);
                    SaleID.Clear();
                }
                else
                {
                    MessageBox.Show("Could not find Sale: " + SaleID.Text);
                }
            }
            else
            {
                MessageBox.Show("Please enter valid ID");
            }
        }