Beispiel #1
0
        private void cbCaHoc_SelectedIndexChanged(object sender, EventArgs e)
        {
            CaHocBUS  _objcahocbus = new CaHocBUS();
            DataTable _dtch        = _objcahocbus.Get_CT(cbCaHoc.SelectedValue.ToString());

            for (int i = 0; i < _dtch.Rows.Count; i++)
            {
                txtGioBatDau.Text  = _dtch.Rows[i]["GioBatDau"].ToString();
                txtGioKetThuc.Text = _dtch.Rows[i]["GioKetThuc"].ToString();
            }
        }
Beispiel #2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (dataGridViewX1.Rows.Count > 0)
            {
                for (int i = 0; i < dataGridViewX1.Rows.Count; i++)
                {
                    string makhoa, machuongtrinhhoc, magv, maphonghoc, mangayhoc, maca;
                    makhoa           = new KhoaHocBUS().GetMa_TheoTen(dataGridViewX1.Rows[i].Cells[2].Value.ToString());
                    machuongtrinhhoc = new ChuongTrinhHocBUS().GetMa_TheoTen(dataGridViewX1.Rows[i].Cells[3].Value.ToString());
                    magv             = new GiangVienBUS().GetMa_TheoTen(dataGridViewX1.Rows[i].Cells[10].Value.ToString());
                    maphonghoc       = new PhongHocBUS().GetMa_TheoTen_PhongHoc(dataGridViewX1.Rows[i].Cells[11].Value.ToString());
                    mangayhoc        = new NgayHocBUS().GetMa_TheoTen(dataGridViewX1.Rows[i].Cells[6].Value.ToString());
                    maca             = new CaHocBUS().GetMa_TheoTen(dataGridViewX1.Rows[i].Cells[7].Value.ToString());
                    _objlop          = new Lop(
                        _objlopbus.Lop_NextID(),
                        dataGridViewX1.Rows[i].Cells[1].Value.ToString(),
                        makhoa,
                        machuongtrinhhoc,
                        DateTime.Parse(dataGridViewX1.Rows[i].Cells[4].Value.ToString()),
                        DateTime.Parse(dataGridViewX1.Rows[i].Cells[5].Value.ToString()),
                        maca,
                        mangayhoc,
                        magv,
                        maphonghoc);

                    if (_objlopbus.AddLop(_objlop))
                    {
                        dataGridViewX1.Rows.Remove(dataGridViewX1.Rows[i]);
                        i--;
                        LoadData();
                    }
                    else
                    {
                        string a = dataGridViewX1.Rows[i].Cells[0].Value.ToString();
                        MessageBox.Show("Lưu dòng " + a + " thất bại");
                    }
                }


                if (dataGridViewX1.Rows.Count == 0)
                {
                    MessageBox.Show("Lưu thành công");
                }

                dtipNgayBatDau.Text  = "";
                dtipNgayKetThuc.Text = "";
            }
            else
            {
                MessageBox.Show("Không có dữ liệu để lưu ! ", "Thống báo ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
        public void LoadSelect()
        {
            GiangVienBUS _objgvbus = new GiangVienBUS();
            DataTable    _dtgv     = _objgvbus.GetMaTen();

            cbGiangVien.DataSource    = _dtgv;
            cbGiangVien.ValueMember   = "MaGV";
            cbGiangVien.DisplayMember = "TenGV";
            cbGiangVien.SelectedIndex = -1;

            KhoaHocBUS _objkhoahocbus = new KhoaHocBUS();
            DataTable  _dtkh          = _objkhoahocbus.GetMaTenKhoaHoc();

            cbKhoaHoc.DataSource    = _dtkh;
            cbKhoaHoc.ValueMember   = "MaKhoaHoc";
            cbKhoaHoc.DisplayMember = "TenKhoaHoc";
            PhongHocBUS _objphonghocbus = new PhongHocBUS();
            DataTable   _dtph           = _objphonghocbus.GetMaTen();

            cbPhongHoc.DataSource    = _dtph;
            cbPhongHoc.ValueMember   = "MaPhong";
            cbPhongHoc.DisplayMember = "TenPhong";
            cbPhongHoc.SelectedIndex = -1;

            CaHocBUS  _objcahocbus = new CaHocBUS();
            DataTable _dtch        = _objcahocbus.GetMaTen();

            cbCaHoc.DataSource    = _dtch;
            cbCaHoc.ValueMember   = "MaCa";
            cbCaHoc.DisplayMember = "TenCa";
            cbCaHoc.Text          = "";

            NgayHocBUS _objngayhocbus = new NgayHocBUS();
            DataTable  _dtngay        = _objngayhocbus.GetAllNgayHoc();

            cbNgayHoc.DataSource    = _dtngay;
            cbNgayHoc.ValueMember   = "MaNgay";
            cbNgayHoc.DisplayMember = "DanhSachNgay";
            cbNgayHoc.SelectedIndex = -1;

            cbChuongTrinhHoc.SelectedIndex = -1;
            txtGioBatDau.Text  = "";
            txtGioKetThuc.Text = "";
        }
Beispiel #4
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            string makhoa, machuongtrinhhoc, magv, maphonghoc, mangayhoc, maca;

            makhoa           = new KhoaHocBUS().GetMa_TheoTen(cbKhoaHoc.Text);
            machuongtrinhhoc = new ChuongTrinhHocBUS().GetMa_TheoTen(cbChuongTrinhHoc.Text);
            magv             = new GiangVienBUS().GetMa_TheoTen(cbGiangVien.Text);
            maphonghoc       = new PhongHocBUS().GetMa_TheoTen_PhongHoc(cbPhongHoc.Text);
            mangayhoc        = new NgayHocBUS().GetMa_TheoTen(cbNgayHoc.Text);
            maca             = new CaHocBUS().GetMa_TheoTen(cbCaHoc.Text);
            _objlop          = new Lop(
                dataGridViewX1.CurrentRow.Cells[0].Value.ToString(),
                txtTenLop.Text,
                makhoa,
                machuongtrinhhoc,
                DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString()),
                DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString()),
                maca,
                mangayhoc,
                magv,
                maphonghoc);
            //MessageBox.Show(dataGridViewX1.CurrentRow.Cells[0].Value.ToString() +
            //    txtTenLop.Text+
            //    makhoa+
            //    machuongtrinhhoc+
            //    DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString())+
            //    DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString())+
            //    maca+
            //    mangayhoc+
            //    magv+
            //    maphonghoc);

            if (_objlopbus.EditLop(_objlop))
            {
                MessageBox.Show("Cập nhật thành công ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadData();
                resettextbox();
            }
            else
            {
                MessageBox.Show("Cập Nhật thất bại", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        protected void LoadData()
        {
            GiangVienBUS _objgvbus = new GiangVienBUS();
            DataTable    _dtgv     = _objgvbus.GetMaTen();

            cbGiangVien.DataSource    = _dtgv;
            cbGiangVien.ValueMember   = "MaGV";
            cbGiangVien.DisplayMember = "TenGV";
            cbGiangVien.SelectedIndex = -1;

            KhoaHocBUS _objkhoahocbus = new KhoaHocBUS();
            DataTable  _dtkh          = _objkhoahocbus.GetMaTenKhoaHoc();

            cbKhoaHoc.DataSource    = _dtkh;
            cbKhoaHoc.ValueMember   = "MaKhoaHoc";
            cbKhoaHoc.DisplayMember = "TenKhoaHoc";

            PhongHocBUS _objphonghocbus = new PhongHocBUS();
            DataTable   _dtph           = _objphonghocbus.GetMaTen();

            cbPhongHoc.DataSource    = _dtph;
            cbPhongHoc.ValueMember   = "MaPhong";
            cbPhongHoc.DisplayMember = "TenPhong";
            cbPhongHoc.SelectedIndex = -1;

            CaHocBUS  _objcahocbus = new CaHocBUS();
            DataTable _dtch        = _objcahocbus.GetMaTen();

            cbCaHoc.DataSource    = _dtch;
            cbCaHoc.ValueMember   = "MaCa";
            cbCaHoc.DisplayMember = "TenCa";
            cbCaHoc.Text          = "";


            NgayHocBUS _objngayhocbus = new NgayHocBUS();
            DataTable  _dtngay        = _objngayhocbus.GetAllNgayHoc();

            cbNgayHoc.DataSource    = _dtngay;
            cbNgayHoc.ValueMember   = "MaNgay";
            cbNgayHoc.DisplayMember = "DanhSachNgay";
            cbNgayHoc.SelectedIndex = -1;

            cbChuongTrinhHoc.SelectedIndex = -1;
            txtGioBatDau.Text                = "";
            txtGioKetThuc.Text               = "";
            _dtlophoc                        = _objlopbus.GetAll_CT();
            dataGridViewX2.DataSource        = _dtlophoc;
            dataGridViewX2.RowHeadersVisible = true;
            _dtlophoc.Columns.Add("STT");
            for (int i = 0; i < _dtlophoc.Rows.Count; i++)
            {
                _dtlophoc.Rows[i]["STT"] = i + 1;
            }
            dataGridViewX2.Columns["STT"].DisplayIndex             = 0;
            dataGridViewX2.Columns["MaLop"].HeaderText             = "Mã Lớp";
            dataGridViewX2.Columns["TenLop"].HeaderText            = "Tên Lớp";
            dataGridViewX2.Columns["TenKhoaHoc"].HeaderText        = "Tên Khóa Học";
            dataGridViewX2.Columns["TenChuongTrinhHoc"].HeaderText = "Chương Trình Học";
            dataGridViewX2.Columns["NgayBatDau"].HeaderText        = "Ngày Bắt Đầu";
            dataGridViewX2.Columns["NgayKetThuc"].HeaderText       = "Ngày Kết Thúc";
            dataGridViewX2.Columns["GioBatDau"].HeaderText         = "Giờ Bắt Đầu";
            dataGridViewX2.Columns["GioKetThuc"].HeaderText        = "Giờ Kết Thúc";
            dataGridViewX2.Columns["DanhSachNgay"].HeaderText      = "Ngày Học";
            dataGridViewX2.Columns["TenGV"].HeaderText             = "Tên Giảng Viên";
            dataGridViewX2.Columns["TenPhong"].HeaderText          = "Phòng Học";
            dataGridViewX2.ClearSelection();
        }