예제 #1
0
        private void deleteCustomerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult f = MessageBox.Show("Are you sure to delete this entry?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (f == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                f = MessageBox.Show("Are you sure to delete this entry?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (f == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                BusinessRules objDatabase = new BusinessRules();
                DataSet       ds          = objDatabase.DeleteTicket(customerID, old_Bus_Master_ID, User.Instance.User_Name);
                //if (System.IO.File.Exists(imagesFolder + customerID.ToString() + ".jpg"))
                //{
                //    System.IO.File.Delete(imagesFolder + customerID.ToString() + ".jpg");
                //}
                if (ds.Tables[0].Rows[0][0].ToString() != "")
                {
                    SearchCustomers();
                    MessageBox.Show("Record deleted successfully!");
                }
                else
                {
                    MessageBox.Show("Error in deleting Record, please contact System Administrator!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in updating Record, please contact System Administrator!\n" + ex.Message.ToString());
            }
        }