public ActionResult SapXep(bool auto) { string type = ""; if (auto) type = "checkbox"; else type = "radio"; G9Service.G9_Service sv = new G9Service.G9_Service(); string temp = ""; temp += "Năm học"; temp += "<select name=\"namHoc\" id='cbNamHoc'>"; for (int i = 0; i < 3; i++) { temp += "<option value=\"" + (DateTime.Now.Year + i) + "\">" + (DateTime.Now.Year + i) + "</option>"; } temp += "</select>"; temp += "<br />"; ViewData["NamHoc"] = temp; temp = "<fieldset>"; if (auto) temp += "<div><input type='checkbox' class='checkallLop'/>Chọn hết</div><br/>"; Lop[] dsLop = sv.GetDanhSachLop(); foreach (Lop l in dsLop) { temp += "<input type='" + type + "' value='" + l.MaLop + "' id='chkLop" + l.MaLop + "' name='lops'/>" + l.TenLop + "<br/>"; } temp += "</fieldset>"; temp += "<input type=\"submit\" value=\"Sắp xếp\" "+(auto ? "" : "onclick='RedirectTaoMoi();return false;'")+"/>"; ViewData["dsLop"] = temp; return View(); }
public ActionResult CapNhatGiaoVien() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachGiaoVien", "GiaoVien"); } if (HttpContext.Request["id"] == null || HttpContext.Request["id"].Equals("")) return RedirectToAction("DanhSachGiaoVien", "GiaoVien"); int id = Int32.Parse(HttpContext.Request["id"]); G9Service.G9_Service ws = new G9Service.G9_Service(); G9Service.GiaoVien gv = ws.GetGiaoVien(id); ViewData["MaGiaoVien"] = id; ViewData["TenGiaoVien"] = gv.TenGiaoVien; if (gv.GioiTinh.Equals("Nam")) { ViewData["GioiTinh"] += "<option id='Option' selected value='Nam' >Nam</option>"; ViewData["GioiTinh"] += "<option id='Option' value='Nữ' >Nữ</option>"; } else { ViewData["GioiTinh"] += "<option id='Option' value='Nam' >Nam</option>"; ViewData["GioiTinh"] += "<option id='Option' selected value='Nữ' >Nữ</option>"; } ViewData["DiaChi"] = gv.DiaChi; ViewData["DienThoai"] = gv.DienThoai; ViewData["Email"] = gv.Email; return View(); }
public ActionResult DanhSachLop() { G9Service.G9_Service sv = new G9Service.G9_Service(); G9Service.Lop[] list = sv.GetDanhSachLop(); if (list==null || list.Count()<=0) { ViewData["DSLop"] = "Không có lớp"; return View(); } string temp = ""; for (int j = 10; j <= 12; j++) { temp += "<h1 style='padding:10px 0px;'>KHỐI "+j+"</h1>"; temp += "<div class=\"user-tlb\">"; temp += " <ul style=\"list-style: none\">"; temp += " <li class=\"hder\">"; temp += " <ul>"; temp += " <li class=\"stt\">STT</li>"; temp += " <li class=\"account_name\">Lớp</li>"; temp += " <li class=\"user_type\">Khối</li>"; temp += " <li class=\"active\">Sỉ số</li>"; temp += " <li class=\"edit\">Thao tác</li>"; temp += " </ul>"; temp += " </li>"; int i = 1; foreach (G9Service.Lop lop in list) { if (lop.KhoiLop == j.ToString()) { temp += " <li class=\"li-atv fl\">"; temp += " <ul>"; temp += " <li class=\"stt\">" + i + "</li>"; temp += " <li class=\"account_name\">" + lop.TenLop + "</li>"; temp += " <li class=\"user_type\">" + lop.KhoiLop + "</li>"; temp += " <li class=\"active\">" + lop.SiSo + "</li>"; temp += " <li class=\"edit\"><div style='padding-left:20px;'><a href='" + Url.Content("~/Lop/CapNhatLop?id=" + lop.MaLop) + "'><div class='btnEdit'></div></a>"; temp += " <a href='" + Url.Content("~/Lop/XoaLop?id=" + lop.MaLop) + "'><div style='margin-left:5px;' class='btnXoa'></div></a></div></li>"; temp += " </ul>"; temp += " </li>"; i++; } } temp += "</ul>"; temp += "</div><br />"; } ViewData["DSLop"] = temp; return View(); }
public String changeGiaoVienCbb(String giaovien) { try { if (giaovien != null) { G9Service.G9_Service sv = new G9Service.G9_Service(); String temp = genTkb(sv.GetGiaoVien(Convert.ToInt32(giaovien)).TenTK); return temp; } return null; } catch { return null; } }
public ActionResult CapNhatPhongPost() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachPhong", "Phong"); } G9Service.Phong gv = new G9Service.Phong(); gv.MaPhong = Int32.Parse(HttpContext.Request["txtMaPhong"]); gv.TenPhong = HttpContext.Request["txtTenPhong"]; gv.TinhTrang = HttpContext.Request["txtTinhTrang"]; gv.SucChua = Int32.Parse(HttpContext.Request["txtSucChua"]); G9Service.G9_Service ws = new G9Service.G9_Service(); bool result = ws.CapNhatPhong(gv); return (result == true) ? RedirectToAction("DanhSachPhong", "Phong") : RedirectToAction("CapNhatPhong", "Phong"); }
public ActionResult DanhSachPhong() { G9Service.G9_Service sv = new G9Service.G9_Service(); G9Service.Phong[] list = sv.GetDanhSachPhong(); if (list == null || list.Count() <= 0) { ViewData["DSPhong"] = "Không có phòng"; return View(); } string temp = ""; temp += "<div class=\"user-tlb\">"; temp += " <ul style=\"list-style: none\">"; temp += " <li class=\"hder\">"; temp += " <ul>"; temp += " <li class=\"stt\">STT</li>"; temp += " <li class=\"account_name\">Tên phòng</li>"; temp += " <li class=\"user_type\">Tình trạng</li>"; temp += " <li class=\"active\">Sức chứa</li>"; temp += " <li class=\"edit\">Thao tác</li>"; temp += " </ul>"; temp += " </li>"; int i = 1; foreach (G9Service.Phong gv in list) { temp += " <li class=\"li-atv fl\">"; temp += " <ul>"; temp += " <li class=\"stt\">" + i + "</li>"; temp += " <li class=\"account_name\">" + gv.TenPhong + "</li>"; temp += " <li class=\"user_type\">" + gv.TinhTrang + "</li>"; temp += " <li class=\"active\">" + gv.SucChua + "</li>"; temp += " <li class=\"edit\"><div style='padding-left:20px;'><a href='" + Url.Content("~/Phong/CapNhatPhong?id=" + gv.MaPhong) + "'><div class='btnEdit'></div></a>"; temp += " <a href='" + Url.Content("~/Phong/XoaPhong?id=" + gv.MaPhong) + "'><div style='margin-left:5px;' class='btnXoa'></div></a></div></li>"; temp += " </ul>"; temp += " </li>"; i++; } temp += "</ul>"; temp += "</div><br />"; ViewData["DSPhong"] = temp; return View(); }
public ActionResult CapNhatLopPost() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachLop", "Lop"); } G9Service.Lop lop = new G9Service.Lop(); lop.MaLop = Int32.Parse(HttpContext.Request["txtMaLop"]); lop.TenLop = HttpContext.Request["txtTenLop"]; lop.KhoiLop = HttpContext.Request["cbKhoi"]; lop.CaHoc = HttpContext.Request["cbCaHoc"]; lop.SiSo = Int32.Parse(HttpContext.Request["txtSiSo"]); lop.GhiChu = HttpContext.Request["txtGhiChu"]; G9Service.G9_Service ws = new G9Service.G9_Service(); bool result = ws.CapNhatLop(lop); return (result == true) ? RedirectToAction("DanhSachLop", "Lop") : RedirectToAction("CapNhatLop", "Lop"); }
public ActionResult CapNhatGiaoVienPost() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachGiaoVien", "GiaoVien"); } G9Service.GiaoVien gv = new G9Service.GiaoVien(); gv.MaGiaoVien = Int32.Parse(HttpContext.Request["txtMaGiaoVien"]); gv.TenGiaoVien = HttpContext.Request["txtTenGiaoVien"]; gv.GioiTinh = HttpContext.Request["txtGioiTinh"]; gv.DiaChi = HttpContext.Request["txtDiaChi"]; gv.DienThoai = HttpContext.Request["txtDienThoai"]; gv.Email = HttpContext.Request["txtEmail"]; G9Service.G9_Service ws = new G9Service.G9_Service(); bool result = ws.CapNhatGiaoVien(gv); return (result == true) ? RedirectToAction("DanhSachGiaoVien", "GiaoVien") : RedirectToAction("CapNhatGiaoVien", "GiaoVien"); }
public ActionResult Lop() { //gv.MaGiaoVien = Int32.Parse(HttpContext.Request["txtMaGiaoVien"]); string namHoc = HttpContext.Request["namHoc"]; ViewData["Nam"] = namHoc; G9Service.G9_Service sv = new G9Service.G9_Service(); string temp = ""; temp += "Năm học"; temp += "<select name=\"namHoc\" id='cbNamHoc'>"; for (int i = 0; i < 3; i++) { temp += "<option value=\"" + (DateTime.Now.Year + i) + "\">" + (DateTime.Now.Year + i) + "</option>"; } temp += "</select>"; temp += ""; ViewData["NamHoc"] = temp; ViewData["TKB"] = XemTKB(namHoc); return View(); }
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(); }
public ActionResult CapNhatPhong() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachPhong", "Phong"); } if (HttpContext.Request["id"] == null || HttpContext.Request["id"].Equals("")) return RedirectToAction("DanhSachPhong", "Phong"); int id = Int32.Parse(HttpContext.Request["id"]); G9Service.G9_Service ws = new G9Service.G9_Service(); G9Service.Phong gv = ws.GetPhong(id); ViewData["MaPhong"] = id; ViewData["TenPhong"] = gv.TenPhong; ViewData["TinhTrang"] = gv.TinhTrang; ViewData["SucChua"] = gv.SucChua; return View(); }
public ActionResult Index() { if (HttpContext.User.Identity.IsAuthenticated) { return View("Index"); } string user = HttpContext.Request["txtUser"]; if (user == null || user == "") return View(); string password = HttpContext.Request["txtPwd"]; password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5"); G9Service.G9_Service sv = new G9Service.G9_Service(); bool result = sv.KiemTraDangNhap(user, password); if (result) { FormsAuthentication.SetAuthCookie(user, false); RedirectToAction("Index", "Home"); } return View(); }
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(); }
public ActionResult DanhSachGiaoVien() { G9Service.G9_Service sv = new G9Service.G9_Service(); G9Service.GiaoVien[] list = sv.GetDanhSachGiaoVien(); if (list == null || list.Count() <= 0) { ViewData["DSGiaoVien"] = "Không có giáo viên"; return View(); } string temp = ""; temp += "<div class=\"user-tlb\">"; temp += " <ul style=\"list-style: none\">"; temp += " <li class=\"hder\">"; temp += " <ul>"; temp += " <li class=\"stt\">STT</li>"; temp += " <li class=\"account_name\">Họ tên</li>"; temp += " <li class=\"user_type\">Giới tính</li>"; temp += " <li class=\"active\">Ngày sinh</li>"; temp += " <li class=\"edit\">Thao tác</li>"; temp += " </ul>"; temp += " </li>"; int i = 1; foreach (G9Service.GiaoVien gv in list) { temp += " <li class=\"li-atv fl\">"; temp += " <ul>"; temp += " <li class=\"stt\">" + i + "</li>"; temp += " <li class=\"account_name\">" + gv.TenGiaoVien + "</li>"; temp += " <li class=\"user_type\">" + gv.GioiTinh + "</li>"; temp += " <li class=\"active\">" + gv.NgaySinh + "</li>"; temp += " <li class=\"edit\"><div style='padding-left:20px;'><a href='" + Url.Content("~/GiaoVien/CapNhatGiaoVien?id=" + gv.MaGiaoVien) + "'><div class='btnEdit'></div></a>"; temp += " <a href='" + Url.Content("~/GiaoVien/XoaGiaoVien?id=" + gv.MaGiaoVien) + "'><div style='margin-left:5px;' class='btnXoa'></div></a></div></li>"; temp += " </ul>"; temp += " </li>"; i++; } temp += "</ul>"; temp += "</div><br />"; ViewData["DSGiaoVien"] = temp; return View(); }
private string XemTKB(string namHoc) { G9Service.G9_Service sv = new G9Service.G9_Service(); string temp = ""; ThoiKhoaBieu[] list = sv.GetTKB(namHoc); if (list == null || list.Count() <= 0) { return "Chưa có thời khóa biểu"; } string strLop = ""; foreach (ThoiKhoaBieu tkb in list) { Lop lop = sv.GetLopFromTKB(tkb.MaTKB); strLop += " | <span id=\"span" + lop.MaLop + "\" onClick='Show(\"div" + lop.MaLop + "\")' class='menuLop'>" + lop.TenLop + "</span>"; temp += "<div id=\"div" + lop.MaLop + "\" class=\"divTKB\">"; temp += "<div><a href='Sua?lop=" + lop.MaLop + "&namHoc=" + namHoc + "'>" + lop.TenLop + "</a></div>"; temp += "<div>Tổng số môn: $TongSoMon</div>"; temp += "<div>Số môn chưa xếp: $TongSoConLai</div>"; temp += " <table>"; temp += " <tr>"; temp += " <th></th>"; temp += " <th>Hai</th>"; temp += " <th>Ba</th>"; temp += " <th>Tư</th>"; temp += " <th>Năm</th>"; temp += " <th>Sáu</th>"; temp += " <th>Bảy</th>"; temp += " <th>Chủ nhật</th>"; temp += " </tr>"; for (int j = 1; j < 13; j++) { temp += " <tr>"; temp += " <td>Tiết " + j + "</td>"; for (int i = 2; i <= 8; i++) { temp += " <td>&" + tkb.MaTKB + i + j + "&</td>"; } temp += " </tr>"; } temp += "</table>"; 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); temp = temp.Replace(String.Format("&{0}{1}{2}&", tkb.MaTKB, oChiTiet.Thu, oChiTiet.TietBatDau), mh.TenMonHoc + "<br/>" + gv.TenGiaoVien); 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), ""); } } } ViewData["menuLop"] = strLop; return temp; }
public ActionResult ThemGiaoVien() { G9Service.G9_Service ws = new G9Service.G9_Service(); G9Service.MonHoc[] mh = ws.GetDanhSachMonHoc(); ViewData["DSMonHoc"] = ""; foreach (MonHoc monHoc in mh) { ViewData["DSMonHoc"] += "<option id='Option' value='" + monHoc.MaMonHoc + "' >" + monHoc.TenMonHoc + "</option>"; } ViewData["DSGiaoVien"] = ""; return View(); }
public ActionResult XemThoiKhoaBieuGiaoVien(String giaovien) { try { String tmp = "<select id='cbbGiaoVien'>{0}</select>"; G9Service.G9_Service sv = new G9Service.G9_Service(); var lst = sv.GetDanhSachGiaoVien(); String tmpItem = ""; foreach (var cur in lst) { String item = "<option value='{0}'>{1}</option>"; item = String.Format(item, cur.MaGiaoVien, cur.TenGiaoVien); tmpItem += item; } tmp = String.Format(tmp, tmpItem); ViewData["strCbbGiaoVien"] = tmp; return View(); } catch { return View("Error"); } }
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'> </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(); }
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'> </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), " "); temp = temp.Replace(String.Format("${0}{1}{2}$", tkb.MaTKB, i, j), tkb.MaTKB.ToString()); } } ViewData["TKB"] = temp; return View(); }
private static string genTkb(String gv) { G9Service.G9_Service sv = new G9Service.G9_Service(); var list = sv.getListTKBByGiaoVien(gv); string temp = ""; temp += " <table>"; temp += " <tr>"; temp += " <th></th>"; temp += " <th>Hai</th>"; temp += " <th>Ba</th>"; temp += " <th>Tư</th>"; temp += " <th>Năm</th>"; temp += " <th>Sáu</th>"; temp += " <th>Bảy</th>"; temp += " <th>Chủ nhật</th>"; temp += " </tr>"; for (int j = 1; j < 13; j++) { temp += " <tr>"; temp += " <td>Tiết " + j + "</td>"; for (int i = 2; i < 9; i++) { temp += " <td>&" + i + "&" + j + "&</td>";//tkb.MaTKB + } temp += " </tr>"; } temp += "</table>"; if (list == null || list.Count() == 0) { for (int j = 1; j < 13; j++) { for (int i = 2; i < 9; i++) { temp = temp.Replace("&" + i + "&" + j + "&", ""); } } } else foreach (var cur in list) { String checkin = ""; String tenLop = ""; if (sv.getLopByMaChiTietTKB(cur.MaChiTietTKB) != null) tenLop = sv.getLopByMaChiTietTKB(cur.MaChiTietTKB).TenLop; String tenphong = ""; if (sv.getPhongByMaChiTietTKB(cur.MaChiTietTKB) != null) tenphong = sv.getPhongByMaChiTietTKB(cur.MaChiTietTKB).TenPhong; checkin = tenLop + "/" + tenphong; temp = temp.Replace("&" + cur.Thu + "&" + cur.TietBatDau + "&", checkin); } for (int j = 1; j < 13; j++) { for (int i = 2; i < 9; i++) { temp = temp.Replace("&" + i + "&" + j + "&", ""); } } return temp; }
public ActionResult XoaPhong() { if (!HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("DanhSachPhong", "Phong"); } if (HttpContext.Request["id"] == null || HttpContext.Request["id"].Equals("")) return RedirectToAction("DanhSachPhong", "Phong"); int id = Int32.Parse(HttpContext.Request["id"]); G9Service.G9_Service ws = new G9Service.G9_Service(); bool result = ws.XoaPhong(id); return RedirectToAction("DanhSachPhong", "Phong"); }