示例#1
0
文件: MonHoc.cs 项目: ndhuy2711/QLHS
        private void btn_XacNhan_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_mamonhoc.Text != "" && txt_tenmonhoc.Text != "")
                {
                    QLHS_DTO hs = new QLHS_DTO();
                    hs.MaMonHoc  = txt_mamonhoc.Text;
                    hs.TenMonHoc = txt_tenmonhoc.Text;
                    QLHS_BUS bus = new QLHS_BUS();
                    bus.ThemMonHoc(hs);
                    MessageBox.Show("Thêm thành công môn học " + txt_tenmonhoc.Text + " !", "Thông báo");
                    LoadData();
                    btn_themmon.Visible = true;
                    btn_XacNhan.Visible = false;

                    txt_mamonhoc.Enabled       = false;
                    txt_tenmonhoc.Enabled      = false;
                    btn_capnhatmon.Enabled     = true;
                    btn_xoa.Enabled            = true;
                    btn_nhapdiemmonhoc.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Mời nhập đầy đủ thông tin Môn Học!");
                }
            }
            catch
            {
                MessageBox.Show("Mã môn học này đã tồn tại!");
            }
        }