private void VES_But_Update_Click(object sender, EventArgs e) { BalanseConn VESConn = new BalanseConn(); DialogResult result1; result1 = MessageBox.Show("This will update the sales record. All PO payments will be removed. Do you want to continue?", "Update Sales Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { if (!IsEmpty(VES_TB_Total.Text)) { if (VES_TB_Total.Text == VES_TB_RunTotal.Text) { VESConn.DropSales(srowid); AddSalesTransaction(); foreach (DataGridViewRow row in VES_DGV_PO.Rows) { int invoice_no = Convert.ToInt32(row.Cells[2].Value.ToString()); if (CheckPayment(invoice_no) == true) { VESConn.DropPayment(invoice_no); } } MessageBox.Show("Record updated."); this.Close(); } if (VES_TB_Total.Text != VES_TB_RunTotal.Text) { DialogResult result2; result2 = MessageBox.Show("Running Total is not equal to Total Sales. Do you still want to add the report?", "Add Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result2 == DialogResult.Yes) { VESConn.DropSales(srowid); AddSalesTransaction(); foreach (DataGridViewRow row in VES_DGV_PO.Rows) { int invoice_no = Convert.ToInt32(row.Cells[2].Value.ToString()); if (CheckPayment(invoice_no) == true) { VESConn.DropPayment(invoice_no); } } MessageBox.Show("Record updated."); this.Close(); } } } } if (result1 == DialogResult.No) { Close(); } }
private void VES_But_Delete_Click(object sender, EventArgs e) { BalanseConn VESConn = new BalanseConn(); DialogResult result1; result1 = MessageBox.Show("This will delete the sales record. Do you want to continue?", "Delete Sales Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { VESConn.DropSales(srowid); foreach (DataGridViewRow row in VES_DGV_PO.Rows) { int invoice_no = Convert.ToInt32(row.Cells[2].Value.ToString()); if (CheckPayment(invoice_no) == true) { VESConn.DropPayment(invoice_no); } } MessageBox.Show("Record deleted"); this.Close(); } if (result1 == DialogResult.No) { Close(); } }
private void VEE_But_Delete_Click(object sender, EventArgs e) { BalanseConn VESConn = new BalanseConn(); DialogResult result1; result1 = MessageBox.Show("This will delete the expenses record. Do you want to continue?", "Delete Expenses Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { VESConn.DropSales(erowid); } MessageBox.Show("Record deleted"); this.Close(); if (result1 == DialogResult.No) { Close(); } }