private void InsertAdvisor_Click_1(object sender, EventArgs e)
        {
            string     firstName  = "";
            string     lastName   = "";
            string     contact    = "";
            string     email      = "";
            DateTime   dob        = DateTime.Now;
            string     gender     = "";
            AddAdvisor addStudent = new AddAdvisor(firstName, lastName, "", contact, email, 0, dob, gender, "add");

            this.Hide();
            addStudent.Show();
        }
        private void Advisors_CellClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == Advisors.NewRowIndex || e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == Advisors.Columns["AdvisorDeleteButton"].Index)
            {
                int    i         = e.RowIndex;
                String email     = Advisors.Rows[i].Cells[3].Value.ToString();
                string fullName  = Advisors.Rows[i].Cells[0].Value.ToString();
                var    names     = fullName.Split(' ');
                string firstName = names[0];
                string lastName  = names[1];


                string       dialog       = string.Format("Delete Advsior '{0}' and all its information?", fullName);
                DialogResult dialogResult = MessageBox.Show(dialog, "Delete Advsior", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    SqlConnection connection = new SqlConnection(connString);
                    connection.Open();

                    string getid = string.Format("SELECT Id FROM Person WHERE FirstName = '{0}' AND LastName = '{1}'" +
                                                 "AND Email = '{2}'", firstName, lastName, email);
                    SqlCommand cmd = new SqlCommand(getid, connection);
                    int        id  = (Int32)cmd.ExecuteScalar();

                    cmd.CommandText = string.Format("DELETE FROM ProjectAdvisor WHERE AdvisorId = '{0}'", id);
                    cmd.ExecuteNonQuery();

                    cmd.CommandText = String.Format("DELETE FROM Advisor WHERE Id = '{0}'", id);
                    cmd.ExecuteNonQuery();

                    cmd.CommandText = string.Format("DELETE FROM Person WHERE Id = '{0}'", id);
                    cmd.ExecuteNonQuery();
                    Advisors.Rows.RemoveAt(i);
                    MessageBox.Show("Advsior Deleted successfully!");
                    connection.Close();
                }
                else if (dialogResult == DialogResult.No)
                {
                    MessageBox.Show("Advisor not deleted!");
                }
            }
            if (e.ColumnIndex == Advisors.Columns["AdvisorEditButton"].Index)
            {
                int        i           = e.RowIndex;
                string     fullName    = Advisors.Rows[i].Cells[0].Value.ToString();
                var        names       = fullName.Split(' ');
                string     firstName   = names[0];
                string     lastName    = names[1];
                string     Designation = Advisors.Rows[i].Cells[1].Value.ToString();
                string     contact     = Advisors.Rows[i].Cells[2].Value.ToString();
                string     email       = Advisors.Rows[i].Cells[3].Value.ToString();
                Decimal    salary      = Convert.ToDecimal(Advisors.Rows[i].Cells[4].Value);
                string     DOB1        = Advisors.Rows[i].Cells[5].Value.ToString();
                DateTime   dob         = Convert.ToDateTime(DOB1);
                string     gender      = Advisors.Rows[i].Cells[6].Value.ToString();
                AddAdvisor form        = new AddAdvisor(firstName, lastName, Designation, contact, email, salary, dob, gender, "edit");
                form.Show();
                this.Hide();
            }
        }