Example #1
0
        private void Add_button_Click(object sender, EventArgs e)
        {
            DetailInformationOfDeTaiNCKH f = new DetailInformationOfDeTaiNCKH(_loginForm);

            f.Show();
            this.Close();
        }
Example #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")
            {
                int MaDT = int.Parse(senderGrid.Rows[e.RowIndex].Cells["MaDT"].Value.ToString());
                DetailInformationOfDeTaiNCKH f = new DetailInformationOfDeTaiNCKH(_loginForm, MaDT);
                this.Close();
                f.Show();
            }
            else if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                     e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "Xoa")
            {
                try
                {
                    int MaDT = int.Parse(senderGrid.Rows[e.RowIndex].Cells["MaDT"].Value.ToString());
                    List <DE_TAI_NCKH> dts = new List <DE_TAI_NCKH>();
                    dts.Add(new DE_TAI_NCKH()
                    {
                        MaDeTai = MaDT
                    });
                    BLL.Instance.DelDB(dts);
                }
                catch (MySQLException myex)
                {
                    if (myex.Number == MySQLException.ExcepEnum.Referenced)
                    {
                        MessageBox.Show("Không thể xóa đề tài này", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show("Unknown SQL Error", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                finally
                {
                    LoadDTNCKH(BLL.Instance.GetAllDTNCKH());
                }
            }
        }