Beispiel #1
0
 private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int id = Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells["Id"].Value);
         if (dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().ToLower() == "delete")
         {
             if (MessageBox.Show(" Are you sure? ", "Delete", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 /*string p = "delete from student where id="+id;
                  * Database db = new Database(p);
                  * db.ExecuteNonQuery();*/
                 StudentService ss = new StudentService();
                 Student        s  = new Student();
                 s.Id = id;
                 ss.Delete(s);
             }
         }
         else
         {
             New_Student ns = new New_Student(id);
             ns.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        private void NewStudentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            New_Student ns = new New_Student(0);

            ns.Show();
        }