Пример #1
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();
        }
Пример #2
0
 public ActionResult Sua(int lop, string namHoc)
 {
     G9Service.G9_Service sv = new G9Service.G9_Service();
     string temp = "";
     ThoiKhoaBieu tkb = sv.GetTKBFromLop(lop, namHoc);
     Lop oLop = sv.GetLopFromTKB(tkb.MaTKB);
     bool flagSang = oLop.CaHoc.Equals("Sáng");
     int tietDau = Int32.Parse(ConfigurationManager.AppSettings["TongSoTietSang"]);
     int tietCuoi = Int32.Parse(ConfigurationManager.AppSettings["TongSoTietChieu"]) + tietDau;
     ViewData["TenLop"] = oLop.TenLop;
     temp += "<div id=\"div" + oLop.MaLop + "\" class=\"divTKB user-tlb\">";
     temp += "<div><a href='Sua?lop=" + oLop.MaLop + "&namHoc=" + namHoc + "'>" + oLop.TenLop + "</a></div>";
     temp += "<div>Tổng số môn: $TongSoMon</div>";
     temp += "<div>Số môn chưa xếp: $TongSoConLai</div>";
     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 <= tietDau; 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 + "' " + (flagSang ? "onclick='LoadChiTietTKBInfo(\"$" + tkb.MaTKB + i + j + "$\"," + i + "," + j + ")'" : "style='background-color:#bbb;'") + ">&" + tkb.MaTKB + i + j + "&</li>";
         }
         temp += "       <li class='cn'" + (flagSang ? "onclick='LoadChiTietTKBInfo(\"$" + tkb.MaTKB + 8 + j + "$\"," + 8 + "," + j + ")'" : "style='background-color:#bbb;'") + ">&" + tkb.MaTKB + '8' + j + "&</li>";
         temp += "       </ul>";
         temp += "   </li>";
     }
     for (int j = tietDau + 1; j <= tietCuoi; 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 + "'" + (!flagSang ? "onclick='LoadChiTietTKBInfo(\"$" + tkb.MaTKB + i + j + "$\"," + i + "," + j + ")'" : "style='background-color:#bbb;'") + ">&" + tkb.MaTKB + i + j + "&</li>";
         }
         temp += "       <li class='cn'" + (!flagSang ? "onclick='LoadChiTietTKBInfo(\"$" + tkb.MaTKB + 8 + j + "$\"," + 8 + "," + j + ")'" : "style='background-color:#bbb;'") + ">&" + tkb.MaTKB + '8' + j + "&</li>";
         temp += "       </ul>";
         temp += "   </li>";
     }
     temp += "</ul>";
     temp += "</div>";
     ChiTietTKB[] chiTiets = sv.GetDanhSachChiTietTKB(tkb.MaTKB);
     int tongSoMon = 0;
     string soMonConLai = "";
     List<MonHoc> lstMonHoc = sv.GetDanhSachMonHoc().ToList();
     List<MonHoc> lstTemp = new List<MonHoc>();
     foreach (ChiTietTKB chiTiet in chiTiets)
     {
         ChiTietTKB oChiTiet = sv.GetChiTietTKB(chiTiet.MaChiTietTKB);
         MonHoc mh = sv.GetMonHocFromTKB(oChiTiet.MaChiTietTKB);
         GiaoVien gv = sv.GetGiaoVienFromTKB(oChiTiet.MaChiTietTKB);
         Phong phong = sv.GetPhongFromTKB(oChiTiet.MaChiTietTKB);
         string inputContent = "<input id='hdn" + chiTiet.MaChiTietTKB + "' type='hidden' value='" + oChiTiet.Thu + "|" + oChiTiet.TietBatDau + "|" + mh.MaMonHoc + "|" + mh.TenMonHoc + "|" + gv.MaGiaoVien + "|" + gv.TenGiaoVien + "|" + phong.MaPhong + "|" + phong.TenPhong + "'/>";
         temp = temp.Replace(String.Format("&{0}{1}{2}&", tkb.MaTKB, oChiTiet.Thu, oChiTiet.TietBatDau), mh.TenMonHoc + inputContent);
         temp = temp.Replace(String.Format("${0}{1}{2}$", tkb.MaTKB, oChiTiet.Thu, oChiTiet.TietBatDau), chiTiet.MaChiTietTKB.ToString());
         foreach (var mhoc in lstMonHoc)
         {
             if (mhoc.MaMonHoc == mh.MaMonHoc)
             {
                 tongSoMon++;
                 lstTemp.Add(mhoc);
             }
         }
     }
     foreach (var mhoc in lstMonHoc)
     {
         if (!lstTemp.Contains(mhoc))
         {
             soMonConLai += mhoc.TenMonHoc + ",";
         }
     }
     temp = temp.Replace("$TongSoMon", tongSoMon.ToString());
     if (soMonConLai.Length > 0)
     {
         temp = temp.Replace("$TongSoConLai", soMonConLai.Substring(0, soMonConLai.Length - 1));
     }
     else
     {
         temp = temp.Replace("$TongSoConLai", "Không có");
     }
     for (int j = 1; j < 13; j++)
     {
         for (int i = 2; i <= 8; i++)
         {
             temp = temp.Replace(String.Format("&{0}{1}{2}&", tkb.MaTKB, i, j), "&nbsp;");
             temp = temp.Replace(String.Format("${0}{1}{2}$", tkb.MaTKB, i, j), tkb.MaTKB.ToString());
         }
     }
     ViewData["TKB"] = temp;
     return View();
 }