Ejemplo n.º 1
0
        private void Add_button_Click(object sender, EventArgs e)
        {
            ChiTietKhoa f = new ChiTietKhoa(_loginForm);

            this.Close();
            f.Show();
        }
Ejemplo n.º 2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "ChiTiet")
            {
                string      MaKhoa = senderGrid.Rows[e.RowIndex].Cells["MaKhoa"].Value.ToString();
                ChiTietKhoa f      = new ChiTietKhoa(_loginForm, MaKhoa);
                this.Close();
                f.Show();
            }
            else if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                     e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "Xoa")
            {
                try
                {
                    string      MaKhoa = senderGrid.Rows[e.RowIndex].Cells["MaKhoa"].Value.ToString();
                    List <KHOA> khoas  = new List <KHOA>();
                    khoas.Add(new KHOA()
                    {
                        MaKhoa = MaKhoa
                    });
                    BLL.Instance.DelDB(khoas);
                }
                catch (MySQLException myex)
                {
                    if (myex.Number == MySQLException.ExcepEnum.Referenced)
                    {
                        MessageBox.Show("Không thể xóa khoa này", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show("Unknown SQL Error", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                finally
                {
                    Khoa_Load(sender, e);
                }
            }
        }
Ejemplo n.º 3
0
 private void BoMonEditAndAdd_FormClosing(object sender, FormClosingEventArgs e)
 {
     _khoaForm.Show();
     _khoaForm.ReLoadBM();
 }