Esempio n. 1
0
 private void b_add_Click(object sender, EventArgs e)
 {
     if (bang.Equals("Khoahoc"))
     {
         KhoahocGUI khoahocGUI = new KhoahocGUI(this);
         khoahocGUI.Show();
     }
     else if (bang.Equals("Sinhvien"))
     {
         SinhvienGUI sinhvienGUI = new SinhvienGUI(this);
         sinhvienGUI.Show();
     }
 }
Esempio n. 2
0
        private void b_edit_Click(object sender, EventArgs e)
        {
            if (dgv_main.SelectedCells.Count > 0)
            {
                int selectedrowindex = dgv_main.SelectedCells[0].RowIndex;

                DataGridViewRow selectedRow = dgv_main.Rows[selectedrowindex];

                a = Convert.ToString(selectedRow.Cells["id"].Value);
                if (bang.Equals("Khoahoc"))
                {
                    foreach (Khoahoc kh in sql.SearchKhoahoc(tb_search.Text))
                    {
                        if (kh.id == int.Parse(a))
                        {
                            KhoahocGUI khoahocGUI = new KhoahocGUI(this, kh);
                            khoahocGUI.Show();
                        }
                    }
                }
                else if (bang.Equals("Sinhvien"))
                {
                    foreach (Sinhvien sv in sql.SearchSinhvien(tb_search.Text))
                    {
                        if (sv.id == int.Parse(a))
                        {
                            SinhvienGUI sinhvienGUI = new SinhvienGUI(this, sv);
                            sinhvienGUI.Show();
                        }
                    }
                }
                else if (bang.Equals("Diem"))
                {
                    foreach (Diem diem in sql.SearchDiem(""))
                    {
                        if (diem.id == int.Parse(a))
                        {
                            DiemGUI diemGUI = new DiemGUI(this, diem);
                            diemGUI.Show();
                        }
                    }
                }
            }
        }