Exemplo n.º 1
0
        // GET: HOCKies/Create
        public ActionResult Create()
        {
            HOCKY obj = new HOCKY();

            obj.HK_MA = CreateID.CreateID_ByteText();
            return(View(obj));
        }
Exemplo n.º 2
0
 // Lấy hệ số
 public static int layHeSo(string maHK)
 {
     using (SQL_QLHSDataContext db = new SQL_QLHSDataContext())
     {
         HOCKY hk = db.HOCKies.Where(a => a.MAHK == maHK).FirstOrDefault();
         return(hk.HESO.Value);
     }
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(string id)
        {
            HOCKY hOCKY = db.HOCKies.Find(id);

            db.HOCKies.Remove(hOCKY);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 // Sửa hệ số học kỳ
 public static void Update(string maHK, int heSo)
 {
     using (SQL_QLHSDataContext db = new SQL_QLHSDataContext())
     {
         HOCKY hk = db.HOCKies.Where(a => a.MAHK == maHK).FirstOrDefault();
         hk.HESO = heSo;
         db.SubmitChanges();
     }
 }
Exemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "HK_MA,HK_TEN")] HOCKY hOCKY)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hOCKY).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hOCKY));
 }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "HK_MA,HK_TEN")] HOCKY hOCKY)
        {
            if (ModelState.IsValid)
            {
                db.HOCKies.Add(hOCKY);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hOCKY));
        }
Exemplo n.º 7
0
        // GET: HOCKies/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HOCKY hOCKY = db.HOCKies.Find(id);

            if (hOCKY == null)
            {
                return(HttpNotFound());
            }
            return(View(hOCKY));
        }
Exemplo n.º 8
0
        public List <HOCKY> GetAll()
        {
            List <HOCKY> hockys = new List <HOCKY>();
            string       query  = "SELECT * FROM HOCKY";
            DataTable    data   = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                int      HocKy       = (int)item["HocKy"];
                string   NienKhoa    = item["NienHoc"].ToString();
                DateTime?NgayBatDau  = item["NgayBatDau"].ToString() == string.Empty ? null : (DateTime?)item["NgayBatDau"];
                DateTime?NgayKatThuc = item["NgayKetThuc"].ToString() == string.Empty ? null : (DateTime?)item["NgayKetThuc"];

                HOCKY HK = new HOCKY(HocKy, NienKhoa, NgayBatDau, NgayKatThuc);
                hockys.Add(HK);
            }

            return(hockys);
        }
Exemplo n.º 9
0
        // Lấy tất cả các học kỳ
        public static List <HOCKY> LayTatCaHocKy()
        {
            List <HOCKY> lst = new List <HOCKY>();

            using (SQL_QLHSDataContext db = new SQL_QLHSDataContext())
            {
                var ds = db.HOCKies.ToList();
                foreach (var x in ds)
                {
                    HOCKY hocKy = new HOCKY();
                    {
                        hocKy.MAHK     = x.MAHK;
                        hocKy.TENHOCKY = x.TENHOCKY;
                        hocKy.HESO     = x.HESO;
                        lst.Add(hocKy);
                    }
                }
            }
            return(lst);
        }