public List<Truong> GetTruong()
 {
     string sql = @"SELECT* FROM TRUONG";
     List<Truong> list = new List<Truong>();
     var dataTable = dataProvider.ExecuteQuery(sql);
     foreach (DataRow row in dataTable.Rows)
     {
         Truong truong = new Truong();
         truong.MaTruong = row["MaTruong"].ToString();
         truong.TenTruong = row["TenTruong"].ToString();
         truong.LoaiTruong = row["LoaiTruong"].ToString();
         list.Add(truong);
     }
     return list;
 }
Пример #2
0
        public List <Truong> GetTruong()
        {
            string        sql       = @"SELECT* FROM TRUONG";
            List <Truong> list      = new List <Truong>();
            var           dataTable = dataProvider.ExecuteQuery(sql);

            foreach (DataRow row in dataTable.Rows)
            {
                Truong truong = new Truong();
                truong.MaTruong   = row["MaTruong"].ToString();
                truong.TenTruong  = row["TenTruong"].ToString();
                truong.LoaiTruong = row["LoaiTruong"].ToString();
                list.Add(truong);
            }
            return(list);
        }
 public List<Truong> GetTruongByName(Truong truong)
 {
     string matruong = truong.MaTruong;
     string tentruong = truong.TenTruong;
     string loaitruong = truong.LoaiTruong;
     string sql =  string.Format("SELECT* FROM TRUONG WHERE TENTRUONG = N'{0}' OR MATRUONG ='{1}' OR LOAITRUONG = N'{2}'", tentruong, matruong, loaitruong);
     List<Truong> list = new List<Truong>();
     var dataTable = dataProvider.ExecuteQuery(sql);
     foreach (DataRow row in dataTable.Rows)
     {
         Truong truongDh = new Truong();
         truongDh.MaTruong = row["MaTruong"].ToString();
         truongDh.TenTruong = row["TenTruong"].ToString();
         truongDh.LoaiTruong = row["LoaiTruong"].ToString();
         list.Add(truongDh);
     }
     return list;
 }
Пример #4
0
        public List <Truong> GetTruongByName(Truong truong)
        {
            string        matruong   = truong.MaTruong;
            string        tentruong  = truong.TenTruong;
            string        loaitruong = truong.LoaiTruong;
            string        sql        = string.Format("SELECT* FROM TRUONG WHERE TENTRUONG = N'{0}' OR MATRUONG ='{1}' OR LOAITRUONG = N'{2}'", tentruong, matruong, loaitruong);
            List <Truong> list       = new List <Truong>();
            var           dataTable  = dataProvider.ExecuteQuery(sql);

            foreach (DataRow row in dataTable.Rows)
            {
                Truong truongDh = new Truong();
                truongDh.MaTruong   = row["MaTruong"].ToString();
                truongDh.TenTruong  = row["TenTruong"].ToString();
                truongDh.LoaiTruong = row["LoaiTruong"].ToString();
                list.Add(truongDh);
            }
            return(list);
        }
 public ActionResult Index(Truong truong)
 {
     return View(truongHelper.GetTruongByName(truong));
 }