Exemple #1
0
 void LoadData()
 {
     try
     {
         dgvKhoa.DataSource = dbKhoa.LayKhoa();
         // Thay đổi độ rộng cột
         dgvKhoa.AllowUserToAddRows = false;
         // Xóa trống các đối tượng trong Panel
         txtMaKhoa.ResetText();
         txtTenKhoa.ResetText();
         // Không cho thao tác trên các nút Lưu / Hủy
         this.btnSave.Enabled   = false;
         this.btnCancel.Enabled = false;
         this.groupBox1.Enabled = false;
         this.groupBox3.Enabled = true;
         // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát
         this.btnAdd.Enabled  = true;
         this.btnEdit.Enabled = true;
         this.btnDel.Enabled  = true;
     }
     catch
     {
         MessageBox.Show("Không lấy được nội dung trong table Khoa. Lỗi rồi!!!");
     }
 }
Exemple #2
0
        void LoadData()
        {
            try
            {
                dgvMon.DataSource = dbMon.LayMon();
                dgvMon.Columns["Khoa"].Visible = false;
                // Thay đổi độ rộng cột
                dgvMon.AllowUserToAddRows = false;
                cboKhoa.DataSource        = dbKhoa.LayKhoa();
                cboKhoa.ValueMember       = "maKhoa";
                cboKhoa.DisplayMember     = "maKhoa";

                // Xóa trống các đối tượng trong Panel
                txtMaMon.ResetText();
                txtTenMon.ResetText();
                txtSTC.ResetText();
                txtHocKy.ResetText();
                // Không cho thao tác trên các nút Lưu / Hủy
                this.btnSave.Enabled   = false;
                this.btnCancel.Enabled = false;
                this.groupBox1.Enabled = false;
                this.groupBox3.Enabled = true;
                // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát
                this.btnAdd.Enabled  = true;
                this.btnEdit.Enabled = true;
                this.btnDel.Enabled  = true;
            }
            catch
            {
                MessageBox.Show("Không lấy được nội dung trong table Lop. Lỗi rồi!!!");
            }
        }
        public void LoadData()
        {
            try
            {
                dtKhoa = new DataTable();
                dtKhoa.Clear();
                DataSet ds = dbKhoa.LayKhoa();
                dtKhoa             = ds.Tables[0];
                dgvKhoa.DataSource = dtKhoa;
                dgvKhoa.AutoResizeColumns();
                this.txtMaKhoa.ResetText();
                this.txtTenKhoa.ResetText();

                this.btnLuu.Enabled     = false;
                this.btnHuyBo.Enabled   = false;
                this.grbLuaChon.Enabled = false;

                this.btnThem.Enabled = true;
                this.btnSua.Enabled  = true;
                this.btnXoa.Enabled  = true;

                this.btnLuu.BackgroundImage   = image_save_off;
                this.btnHuyBo.BackgroundImage = image_cancel_off;

                this.btnThem.BackgroundImage = image_add;
                this.btnSua.BackgroundImage  = image_update;
                this.btnXoa.BackgroundImage  = image_delete;

                this.lblLuu.ForeColor   = Color.Gray;
                this.lblHuyBo.ForeColor = Color.Gray;

                this.lblThem.ForeColor = Color.SteelBlue;
                this.lblSua.ForeColor  = Color.SteelBlue;
                this.lblXoa.ForeColor  = Color.SteelBlue;

                dgvKhoa_CellClick(null, null);
            }
            catch (SqlException)
            {
                MessageBox.Show("Không lấy được nội dung trong table KHOA. Lỗi rồi!!!" + err);
            }
        }
Exemple #4
0
        void LoadData()
        {
            try
            {
                dgvDSSV.DataSource = dbSV.LaySinhVien();
                // Thay đổi độ rộng cột
                dgvDSSV.AllowUserToAddRows     = false;
                dgvDSSV.Columns["Lop"].Visible = false;
                // Xóa trống các đối tượng trong Panel
                txtMaSV.ResetText();
                txtHoTen.ResetText();
                dtpNS.ResetText();
                txtDiaChi.ResetText();
                cboKhoahoc.DataSource    = dbKhoa.LayKhoa();
                cboKhoahoc.ValueMember   = "maKhoa";
                cboKhoahoc.DisplayMember = "maKhoa";
                LoadComboLop(cboKhoahoc.Text);

                cboMalop.DataSource    = dbLop.LayLop();
                cboMalop.ValueMember   = "maLop";
                cboMalop.DisplayMember = "maLop";
                // Không cho thao tác trên các nút Lưu / Hủy
                this.btnSave.Enabled   = false;
                this.btnCancel.Enabled = false;
                this.groupBox2.Enabled = false;
                this.groupBox3.Enabled = true;
                // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát
                this.btnAdd.Enabled  = true;
                this.btnEdit.Enabled = true;
                this.btnDel.Enabled  = true;
            }
            catch
            {
                MessageBox.Show("Không lấy được nội dung trong table Khoa. Lỗi rồi!!!");
            }
        }
Exemple #5
0
 private void LoadComboKhoa()
 {
     cboKhoaHoc.DataSource    = dbKhoa.LayKhoa();
     cboKhoaHoc.ValueMember   = "maKhoa";
     cboKhoaHoc.DisplayMember = "maKhoa";
 }