示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do You really want to delete this Sales Record?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                int refsales = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Delete_Sales(refsales))
                {
                    MessageBox.Show("Sales Record ID" + refsales + " is successfully Deleted", "Sales Deleted");
                }
                else
                {
                    MessageBox.Show("Sales Record ID " + refsales + " is not deleted.", "Try Again");
                }
            }
            admin.Refresh_Database();
            if (permission != 2)
            {
                gridAll.DataSource = admin.All_Sales();
            }
            else
            {
                gridAll.DataSource = admin.Search_Sales_Belong_To_RefAgent(RefAgent);
            }
            ButtonControl(true, true, false, false, true, false);
        }