private void btnDelete_Click(object sender, EventArgs e) { //DELETE CODE MOT WORKING FINE if (DateSelect == true) { if (MessageBox.Show("All records will be Deleted for Selected Date\nContinue ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { ItemSales.DeleteSale(dateTimeFrom); dataAccess.Description = "Deleted all credit Sales record for " + dateTimeFrom.Value.ToString("MM/dd/yyyy"); dataAccess.Activities(); CreditSales.AllCreditSales(dataGridCreditSalesRecord, ""); DateSelect = false; } } else { if (MessageBox.Show("Confirm Delete of Selected Record", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { //CARRY OUT DELETE if (SalesID <= 0) { throw new Exception("Select a record to Delete"); } else { ItemSales.DeleteSale(SalesID); dataAccess.Description = "Deleted a Credit Sales record"; dataAccess.Activities(); CreditSales.AllCreditSales(dataGridCreditSalesRecord, ""); SalesID = 0; } } } }
public Credit_Sales_Record() { InitializeComponent(); CreditSales.AllCreditSales(dataGridCreditSalesRecord, txtItemSearch.Text); lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal); ItemSales.ItemNames(combItemName); }
private void txtItemSearch_TextChanged(object sender, EventArgs e) { try { CreditSales.AllCreditSales(dataGridCreditSalesRecord, txtItemSearch.Text); lblTotal.Text = string.Format("{0:00.#0}", ItemSales.TodayTotal); } catch (Exception ex) { MessageBox.Show(ex.Message, "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }