private void dgvStudents_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex == 9) //Edit
            {
                int did = (int)dgvStudents.CurrentRow.Cells[0].Value;

                frmNewStudent degObj = new frmNewStudent(did);
                degObj.Show();

            }
            else if (e.RowIndex >= 0 && e.ColumnIndex == 10) //Delete
            {
                var result = MessageBox.Show("Are you sure", "?",  MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    int did = (int)dgvStudents.CurrentRow.Cells[0].Value;
                    Boolean flag = DAL.StudentsDAL.DeleteStudent(did);
                    if (flag == true)
                    {
                        LoadStudents();
                        MessageBox.Show("Record has been deleted");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void dgvStudents_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex == 9) //Edit
            {
                int did = (int)dgvStudents.CurrentRow.Cells[0].Value;

                frmNewStudent degObj = new frmNewStudent(did);
                degObj.Show();
            }
            else if (e.RowIndex >= 0 && e.ColumnIndex == 10) //Delete
            {
                var result = MessageBox.Show("Are you sure", "?", MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    int     did  = (int)dgvStudents.CurrentRow.Cells[0].Value;
                    Boolean flag = DAL.StudentsDAL.DeleteStudent(did);
                    if (flag == true)
                    {
                        LoadStudents();
                        MessageBox.Show("Record has been deleted");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void newStudentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmNewStudent newStd = new frmNewStudent();

            newStd.ShowDialog();
        }
Ejemplo n.º 4
0
 private void newStudentToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmNewStudent newStd = new frmNewStudent();
     newStd.ShowDialog();
 }