Ejemplo n.º 1
0
        private void deleteTransactionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult f = MessageBox.Show("Are you sure to continue?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

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

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

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

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

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


            try
            {
                using (DataTable dt = objDatabase.DeleteArea(Area_ID))
                {
                    if (dt.Rows[0][0].ToString() == "-1")
                    {
                        MessageBox.Show("Area is being used Customer Information. Cannot be deleted.", "Caution", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (dt.Rows[0][0].ToString() != "")
                    {
                        MessageBox.Show("Record updated successfully!");
                        InitializeForm(true);
                    }
                    else
                    {
                        MessageBox.Show("Error in updating Record, please contact System Administrator!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in updating Record, please contact System Administrator!\n" + ex.Message.ToString());
            }
        }