Example #1
0
        public ActionResult CapNhatLop()
        {
            if (!HttpContext.User.Identity.IsAuthenticated)
            {
                return RedirectToAction("DanhSachLop", "Lop");
            }
            if(HttpContext.Request["id"] == null || HttpContext.Request["id"].Equals(""))
                return RedirectToAction("DanhSachLop", "Lop");

            int id = Int32.Parse(HttpContext.Request["id"]);
            G9Service.G9_Service ws = new G9Service.G9_Service();
            G9Service.Lop lop = ws.GetLop(id);

            ViewData["MaLop"] = id;
            ViewData["TenLop"] = lop.TenLop;
            ViewData["Khoi"] = "";
            for(int i=10; i<=12; i++)
            {
                if(i == Int32.Parse(lop.KhoiLop))
                    ViewData["Khoi"] += "<option id='Option'" + i + " selected value='" + lop.KhoiLop + "' >" + lop.KhoiLop + "</option>";
                else
                    ViewData["Khoi"] += "<option id='Option'" + i + " value='" + lop.KhoiLop + "' >" + lop.KhoiLop + "</option>";
            }

            ViewData["CaHoc"] = "";
            if (lop.CaHoc.Equals("Sáng"))
            {
                ViewData["CaHoc"] += "<option id='Option' selected value='Sáng' >Sáng</option>";
                ViewData["CaHoc"] += "<option id='Option' value='Chiều' >Chiều</option>";
            }
            else
            {
                ViewData["CaHoc"] += "<option id='Option' value='Sáng' >Sáng</option>";
                ViewData["CaHoc"] += "<option id='Option' selected value='Chiều' >Chiều</option>";
            }

            ViewData["SiSo"] = lop.SiSo;
            ViewData["GhiChu"] = lop.GhiChu;

            return View();
        }
Example #2
0
 public ActionResult SapXep(string namHoc, List<int> lops)
 {
     // input
     G9Service.G9_Service sv = new G9Service.G9_Service();
     List<Lop> dsLop = new List<Lop>();
     if (lops != null)
     {
         foreach (var l in lops)
         {
             Lop lop = sv.GetLop(l);
             dsLop.Add(new Lop() { MaLop = lop.MaLop, SiSo = lop.SiSo, CaHoc = lop.CaHoc });
         }
         //ThoiKhoaBieu[] list = sv.GetTKB(namHoc);
         if (sv.CreateTKB(dsLop.ToArray(), namHoc))
         {
             ViewData["TKB"] = XemTKB(namHoc);
         }
         else
         {
             ViewData["TKB"] = "Lỗi phát sinh thời khóa biểu";
         }
     }
     return View();
 }
Example #3
0
        public ActionResult TaoMoi(int lop, string namHoc)
        {
            G9Service.G9_Service sv = new G9Service.G9_Service();
            if (sv.NewTKB(lop, namHoc))
            {
                string temp = "";
                ThoiKhoaBieu tkb = sv.GetTKBFromLop(lop, namHoc);
                Lop oLop = sv.GetLop(lop);
                ViewData["TenLop"] = oLop.TenLop;
                temp += "<div id=\"div" + oLop.MaLop + "\" class=\"divTKB user-tlb\">";
                temp += "<ul style='list-style: none;'>";
                temp += "					<li class='hder'>";
                temp += "						<ul style='list-style: none;'>";
                temp += "							<li class='tiet'>&nbsp;</li>";
                temp += "							<li class='t2'>Hai</li>";
                temp += "							<li class='t3'>Ba</li>";
                temp += "							<li class='t4'>Tư</li>";
                temp += "							<li class='t5'>Năm</li>";
                temp += "							<li class='t6'>Sáu</li>";
                temp += "							<li class='t7'>Bảy</li>";
                temp += "							<li class='cn'>CN</li>";
                temp += "						</ul>";
                temp += "					</li>";
                for (int j = 1; j < 13; j++)
                {
                    temp += "   <li>";
                    temp += "		<ul style='list-style: none;'>";
                    temp += "       <li class='tiet'>Tiết " + j + "</li>";
                    for (int i = 2; i < 8; i++)
                    {
                        temp += "       <li class='t" + i + "' onclick='NewTKB(" + tkb.MaTKB + "," + i + "," + j + ")'></li>";
                    }
                    temp += "       <li class='cn'onclick='NewTKB(" + tkb.MaTKB + "," + 8 + "," + j + "," + ")'></li>";
                    temp += "       </ul>";
                    temp += "   </li>";
                }

                temp += "</ul>";
                temp += "</div>";

                ViewData["TKB"] = temp;
            }
            else
            {
                ViewData["TKB"] = "Không tạo được TKB. Vui lòng thử lại sau";
            }
            return View();
        }