Пример #1
0
 // lấy danh sách học sinh trong một lớp( học sinh đã có trong lớp))
 public HocSinh[] layDanhSachHocSinh_DaCoLop_DAO(Lop lop)
 {
     HocSinh[] dsHocSinh;
     string nameProc_LayDSHocSinh_DaCoLop = "sp_layDanhSachHocSinh_DaCoLop";
     SqlParameter para1 = new SqlParameter("@maLop", lop.MaLop);
     DataTable bangDSHocSinh = DataProvider.executeStoreProcedureQuery(nameProc_LayDSHocSinh_DaCoLop, para1);
     dsHocSinh = layDanhSachHocSinh_DaCoLop_TuBang(bangDSHocSinh);
     return dsHocSinh;
 }
Пример #2
0
 public Lop[] getAllClass()
 {
     string strSql = "SELECT * FROM Lop";
     DataTable dt = DataProvider.executeQuery(strSql);
     int n = dt.Rows.Count;
     Lop[] allClass = new Lop[n];
     for (int i = 0; i < n; i++)
     {
         Lop TK = GetDataFromDataRow(dt, i);
         allClass[i] = TK;
     }
     return allClass;
 }
Пример #3
0
 public Lop[] layDanhSachLop_Tu_Bang(DataTable bangDSLop)
 {
     Lop[] dsLop = new Lop[bangDSLop.Rows.Count];
     for (int i = 0; i < bangDSLop.Rows.Count; i++)
     {
         Lop lop = new Lop();
         lop.MaLop = Convert.ToInt32(bangDSLop.Rows[i]["maLop"]);
         lop.TenLop = bangDSLop.Rows[i]["tenLop"].ToString();
         lop.SiSo = Convert.ToInt32(bangDSLop.Rows[i]["siSo"]);
         lop.MaKHoi = Convert.ToInt32(bangDSLop.Rows[i]["maKhoi"]);
         lop.MaGV_ChuNhiem = Convert.ToInt32(bangDSLop.Rows[i]["maGV_ChuNhiem"]);
         dsLop[i] = lop;
     }
     return dsLop;
 }
Пример #4
0
 public bool themHocSinh_VaoLop_BUS(HocSinh hocsinh, Lop lop)
 {
     return hocsinhDAO.themHocSinh_VaoLop_DAO(hocsinh, lop);
 }
Пример #5
0
 public bool suaHocSinh_SuaLop_DAO(HocSinh hocsinh, Lop lop)
 {
     return hocsinhDAO.suaHocSinh_SuaLop_DAO(hocsinh, lop);
 }
Пример #6
0
 public HocSinh[] layDanhSachHocSinh_DaCoLop_BUS(Lop lop)
 {
     return hocsinhDAO.layDanhSachHocSinh_DaCoLop_DAO(lop);
 }
Пример #7
0
 public bool themHocSinh_VaoLop_DAO(HocSinh hocsinh, Lop lop)
 {
     bool kiemtra_soluonghs = kiemTraSoLuongHocSinh_TrongMotLop(lop.MaLop);
     if (kiemtra_soluonghs == true)
     {
         string nameProc_ThemHocSinh_VaoLop = "sp_themHocSinh_VaoLop";
         SqlParameter para1 = new SqlParameter("@maHocSinh", hocsinh.MaHocSinh);
         SqlParameter para2 = new SqlParameter("@maLop", lop.MaLop);
         int ketqua = DataProvider.executeStoreProcedureNonQuery(nameProc_ThemHocSinh_VaoLop, para1, para2);
         if (ketqua != 0)
         {
             return true;
         }
         return false;
     }
     else
     {
         return false;
     }
 }
Пример #8
0
 public bool suaHocSinh_SuaLop_DAO(HocSinh hocsinh, Lop lop)
 {
     string nameProc_SuaHocSinh_SuaLop = "sp_suaHocSinh_SuaLop";
     SqlParameter para1 = new SqlParameter("@maHocSinh", hocsinh.MaHocSinh);
     SqlParameter para2 = new SqlParameter("@maLop", lop.MaLop);
     int ketqua = DataProvider.executeStoreProcedureNonQuery(nameProc_SuaHocSinh_SuaLop, para1, para2);
     if (ketqua != 0)
     {
         return true;
     }
     return false;
 }
Пример #9
0
        private void frmTraCuu_Load(object sender, EventArgs e)
        {
            Lop[] dsLop = lop.layDanhSachLop_BUS();
            Lop[] dsNew = new Lop[dsLop.Length+1];
            Lop lop_all = new Lop();
            lop_all.TenLop = "All";
            dsNew[0] = lop_all;
            for (int i = 1; i < dsNew.Length; i++)
            {
                dsNew[i] = dsLop[i - 1];
            }
            comboLop.Tag = dsNew;
            comboLop.DataSource = dsNew;
            comboLop.DisplayMember = "tenLop";
            comboLop.ValueMember = "maLop";

            //------------------Lấy danh sách học sinh
            HocSinh[] dsHocSinh = hocsinh.layDanhSachHocSinh_BUS();
            comboHoTen.Tag = dsHocSinh;
            comboHoTen.DataSource = dsHocSinh;
            comboHoTen.DisplayMember = "hoTen";
            comboHoTen.SelectedIndex = -1;
        }
Пример #10
0
 private Lop GetDataFromDataRow(DataTable dt, int i)
 {
     Lop lop = new Lop();
     lop.MaGV_ChuNhiem = Convert.ToInt32(dt.Rows[i]["maGV_ChuNhiem"].ToString());
     lop.MaLop = Convert.ToInt32(dt.Rows[i]["maLop"].ToString());
     lop.MaKHoi = Convert.ToInt32(dt.Rows[i]["maKhoi"].ToString());
     lop.TenLop = dt.Rows[i]["tenLop"].ToString();
     lop.SiSo =Convert.ToInt32(dt.Rows[i]["siSo"].ToString());
     return lop;
 }
Пример #11
0
 protected override object createObjectFromDatarow(DataRow row)
 {
     //throw new NotImplementedException();
     Lop lop = new Lop();
     lop.MaGV_ChuNhiem = Convert.ToInt32(row["maGV_ChuNhiem"].ToString());
     lop.MaLop = Convert.ToInt32(row["maLop"].ToString());
     lop.MaKHoi = Convert.ToInt32(row["maKhoi"].ToString());
     lop.TenLop = row["tenLop"].ToString();
     lop.SiSo = Convert.ToInt32(row["siSo"].ToString());
     return lop;
 }