Exemple #1
0
 public List <SV_LH> GetSV_LH(string sql)
 {
     try
     {
         SqlDataReader dr   = dp.ExecReader(sql);
         List <SV_LH>  list = new List <SV_LH>();
         int           masv;
         string        malh;
         double        diemgk, diemck;
         while (dr.Read())
         {
             masv   = dr.GetInt32(0);
             malh   = dr.GetString(1);
             diemgk = dr.GetDouble(2);
             diemck = dr.GetDouble(3);
             SV_LH slh = new SV_LH(masv, malh, diemgk, diemck);
             list.Add(slh);
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dp.disCon();
     }
 }
Exemple #2
0
 public List <SinhVien> getStudent1(string sql)
 {
     try
     {
         SqlDataReader   dr   = dp.ExecReader(sql);
         List <SinhVien> list = new List <SinhVien>();
         int             id;
         string          LName, FName, phone, address, sex, email, facity;
         while (dr.Read())
         {
             id      = dr.GetInt32(0);
             LName   = dr.GetString(1);
             FName   = dr.GetString(2);
             phone   = dr.GetString(3);
             address = dr.GetString(4);
             sex     = dr.GetString(5);
             email   = dr.GetString(6);
             facity  = dr.GetString(7);
             SinhVien sv = new SinhVien(id, LName, FName, phone, address, sex, email, facity);
             list.Add(sv);
         }
         return(list);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         dp.disCon();
     }
 }
Exemple #3
0
        public List <HienThi> getHienThi(int MaHK, string MaBan, string MaNganh, int TinhTrang)
        {
            string sql = string.Format(@"select LopHoc.MaLop, MonHoc.MaMH, TenMH, SoTinChi
                            from LopHoc, MonHoc
                            where LopHoc.MaMH = MonHoc.MaMH                            
                            and MaHK = {0}", MaHK.ToString(), TinhTrang.ToString());

            if (MaBan != null)
            {
                sql += String.Format(@" and LopHoc.MaLop like N'{0}'", MaBan);
            }
            else
            {
                sql += " and null is null";
            }
            if (MaNganh != null)
            {
                sql += String.Format(@" and MaNganh = N'{0}'", MaNganh);
            }
            else
            {
                sql += " and null is null ";
            }
            if (TinhTrang != 0)
            {
                sql += String.Format(@" and TinhTrang = {0}", TinhTrang.ToString());
            }
            sql += @" group by  LopHoc.MaLop, MonHoc.MaMH, TenMH, SoTinChi";
            try
            {
                SqlDataReader  dr   = dp.ExecReader(sql);
                List <HienThi> list = new List <HienThi>();

                string MaLop, MaMH, TenMH, STC;
                while (dr.Read())
                {
                    MaLop = dr.GetString(0);
                    MaMH  = dr.GetString(1);
                    TenMH = dr.GetString(2);
                    STC   = dr.GetString(3);
                    HienThi ht = new HienThi(MaLop, MaMH, TenMH, STC);
                    list.Add(ht);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally{ dp.disCon(); }
        }
Exemple #4
0
        public List <MonHoc> GetMH(string sql)
        {
            try
            {
                SqlDataReader dr = dp.ExecReader(sql);
                List <MonHoc> list = new List <MonHoc>();
                string        mamh, tenmh, sotinchi, sotiet, manganh;
                while (dr.Read())
                {
                    mamh     = dr.GetString(0);
                    tenmh    = dr.GetString(1);
                    sotinchi = dr.GetString(2);
                    sotiet   = dr.GetString(3);
                    manganh  = dr.GetString(4);

                    MonHoc mh = new MonHoc(mamh, tenmh, sotinchi, sotiet, manganh);
                    list.Add(mh);
                }
                return(list);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                dp.disCon();
            }
        }
Exemple #5
0
        public List <LopHoc> GetLH(string sql)
        {
            try
            {
                SqlDataReader dr = dp.ExecReader(sql);
                List <LopHoc> list = new List <LopHoc>();
                string        malh, mamh1;
                DateTime      tgbd, tgkt;
                int           mahk, tinhtrang;
                while (dr.Read())
                {
                    malh      = dr.GetString(0);
                    mamh1     = dr.GetString(1);
                    mahk      = dr.GetInt32(2);
                    tgbd      = dr.GetDateTime(3);
                    tgkt      = dr.GetDateTime(4);
                    tinhtrang = dr.GetInt32(5);

                    LopHoc lh = new LopHoc(malh, mamh1, mahk, tgbd, tgkt, tinhtrang);
                    list.Add(lh);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dp.disCon();
            }
        }
Exemple #6
0
        public List<GV_LH> GetGV_LH(string sql)
        {
            try
            {
                SqlDataReader dr = dp.ExecReader(sql);
                List<GV_LH> list = new List<GV_LH>();
                int magv;
                string lophoc;
      
                while (dr.Read())
                {
                    magv = dr.GetInt32(0);
                    lophoc = dr.GetString(1);
                    GV_LH gvlh = new GV_LH(magv,lophoc);
                    list.Add(gvlh);

                }
                return list;
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dp.disCon();
            }
        
        }
Exemple #7
0
        public List <SV_LH2> getSV_LH2(string sql)
        {
            try
            {
                SqlDataReader dr   = dp.ExecReader(sql);
                List <SV_LH2> list = new List <SV_LH2>();

                string tenmh;
                string malh;
                double diemgk, diemck;
                while (dr.Read())
                {
                    tenmh  = dr.GetString(1);
                    malh   = dr.GetString(0);
                    diemgk = dr.GetDouble(2);
                    diemck = dr.GetDouble(3);

                    SV_LH2 slh = new SV_LH2(malh, tenmh, diemgk, diemck);
                    list.Add(slh);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dp.disCon();
            }
        }
Exemple #8
0
 public List <Chuyennganh> getchuyennganh(string sql)
 {
     try
     {
         string             manganh, tennganh;
         List <Chuyennganh> list = new List <Chuyennganh>();
         SqlDataReader      dr   = dp.ExecReader(sql);
         while (dr.Read())
         {
             manganh  = dr.GetString(0);
             tennganh = dr.GetString(1);
             Chuyennganh cn = new Chuyennganh(manganh, tennganh);
             list.Add(cn);
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }