Пример #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Search_Student_Details();

            if (Validate_Controls())
            {
                try
                {
                    DialogResult dResult = MessageBox.Show("Are you sure to delete this record?", "Student TC", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dResult == DialogResult.Yes)
                    {
                        _student_TC = new Student_TC();
                        short output = _student_TC.Delete_TC_Details(_student_ID);

                        switch (output)
                        {
                        case 1:
                            MessageBox.Show("Record deleted successfully.", "Student TC", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            break;

                        case -1:
                            MessageBox.Show("Error in deleting record.\n Please contact support team.", "Student TC", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            break;
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Error: Please contact support team.", "Student TC", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                }
                finally
                {
                    Reset_Controls();
                    txtRegistrationNo.Text = string.Empty;
                }
            }
        }