Example #1
0
        public JsonResult dsMon()
        {
            var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin];
            List <Modell.MonHoc> monHocs = new MonHocDao().lisALL(session.TaiKhoan1);

            try
            {
                var dsNganh = (from n in monHocs
                               where n.TrangThai == true
                               select new
                {
                    MaNganh = n.Ma_Mon,
                    TenNganh = n.TenMon,
                    trangThai = n.CheDo,
                }).ToList();



                return(Json(new { code = 200, dsNganh = dsNganh, msg = "Lấy danh sách thành công" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { code = 500, msg = "Không thành công" + e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
        // GET: Admin/Admin
        public ActionResult Index()
        {
            var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin];
            List <Modell.MonHoc> monHocs = new MonHocDao().lisALL(session.TaiKhoan1);

            return(View(monHocs));
        }
        public ActionResult ChuongHoc(string id)
        {
            bool check   = true;
            var  session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin];

            Session[ComMon.ComMonStants.Cauhoi] = null;
            if (session.ChưcVu.Equals("BoMon"))
            {
                check = false;
            }
            ViewBag.id    = id;
            ViewBag.check = check;
            reseach();
            List <Chuong_Hoc> chuong_Hocs = new MonHocDao().ListChapterStudy(long.Parse(id));

            return(View(chuong_Hocs));
        }
Example #4
0
        private void loadSubject()
        {
            MonHocDao subjectDao = new MonHocDao();
            DataTable table      = subjectDao.LayDSMonHoc();

            List <string> subjectNames = new List <string>();
            List <string> subjectCodes = new List <string>();

            cbSubject.Items.Clear();

            foreach (DataRow row in table.Rows)
            {
                string name = row["TenMonHoc"].ToString();
                string code = row["MaMonHoc"].ToString();

                cbSubject.Items.Add(name);

                subjectNames.Add(name);
                subjectCodes.Add(code);
            }
        }
Example #5
0
        public JsonResult dsChuong(string ma)
        {
            try
            {
                var session = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin];
                var mon     = new MonHocDao().ListChapterStudy(long.Parse(ma));

                var dsNganh = (from n in mon
                               select new
                {
                    Ma = n.Ma_Chuong,
                    Ten = n.TenChuong,
                    SoCau = n.Kho_CauHoi.Where(x => x.NguoiTao.Equals(session.TaiKhoan1) && x.Xoa == true).ToList().Count
                }).ToList();

                return(Json(new { code = 200, dsNganh = dsNganh, msg = "Lấy danh sách thành công" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { code = 500, msg = "Không thành công" + e.Message }, JsonRequestBehavior.AllowGet));
            }
        }