Ejemplo n.º 1
0
        private void btnCapNhatLop_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult result = MessageBox.Show("Bạn có chắc muốn cập nhật thông tin của lớp này không?",
                                                      "Question",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Yes)
                {
                    lopDTO.TenLop               = txtTenLop.Text;
                    lopDTO.SoLuongSinhVien      = Int32.Parse(txtSoLuongSinhVien.Text);
                    lopDTO.SoLuongNgoaiNganSach = Int32.Parse(txtSoLuongNgoaiNganSach.Text);
                    lopDTO.SoLuongTrongNganSach = Int32.Parse(txtSoLuongTrongNganSach.Text);
                    //lopDTO.MaNamHoc = (cmbNamHocCuaLop.SelectedItem as NamHocDTO).MaNamHoc;

                    LopBUS.UpdateRecord(lopDTO);
                    MessageBox.Show("Cập nhật thông tin lớp thành công");
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int malop;

            if (string.IsNullOrEmpty(txtMaLop.Text))
            {
                MessageBox.Show("Chưa chọn lớp");
                return;
            }
            malop = int.Parse(txtMaLop.Text.Trim());
            try
            {
                int i = new LopBUS().XoaLop(malop);
                if (i == 1)
                {
                    MessageBox.Show("Đã xóa lớp");
                    clear();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Đã bị lỗi");
                return;
            }
        }
 public frmChuyenLop()
 {
     InitializeComponent();
     DataService.OpenConnection();
     _quyDinhBUS = new QuyDinhBUS();
     _lopBUS     = new LopBUS();
 }
Ejemplo n.º 4
0
 public void loadData()
 {
     dataGridView1.DataSource = LopBUS.loadAllDataLop();
     (dataGridView1.Columns["MaKhoa"] as DataGridViewComboBoxColumn).DataSource    = khoa;
     (dataGridView1.Columns["MaKhoa"] as DataGridViewComboBoxColumn).DisplayMember = "TenKhoa";
     (dataGridView1.Columns["MaKhoa"] as DataGridViewComboBoxColumn).ValueMember   = "MaKhoa";
 }
Ejemplo n.º 5
0
        public frmDiem(List <DiemMonHoc> listDiem)
        {
            init = new Init(null, null, null, null, null, null);
            LopBUS lopBUS = new LopBUS();

            init.lop = lopBUS.getLop();
            MonHocBUS monBus = new MonHocBUS();

            init.mon = monBus.getMonHoc();
            diem     = listDiem;
            InitializeComponent();
            kt = init.InitLoaiKiemTra(cbLoaiKiemTra);
            var d = diem.First();

            txtHS.Text         = d.TenHS;
            txtLop.Text        = init.lop.First(x => x.MaLop == d.MaLop).TenLop;
            txtMon.Text        = init.mon.First(x => x.IdMonHoc == d.MaMonHoc).TenMonHoc;
            dgrDiem.DataSource = diem.Select(x => new { MaDiem = x.MaDiem, LoaiKiemTra = kt.First(i => i.Id == x.LoaiKiemTra).Ten, Diem = x.Diem }).ToList();
            //var listDTB = diemBUS.GetDiemHK(6, 1).GroupBy(x => x.MaHS).Select(x => new DiemTrungBinhMon(){
            //    TenHS = x.First().TenHS,
            //    NgaySinh = x.First().NgaySinh,
            //    GioiTinh = x.First().GioiTinh,
            //    SinhHoc = x.First(i => i.IdMonHoc == 1).DTB.ToString(),
            //    HoaHoc = x.First(i => i.IdMonHoc == 2).DTB.ToString(),
            //    TiengAnh = x.First(i => i.IdMonHoc == 3).DTB.ToString(),
            //    DiaLi = x.First(i => i.IdMonHoc == 4).DTB.ToString(),
            //    LichSu = x.First(i => i.IdMonHoc == 5).DTB.ToString(),
            //    NguVan = x.First(i => i.IdMonHoc == 6).DTB.ToString(),
            //    Toan = x.First(i => i.IdMonHoc == 7).DTB.ToString(),
            //    VatLi = x.First(i => i.IdMonHoc == 8).DTB.ToString(),
            //    DTB = x.Sum(i => i.DTB) / x.Count()
            //}).ToList();
            //dgrDiem.DataSource = ConvertToDataTable(listDTB);
        }
Ejemplo n.º 6
0
        private void listLop_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                if (listLop.SelectedIndex >= 0)
                {
                    lopDTO = LopBUS.TimLopTheoMaLop(Int32.Parse(listLop.SelectedValue.ToString()));

                    txtTenLop.Text               = lopDTO.TenLop;
                    txtSoLuongSinhVien.Text      = lopDTO.SoLuongSinhVien.ToString();
                    txtSoLuongNgoaiNganSach.Text = lopDTO.SoLuongNgoaiNganSach.ToString();
                    txtSoLuongTrongNganSach.Text = lopDTO.SoLuongTrongNganSach.ToString();

                    LayDanhSachChiTietMon();

                    btnCapNhatChiTietMon.Visible = true;
                    dtgvChiTietMon.Visible       = true;
                    groupBox2.Visible            = true;

                    cmbNamHocCuaLop.DataSource    = NamHocBUS.GetList();
                    cmbNamHocCuaLop.DisplayMember = "TenNamHoc";
                    cmbNamHocCuaLop.ValueMember   = "MaNamHoc";
                    cmbNamHocCuaLop.SelectedValue = lopDTO.MaNamHoc;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 7
0
 public ThemLop()
 {
     InitializeComponent();
     Lbus     = new LopBUS();
     HSbus    = new HocSinhBUS();
     GVbus    = new GiaoVienBUS();
     hocSinhs = new List <DTO.HocSinh>();
 }
Ejemplo n.º 8
0
 public UCTimetable_Add()
 {
     InitializeComponent();
     CaBUS = new CahocBUS();
     NGBUS = new NganhBUS();
     LBUS = new LopBUS();
     GBUS = new GiangvienBUS();
 }
Ejemplo n.º 9
0
 public FrmTimHocSinh()
 {
     InitializeComponent();
     _khoiBUS    = new KhoiBUS();
     _lopBUS     = new LopBUS();
     _namHocBUS  = new NamHocBUS();
     _hocSinhBUS = new HocSinhBUS();
 }
Ejemplo n.º 10
0
 public ThongTinLop(string IDLop)
 {
     ID = IDLop;
     InitializeComponent();
     Lbus     = new LopBUS();
     HSbus    = new HocSinhBUS();
     GVbus    = new GiaoVienBUS();
     hocSinhs = new List <DTO.HocSinh>();
 }
 public frmSinhVien()
 {
     lopBUS  = new LopBUS();
     cnBUS   = new ChuyenNganhBUS();
     gvBUS   = new GiangVienBUS();
     khoaBUS = new KhoaBUS();
     svBUS   = new SinhVienBUS();
     InitializeComponent();
     LoadData();
 }
Ejemplo n.º 12
0
        private void ItemLop()
        {
            LopBUS    lopbus = new LopBUS();
            DataTable dt     = new DataTable();

            dt = lopbus.LoadDSLop();
            cb_lop.DataSource    = dt;
            cb_lop.DisplayMember = "TenLop";
            cb_lop.ValueMember   = "MaLop";
        }
Ejemplo n.º 13
0
 public frmQLHocSinh()
 {
     InitializeComponent();
     dataGridView1.RowTemplate.Height = 35;
     InitKhoi();
     InitLop();
     nienKhoaBUS = new NienKhoaBUS();
     lopBUS      = new LopBUS();
     lop         = lopBUS.getLop();
 }
 public FrmLapDsLop()
 {
     InitializeComponent();
     _giaoVienBUS    = new GiaoVienBUS();
     _namHocBUS      = new NamHocBUS();
     _khoiBUS        = new KhoiBUS();
     _lopBUS         = new LopBUS();
     _isAddButton    = true;
     _isDeleteButton = true;
 }
Ejemplo n.º 15
0
        public ThemHocSinhVaoLop(string Ma)
        {
            //lấy mã lớp sang đây để sửa mã lớp cho học sinh sau khi chọn
            MaLop = Ma;

            InitializeComponent();
            Lbus     = new LopBUS();
            HSbus    = new HocSinhBUS();
            hocSinhs = new List <DTO.HocSinh>();
        }
        public FrmBcBangDiemHocKy()
        {
            InitializeComponent();

            _khoiBUS          = new KhoiBUS();
            _lopBUS           = new LopBUS();
            _namHocBUS        = new NamHocBUS();
            _bangDiemBUS      = new BangDiemBUS();
            _hocKyBUS         = new HocKyBUS();
            _bangDiemHocKyDTO = null;
        }
Ejemplo n.º 17
0
 private void LayNguonChoLop()
 {
     try
     {
         cmbLop.Properties.DataSource = LopBUS.DanhSachTuyChinh();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 18
0
        public FrmBangDiemMonHoc()
        {
            InitializeComponent();

            _khoiBUS     = new KhoiBUS();
            _lopBUS      = new LopBUS();
            _namHocBUS   = new NamHocBUS();
            _bangDiemBUS = new BangDiemBUS();
            _hocKyBUS    = new HocKyBUS();
            _monHocBUS   = new MonHocBUS();
        }
 private void Set_cmbGiangVien()
 {
     try
     {
         cmbLop.Properties.DataSource = LopBUS.DanhSachTuyChinh();
         cmbLop.EditValue             = cmbLop.Properties.GetDataSourceValue("MaLop", 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 20
0
 public FrmHocSinh()
 {
     InitializeComponent();
     _namHocBUS      = new NamHocBUS();
     _khoiBUS        = new KhoiBUS();
     _lopBUS         = new LopBUS();
     _hocSinhBUS     = new HocSinhBUS();
     _quyDinhBUS     = new QuyDinhBUS();
     _phanLopBUS     = new PhanLopBUS();
     _isAddButton    = true;
     _isDeleteButton = true;
 }
 public FrmPhanLop()
 {
     InitializeComponent();
     _namHocBUS       = new NamHocBUS();
     _khoiBUS         = new KhoiBUS();
     _lopBUS          = new LopBUS();
     _hocSinhBUS      = new HocSinhBUS();
     _phanLopBUS      = new PhanLopBUS();
     _quyDinhBUS      = new QuyDinhBUS();
     _chuyenLopBUS    = new ChuyenLopBUS();
     _maNamHocHienTai = _quyDinhBUS.LayMaNamHoc_HienTai();
 }
Ejemplo n.º 22
0
        private void InitLop()
        {
            LopBUS lopBUS = new LopBUS();

            lop = lopBUS.getLop();
            var cbl = lop.Select(x => new { Id = x.MaLop, Ten = x.TenLop }).ToList();

            cbl.Insert(0, new { Id = 0, Ten = "Chọn lớp" });
            cbLop.DataSource    = cbl;
            cbLop.ValueMember   = "Id";
            cbLop.DisplayMember = "Ten";
        }
Ejemplo n.º 23
0
        public void InitLop()
        {
            LopBUS lopBUS = new LopBUS();

            lop = lopBUS.getLop();
            var cbl = new List <object>()
            {
                new { Id = 0, Ten = "Chọn lớp" }
            };

            cbLop.DataSource    = cbl;
            cbLop.ValueMember   = "Id";
            cbLop.DisplayMember = "Ten";
        }
 private void frmThemKhachHang_Load(object sender, EventArgs e)
 {
     try
     {
         cmbLop.Properties.DataSource = LopBUS.DanhSachTuyChinh();
         cmbLop.EditValue             = cmbLop.Properties.GetDataSourceValue("MaLop", 0);
         dateNgaySinh.DateTime        = DateTime.Now.AddYears(-18);
         TaoMa();
     }
     catch (Exception ex)
     {
         ExceptionUtil.ThrowMsgBox(ex.Message);
     }
 }
Ejemplo n.º 25
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         Lop lop = new Lop()
         {
             MaLop = txtMaLop.Text, MaNganh = cmbNganh.EditValue.ToString()
         };
         LopBUS.Them(lop);
         StaticClass.LuuThayDoi();
         log.GhiFile("Thêm mới lớp học: " + lop.MaLop);
         MsgboxUtil.Success("Thành công");
     }
     catch (Exception ex)
     {
         ExceptionUtil.ThrowMsgBox(ex.Message);
     }
 }
Ejemplo n.º 26
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Bạn chắc chứ ?", "Cảnh báo !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }
            try
            {
                LopBUS.deleteDataLop(txtMaLop.Text);
                loadData();
                MessageBox.Show("Xóa thành công !!!");
            }
            catch (SqlException)
            {
                MessageBox.Show("Có lỗi xảy ra !!!");
            }
        }
Ejemplo n.º 27
0
        public List <Lop> getLop()
        {
            try
            {
                LopBUS     lop   = new LopBUS();
                HocSinhBUS hsBus = new HocSinhBUS();
                var        lops  = lop.getLop();
                var        hss   = hsBus.getStudents();

                lops.ForEach(x =>
                {
                    x.hs = hss.Where(d => d.LopHienTai == x.MaLop).ToList();
                });

                return(lop.getLop());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(null);
            }
        }
Ejemplo n.º 28
0
        private void frmPhanCongGiangDay_Load(object sender, EventArgs e)
        {
            try
            {
                txtMaPC.Text = PhanCongBUS.SinhMa();

                cmbGiangVien.Properties.DataSource = GiangVienBUS.DanhSachTuyChinh();
                cmbGiangVien.EditValue             = cmbGiangVien.Properties.GetDataSourceValue("MaGV", 0);

                cmbMonHoc.Properties.DataSource = MonHocBUS.DanhSachTuyChinh();
                cmbMonHoc.EditValue             = cmbMonHoc.Properties.GetDataSourceValue("MaMH", 0);

                cmbLop.Properties.DataSource = LopBUS.DanhSachTuyChinh();
                cmbLop.EditValue             = cmbLop.Properties.GetDataSourceValue("MaLop", 0);

                LoadSourceGridControl();
            }
            catch (Exception ex)
            {
                ExceptionUtil.ThrowMsgBox(ex.Message);
            }
        }
Ejemplo n.º 29
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (txtMaLop.Text.Equals("") || txtTenLop.Text.Equals("") || txtSoSV.Text.Equals(""))
     {
         MessageBox.Show("Yêu cầu nhập đủ các trường !!!");
         return;
     }
     try
     {
         LopDTO lopDTO = new LopDTO();
         lopDTO.MaLop  = txtMaLop.Text;
         lopDTO.TenLop = txtTenLop.Text;
         lopDTO.Sosv   = txtSoSV.Text;
         lopDTO.MaKhoa = cbKhoa.SelectedValue.ToString();
         LopBUS.addDataLop(lopDTO);
         loadData();
         MessageBox.Show("Thêm thành công !!!");
     }
     catch (SqlException)
     {
         MessageBox.Show("Khóa chính bị trùng hoặc có lỗi xảy ra !!!");
     }
 }
Ejemplo n.º 30
0
 private void lsvTables_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         //bang sinh vien
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.SinhVien.ToString())
         {
             tenBang = "SinhVien";
             gridControl1.DataSource = SinhVienBUS.LayDuLieu();
             return;
         }
         //bang buoi hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.BuoiHoc.ToString())
         {
             tenBang = "BuoiHoc";
             gridControl1.DataSource = BuoiHocBUS.LayDuLieu();
             return;
         }
         //bang thoi khoa bieu
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.ThoiKhoaBieu.ToString())
         {
             tenBang = "ThoiKhoaBieu";
             gridControl1.DataSource = ThoiKhoaBieuBUS.LayDuLieu();
             return;
         }
         //bang phong hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.PhongHoc.ToString())
         {
             tenBang = "PhongHoc";
             gridControl1.DataSource = PhongHocBUS.LayDuLieu();
             return;
         }
         //bang đề nghị
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.DeNghi.ToString())
         {
             tenBang = "DeNghi";
             gridControl1.DataSource = DeNghiBUS.LayDuLieu();
             return;
         }
         //bang lop
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.Lop.ToString())
         {
             tenBang = "Lop";
             gridControl1.DataSource = LopBUS.LayDuLieu();
             return;
         }
         //bang phan cong
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.PhanCong.ToString())
         {
             tenBang = "PhanCong";
             gridControl1.DataSource = PhanCongBUS.LayDuLieu();
             return;
         }
         //bang mon hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.MonHoc.ToString())
         {
             tenBang = "MonHoc";
             gridControl1.DataSource = MonHocBUS.LayDuLieu();
             return;
         }
         //bang nghanh hoc
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.NganhHoc.ToString())
         {
             tenBang = "NganhHoc";
             gridControl1.DataSource = NganhHocBUS.LayDuLieu();
             return;
         }
         //bang nguoi dung
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.NguoiDung.ToString())
         {
             tenBang = "NguoiDung";
             gridControl1.DataSource = NguoiDungBUS.LayDuLieu();
             return;
         }
         //bang trinh do
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.TrinhDo.ToString())
         {
             tenBang = "TrinhDo";
             gridControl1.DataSource = TrinhDoBUS.DanhSachTrinhDo();
             return;
         }
         //bang giang vien
         if (lsvTables.Items[GetSelectedItemIndex()].Text == TableNames.GiangVien.ToString())
         {
             tenBang = "GiangVien";
             gridControl1.DataSource = GiangVienBUS.LayDuLieu();
             return;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 31
0
 public DanhSachLop()
 {
     InitializeComponent();
     bus  = new LopBUS();
     lops = new List <DTO.Lop>();
 }