Пример #1
0
        void LoadData()
        {
            try
            {
                dgvLop.DataSource = dbLop.LayLop();

                // Thay đổi độ rộng cột
                dgvLop.AllowUserToAddRows = false;
                cboMaKhoa.DataSource      = dbKhoa.LayKhoa();
                cboMaKhoa.ValueMember     = "maKhoa";
                cboMaKhoa.DisplayMember   = "maKhoa";

                // Xóa trống các đối tượng trong Panel
                txtMaLop.ResetText();
                txtTenLop.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!!!");
            }
        }
Пример #2
0
        void LoadDataSV()
        {
            if (quyen == "Admin")
            {
                dgvSV.DataSource = dbSV.LaySinhVien();
            }
            else
            {
                dgvSV.DataSource = dbSV.TimMaSinhVien(user);
            }

            dgvSV.Columns.Remove("ngaySinh");
            dgvSV.Columns.Remove("gioiTinh");
            dgvSV.Columns.Remove("diaChi");
            dgvSV.Columns["Lop"].Visible   = false;
            dgvSV.Columns["maLop"].Visible = false;
            dgvSV.AllowUserToAddRows       = false;
            dgvSV.ReadOnly  = true;
            rdbMaSV.Checked = true;
            LoadComboKhoa();
            LoadComboLop(cboKhoaHoc.Text);
            dgvSV.SelectionMode        = DataGridViewSelectionMode.FullRowSelect;
            dgvDiem.AllowUserToAddRows = false;
            dgvDiem.ReadOnly           = true;
            dgvDiem.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            cbLop.DataSource           = dbLop.LayLop();
            cbLop.ValueMember          = "maLop";
            //cbLop.DisplayMember = "maLop";
            cbMon.DataSource  = dbMon.LayMon();
            cbMon.ValueMember = "maMon";
            // cbMon.DisplayMember = "maMon";
            // 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;

            // 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;
            this.btnExit.Enabled = true;
            phanquyen();
            //resettextDiem();
        }
Пример #3
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!!!");
            }
        }