예제 #1
0
        private void tvDanhSachLop_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode       currentNode = e.Node;
            List <HocSinh> listHS      = hsbus.getStudents();
            List <Lop>     listLop     = lopBUS.getLop();
            var            nodeKhoi10  = tvDanhSachLop.Nodes[0].Nodes[0];
            var            nodeKhoi11  = tvDanhSachLop.Nodes[0].Nodes[1];
            var            nodeKhoi12  = tvDanhSachLop.Nodes[0].Nodes[2];
            var            parentNode  = currentNode.Parent;

            if (parentNode == nodeKhoi10 || parentNode == nodeKhoi11 || parentNode == nodeKhoi12)
            {
                var            resultLop  = lop.Where(x => x.TenLop == currentNode.Text).ToList();
                List <HocSinh> listResult = new List <HocSinh>();
                foreach (var x in listHS)
                {
                    foreach (var y in resultLop)
                    {
                        if (x.LopHienTai == y.MaLop)
                        {
                            listResult.Add(x);
                        }
                    }
                }
                dataGridView1.DataSource = listResult;
                this.dataGridView1.Columns[9].Visible = false;
                this.dataGridView1.Columns[7].Visible = false;
            }
        }
예제 #2
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);
        }
예제 #3
0
 public frmThemLop()
 {
     InitializeComponent();
     init = new Init(cbKhoaHoc, cbKhoi, null, null, null, null);
     init.InitKhoa();
     init.InitKhoi();
     init.lop = lopBUS.getLop();
 }
예제 #4
0
 public frmQLHocSinh()
 {
     InitializeComponent();
     dataGridView1.RowTemplate.Height = 35;
     InitKhoi();
     InitLop();
     nienKhoaBUS = new NienKhoaBUS();
     lopBUS      = new LopBUS();
     lop         = lopBUS.getLop();
 }
예제 #5
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";
        }
예제 #6
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         dgrDanhSachLop.DataSource = lopBUS.getLop().Where(x => (string.IsNullOrEmpty(cbLop.Text) || x.TenLop.Contains(cbLop.Text)) && (string.IsNullOrEmpty(cbKhoaHoc.Text) || x.IdKhoaHoc == int.Parse(cbKhoaHoc.Text))).ToList();
         this.dgrDanhSachLop.Columns["TinhTrang"].Visible  = false;
         this.dgrDanhSachLop.Columns["LopHienTai"].Visible = false;
     }
     catch (Exception)
     {
         MessageBox.Show("Chưa chọn lớp");
     }
 }
예제 #7
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);
            }
        }
예제 #8
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 LoadData()
        {
            // Allow Them / Sua / Xoa / txtSiSo
            this.btnThem.Enabled                = true;
            this.btnSua.Enabled                 = true;
            this.btnXoa.Enabled                 = true;
            this.txtSiSo.Enabled                = true;
            this.txtMaSinhVien.Enabled          = false;
            this.cbbTruongKhoa.Enabled          = true;
            this.cbbMaKhoa.DropDownStyle        = ComboBoxStyle.DropDownList;
            this.cbbMaKhoa.Enabled              = true;
            this.cbbMaChuyenNganh.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cbbMaChuyenNganh.Enabled       = true;
            this.cbbMaLop.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.cbbMaLop.Enabled               = true;

            // Can not use btnLuu btnHuy
            this.btnThucThi.Enabled = false;
            this.btnHuyBo.Enabled   = false;

            //lcgKhoa
            this.cbbMaKhoa.DataSource    = khoaBUS.getKhoa();
            this.cbbMaKhoa.DisplayMember = "MaKhoa";
            this.cbbMaKhoa.ValueMember   = "MaKhoa";

            string[] gioiTinh = { "", "Nam", "Nu" };
            this.cbbGioiTinh.DataSource = gioiTinh;

            // Mở thao tác cho 4 panel
            this.lcgKhoa.Enabled        = true;
            this.lcgChuyenNganh.Enabled = true;
            this.lcgLop.Enabled         = true;
            this.lcgSV.Enabled          = true;

            // Import DL cho ComBoBox
            this.cbbMaKhoa_ChuyenNganh.DataSource = khoaBUS.getKhoa();
            cbbMaKhoa_ChuyenNganh.DisplayMember   = "TenKhoa";
            cbbMaKhoa_ChuyenNganh.ValueMember     = "MaKhoa";

            this.cbbMaChuyenNganh_Lop.DataSource    = cnBUS.getChuyenNganh();
            this.cbbMaChuyenNganh_Lop.DisplayMember = "TenChuyenNganh";
            this.cbbMaChuyenNganh_Lop.ValueMember   = "MaChuyenNganh";

            this.cbbMaLop_SinhVien.DataSource    = lopBUS.getLop();
            this.cbbMaLop_SinhVien.DisplayMember = "MaLop";
            this.cbbMaLop_SinhVien.ValueMember   = "MaLop";
        }