Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            string text = txbSearch.Text;

            if (text == "")
            {
                return;
            }
            dgSearchResult.Rows.Clear();
            if (comboBox1.SelectedIndex == 0)
            {
                EC_LopHoc LopHoc = new BUS_LopHoc().Select_ByPrimaryKey(text);
                if (LopHoc != null)
                {
                    List <EC_LichHoc> listBuoiHoc = new BUS_LichHoc().SelectByFields("Ma_LopHoc", LopHoc.Ma_LopHoc);
                    if (listBuoiHoc.Count == 0)
                    {
                        dgSearchResult.Rows.Clear();
                        return;
                    }
                    List <EC_BuoiHoc_HocSinh> listBHHS = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", listBuoiHoc[0].Ma_BuoiHoc);

                    foreach (EC_BuoiHoc_HocSinh ec in listBHHS)
                    {
                        EC_HocSinh hs = new BUS_HocSinh().Select_ByPrimaryKey(ec.Ma_HocSinh);
                        dgSearchResult.Rows.Add(hs.Ma_HocSinh, hs.Ten_HocSinh, "Học sinh", hs.Email, null);
                    }
                }

                EC_HocSinh HocSinh = new BUS_HocSinh().Select_ByPrimaryKey(text);
                if (HocSinh != null)
                {
                    dgSearchResult.Rows.Add(HocSinh.Ma_HocSinh, HocSinh.Ten_HocSinh, "Học sinh", HocSinh.Email, null);
                    return;
                }

                EC_GiaoVien GiaoVien = new BUS_GiaoVien().Select_ByPrimaryKey(text);
                if (GiaoVien != null)
                {
                    dgSearchResult.Rows.Add(GiaoVien.Ma_GiaoVien, GiaoVien.Ten_GiaoVien, "Giáo viên", GiaoVien.Email, null);
                    return;
                }
            }
            else
            {
                List <EC_HocSinh> listHocSinh = new BUS_HocSinh().SelectByFields("Ten_HocSinh", text);
                foreach (EC_HocSinh HocSinh in listHocSinh)
                {
                    dgSearchResult.Rows.Add(HocSinh.Ma_HocSinh, HocSinh.Ten_HocSinh, "Học sinh", HocSinh.Email, null);
                }
                List <EC_GiaoVien> listGiaoVien = new BUS_GiaoVien().SelectByFields("Ten_GiaoVien", text);
                foreach (EC_GiaoVien GiaoVien in listGiaoVien)
                {
                    dgSearchResult.Rows.Add(GiaoVien.Ma_GiaoVien, GiaoVien.Ten_GiaoVien, "Giáo viên", GiaoVien.Email, null);
                }
            }
        }
Beispiel #2
0
        private void dgDanhSach_LopHoc_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            string            Ma_LopHoc   = dgDanhSach_LopHoc.Rows[e.RowIndex].Cells["Ma_LopHoc"].Value.ToString();
            List <EC_LichHoc> listLichHoc = new BUS_LichHoc().SelectByFields("Ma_LopHoc", Ma_LopHoc);

            foreach (EC_LichHoc i in listLichHoc)
            {
                EC_BuoiHoc_HocSinh BuoiHoc_HS = new BUS_BuoiHoc_HocSinh().SelectByMa(i.Ma_BuoiHoc, Ma_HocSinh);
                if (BuoiHoc_HS == null)
                {
                    continue;
                }
                string TrangThai = i.TrangThai == true ? "Đã học" : "Chưa học";
                string DiemDanh  = BuoiHoc_HS.DiemDanh == true ? "Học" : "Nghỉ";
                dgDanhSach_BuoiHoc.Rows.Add(i.STT_Buoi, i.NgayHoc.ToShortDateString(), i.KipHoc, i.PhongHoc, TrangThai, DiemDanh);
            }
            EC_LopHoc LopHoc = new BUS_LopHoc().Select_ByPrimaryKey(Ma_LopHoc);

            txbTen_GiaoVien.Text = new BUS_GiaoVien().Select_ByPrimaryKey(LopHoc.Ma_GiaoVien).Ten_GiaoVien;
            txbSoBuoi.Text       = LopHoc.SoBuoi.ToString();
            EC_MonHoc MonHoc = new BUS_MonHoc().Select_ByPrimaryKey(LopHoc.Ma_MonHoc);

            txbLop.Text        = MonHoc.Lop.ToString();
            txbTen_MonHoc.Text = MonHoc.Ten_MonHoc;
            txbTongHP.Text     = LopHoc.TongHocPhi_KhoaHoc.ToString();
            txbTrinhDo.Text    = LopHoc.TrinhDo;
            dtNgayBatdau.Value = LopHoc.Ngay_BatDau;

            dgDanhSach_HocSinh.Rows.Clear();
            List <EC_LichHoc>         listBuoiHoc         = new BUS_LichHoc().SelectByFields("Ma_LopHoc", Ma_LopHoc);
            List <EC_BuoiHoc_HocSinh> listBuoiHoc_HocSinh = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", listBuoiHoc[0].Ma_BuoiHoc);
            List <EC_HocSinh>         listHocSinh         = new List <EC_HocSinh>();

            foreach (EC_BuoiHoc_HocSinh i in listBuoiHoc_HocSinh)
            {
                EC_HocSinh hocsinh = new BUS_HocSinh().Select_ByPrimaryKey(i.Ma_HocSinh);
                listHocSinh.Add(hocsinh);
            }
            foreach (EC_HocSinh i in listHocSinh)
            {
                string GioiTinh = i.GioiTinh == true ? "Nam" : "Nữ";
                dgDanhSach_HocSinh.Rows.Add(i.Ten_HocSinh, i.NgaySinh.ToShortDateString(), GioiTinh, i.DiaChi);
            }
            txbSoHocSinh.Text = listHocSinh.Count.ToString();
        }
Beispiel #3
0
        private void dgChiTiet_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string Ma_LopHoc  = dgChiTiet.Rows[e.RowIndex].Cells["Ma_LopHoc"].Value.ToString();
            string Ma_BuoiHoc = dgChiTiet.Rows[e.RowIndex].Cells["Ma_BuoiHoc"].Value.ToString();

            EC_LopHoc          LopHoc  = new BUS_LopHoc().Select_ByPrimaryKey(Ma_LopHoc);
            EC_LichHoc         LichHoc = new BUS_LichHoc().Select_ByPrimaryKey(Ma_BuoiHoc);
            EC_BuoiHoc_HocSinh BHHS    = new BUS_BuoiHoc_HocSinh().SelectByMa(Ma_BuoiHoc, Ma_HocSinh);

            txbMa_LopHoc.Text   = LopHoc.Ma_LopHoc;
            txbMa_BuoiHoc.Text  = LichHoc.Ma_BuoiHoc;
            txbGiaoVien.Text    = new BUS_GiaoVien().Select_ByPrimaryKey(LopHoc.Ma_GiaoVien).Ten_GiaoVien;
            txbMonHoc.Text      = new BUS_MonHoc().Select_ByPrimaryKey(LopHoc.Ma_MonHoc).Ten_MonHoc;
            txbSoTien_Buoi.Text = BHHS.SoTien_Buoi.ToString();
            dtNgayHoc.Value     = LichHoc.NgayHoc;
        }
        void Load()
        {
            dgDanhSachLop.Rows.Clear();
            List <EC_LichHoc>         listLichHoc         = new BUS_LichHoc().SelectByFields("Ma_LopHoc", Ma_LopHoc);
            List <EC_BuoiHoc_HocSinh> listBuoiHoc_HocSinh = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", listLichHoc[0].Ma_BuoiHoc);
            List <EC_HocSinh>         listHocSinh         = new List <EC_HocSinh>();

            foreach (EC_BuoiHoc_HocSinh i in listBuoiHoc_HocSinh)
            {
                EC_HocSinh hocsinh = new BUS_HocSinh().Select_ByPrimaryKey(i.Ma_HocSinh);
                listHocSinh.Add(hocsinh);
            }

            foreach (EC_HocSinh i in listHocSinh)
            {
                dgDanhSachLop.Rows.Add(i.Ma_HocSinh, i.Ten_HocSinh, i.NgaySinh, i.GioiTinh, i.SDT);
            }
        }
Beispiel #5
0
        void Load()
        {
            EC_GiaoVien GiaoVien = new BUS_GiaoVien().Select_ByPrimaryKey(Ma_GiaoVien);

            if (GiaoVien.Anh != null)
            {
                picAvt.Image = HinhAnh.ByteToImage(GiaoVien.Anh);
            }
            txbMa_GiaoVien.Text     = GiaoVien.Ma_GiaoVien;
            txbTen_GiaoVien.Text    = GiaoVien.Ten_GiaoVien;
            txbDiaChi.Text          = GiaoVien.DiaChi;
            txbEmail.Text           = GiaoVien.Email;
            txbSDT.Text             = GiaoVien.SDT;
            dtNgaySinh.Value        = GiaoVien.NgaySinh;
            cbGioiTinh.SelectedItem = GiaoVien.GioiTinh == true ? "Nam" : "Nữ";
            cbTrinhDo.SelectedItem  = GiaoVien.TrinhDo;

            List <EC_PhanCong_Day> listPhanCong_Day = new BUS_PhanCong_Day().SelectByFields("Ma_GiaoVien", Ma_GiaoVien);
            BUS_MonHoc             busMonHoc        = new BUS_MonHoc();
            int index = 1;

            foreach (EC_PhanCong_Day ec in listPhanCong_Day)
            {
                EC_MonHoc MonHoc = busMonHoc.Select_ByPrimaryKey(ec.Ma_MonHoc);
                dgPhanCong_Day.Rows.Add(index.ToString(), MonHoc.Ma_MonHoc, MonHoc.Ten_MonHoc, MonHoc.Lop.ToString());
                index++;
            }

            index = 1;
            List <EC_LopHoc> listLopHoc = new BUS_LopHoc().SelectByFields("Ma_GiaoVien", Ma_GiaoVien);

            foreach (EC_LopHoc ec in listLopHoc)
            {
                List <EC_LichHoc> listBuoiHoc = new BUS_LichHoc().SelectByFields("Ma_LopHoc", ec.Ma_LopHoc);
                if (listBuoiHoc.Count == 0)
                {
                    continue;
                }
                List <EC_BuoiHoc_HocSinh> listBHHS = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", listBuoiHoc[0].Ma_BuoiHoc);
                EC_MonHoc MonHoc = busMonHoc.Select_ByPrimaryKey(ec.Ma_MonHoc);
                dgLopDay.Rows.Add(index.ToString(), ec.Ma_LopHoc, MonHoc.Ten_MonHoc, MonHoc.Lop, ec.SoBuoi, listBHHS.Count);
                index++;
            }
        }
Beispiel #6
0
        void Load()
        {
            dgDanhSachLop.Rows.Clear();
            List <EC_LichHoc>         listLichHoc         = new BUS_LichHoc().SelectByFields("Ma_LopHoc", Ma_LopHoc);
            List <EC_BuoiHoc_HocSinh> listBuoiHoc_HocSinh = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", listLichHoc[0].Ma_BuoiHoc);
            List <EC_HocSinh>         listHocSinh         = new List <EC_HocSinh>();

            foreach (EC_BuoiHoc_HocSinh i in listBuoiHoc_HocSinh)
            {
                EC_HocSinh hocsinh = new BUS_HocSinh().Select_ByPrimaryKey(i.Ma_HocSinh);
                listHocSinh.Add(hocsinh);
            }
            int index = 1;

            foreach (EC_HocSinh i in listHocSinh)
            {
                string GioiTinh = i.GioiTinh == true ? "Nam" : "Nữ";
                dgDanhSachLop.Rows.Add(index.ToString(), i.Ma_HocSinh, i.Ten_HocSinh, i.NgaySinh.ToShortDateString(), GioiTinh, i.SDT);
                index++;
            }
        }
Beispiel #7
0
        void LayDuLieu(int SttBuoi)
        {
            int        SoHS_DiHoc = 0;
            EC_LichHoc ecLichHoc  = new EC_LichHoc();

            DanhSachLop = new List <EC_HocSinh>();
            dgLopHoc.Rows.Clear();

            foreach (EC_LichHoc ec in listBuoiHoc)
            {
                if (ec.STT_Buoi == (SttBuoi + 1))
                {
                    ecLichHoc = ec;
                }
            }
            if (ecLichHoc == null)
            {
                return;
            }

            List <EC_BuoiHoc_HocSinh> listBH_HS = new BUS_BuoiHoc_HocSinh().SelectByFields("Ma_BuoiHoc", ecLichHoc.Ma_BuoiHoc);

            if (listBH_HS.Count == 0)
            {
                return;
            }
            foreach (EC_BuoiHoc_HocSinh bhhs in listBH_HS)
            {
                EC_HocSinh hs = new BUS_HocSinh().Select_ByPrimaryKey(bhhs.Ma_HocSinh);
                DanhSachLop.Add(hs);
                if (bhhs.DiemDanh == true)
                {
                    SoHS_DiHoc++;
                }
            }

            int i = 1;

            foreach (EC_HocSinh HocSinh in DanhSachLop)
            {
                string gioitinh = HocSinh.GioiTinh == true ? "Nam" : "Nữ";
                bool   DiemDanh = false;
                foreach (EC_BuoiHoc_HocSinh bhhs in listBH_HS)
                {
                    if (bhhs.Ma_HocSinh == HocSinh.Ma_HocSinh)
                    {
                        DiemDanh = bhhs.DiemDanh;
                    }
                }
                dgLopHoc.Rows.Add(i.ToString(), HocSinh.Ten_HocSinh, HocSinh.NgaySinh,
                                  gioitinh, HocSinh.SDT, DiemDanh);
                i++;
            }

            DateTime NgayHoc = ecLichHoc.NgayHoc;

            if (NgayHoc.Day == DateTime.Now.Day && NgayHoc.Month == DateTime.Now.Month && NgayHoc.Year == DateTime.Now.Year)
            {
                btDiemDanh.Visible = true;
            }
            else
            {
                btDiemDanh.Visible = false;
            }

            dateTimePicker1.Value = NgayHoc;
            txbKip.Text           = ecLichHoc.KipHoc.ToString();
            txbSoHocSinh.Text     = DanhSachLop.Count.ToString();

            int SoHS_Vang = DanhSachLop.Count - SoHS_DiHoc;

            txbDiHoc.Text = SoHS_DiHoc.ToString();
            txbVang.Text  = SoHS_Vang.ToString();

            txbTrangThai.Text = ecLichHoc.TrangThai == true ? "Đã học" : "Chưa học";

            txbHocPhi_Buoi.Text = ecLichHoc.TongHocPhi_Buoi.ToString();
            txbMa_BuoiHoc.Text  = ecLichHoc.Ma_BuoiHoc;
        }