Exemple #1
0
        private void LoadcbK()
        {
            List <KhoiDTO> k = KhoiBLL.LoadcbKhoi();

            cbKhoi.DataSource    = k;
            cbKhoi.DisplayMember = "STenKhoi"; // Giá trị cần hiển thị
            cbKhoi.ValueMember   = "IMaKhoi";  // Giá trị cần lấy
        }
Exemple #2
0
        private void LoadKhoi()
        {
            List <KhoiDTO> lstkhoi = KhoiBLL.LoadKhoi();

            dgvKhoi.DataSource = lstkhoi;
            // Đặt lại tên cột
            dgvKhoi.Columns["IMaKhoi"].HeaderText  = "Mã khối";
            dgvKhoi.Columns["STenKhoi"].HeaderText = "Tên khối";
            dgvKhoi.Columns["SGhiChu"].HeaderText  = "Ghi chú";
        }
Exemple #3
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (txtMakhoi.Text == "")
            {
                MessageBox.Show("Bạn phải chọn khối cần xóa.");
                return;
            }
            KhoiDTO khoiDTO = new KhoiDTO();

            khoiDTO.IMaKhoi = int.Parse(txtMakhoi.Text);
            if (KhoiBLL.XoaKhoi(khoiDTO))
            {
                MessageBox.Show("Xóa thành công.");
                LoadKhoi();
                return;
            }
            else
            {
                MessageBox.Show("Xóa thất bại.");
            }
        }
Exemple #4
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtTenkhoi.Text == "")
            {
                MessageBox.Show("Bạn phải nhập vào khối học");
                return;
            }
            KhoiDTO khoiDTO = new KhoiDTO();

            khoiDTO.STenKhoi = txtTenkhoi.Text;
            khoiDTO.SGhiChu  = txtGhichu.Text;
            if (KhoiBLL.ThemKhoi(khoiDTO))
            {
                MessageBox.Show("Thêm thành công.");
                LoadKhoi();
                return;
            }
            else
            {
                MessageBox.Show("Thêm thất bại.");
            }
        }
Exemple #5
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (txtMakhoi.Text == "")
            {
                MessageBox.Show("Bạn phải chọn khối cần Sửa.");
                return;
            }
            KhoiDTO khoiDTO = new KhoiDTO();

            khoiDTO.IMaKhoi  = int.Parse(txtMakhoi.Text);
            khoiDTO.STenKhoi = txtTenkhoi.Text;
            khoiDTO.SGhiChu  = txtGhichu.Text;
            if (KhoiBLL.SuaKhoi(khoiDTO))
            {
                MessageBox.Show("Sửa thành công.");
                LoadKhoi();
                return;
            }
            else
            {
                MessageBox.Show("Sửa thất bại.");
            }
        }