protected void btnDangNhap_Click(object sender, EventArgs e) { string strTen = txtTen.Text.Trim(); string strMatKhau = txtMauKhau.Text.Trim(); if (strTen.Equals("")) { tdAnnounce.InnerHtml = "Không được để tên trắng"; return; } if (strMatKhau.Equals("")) { tdAnnounce.InnerHtml = "Không được mật khẩu trắng"; return; } DataTable dtData = data.dnn_NuceCommon_SinhVien.dangnhap(strTen, strMatKhau); if (dtData.Rows.Count > 0) { model.SinhVien SinhVien = new model.SinhVien(); SinhVien.Ho = dtData.Rows[0]["Ho"].ToString(); SinhVien.Ten = dtData.Rows[0]["Ten"].ToString(); SinhVien.MaSV = dtData.Rows[0]["MaSV"].ToString(); SinhVien.TrangThai = int.Parse(dtData.Rows[0]["Status"].ToString()); SinhVien.SinhVienID = int.Parse(dtData.Rows[0]["SinhVienID"].ToString()); Session[Utils.session_sinhvien] = SinhVien; #region KiThiLopHocSinhVien DataTable dtKiThiLopHocSinhVien = data.dnn_NuceThi_KiThi_LopHoc_SinhVien.getBySinhVien(SinhVien.SinhVienID); if (dtKiThiLopHocSinhVien.Rows.Count > 0) { int iLenghKiThiLopHocSinhVien = dtKiThiLopHocSinhVien.Rows.Count; Dictionary <int, model.KiThiLopHocSinhVien> KiThiLopHocSinhViens = new Dictionary <int, model.KiThiLopHocSinhVien>(); for (int i = 0; i < iLenghKiThiLopHocSinhVien; i++) { model.KiThiLopHocSinhVien KiThiLopHocSinhVien = new model.KiThiLopHocSinhVien(); KiThiLopHocSinhVien.BoDeID = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["BoDeID"].ToString()); KiThiLopHocSinhVien.DeThiID = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["DeThiID"].ToString()); KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["KiThi_LopHoc_SinhVienID"].ToString()); KiThiLopHocSinhVien.Status = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["Status"].ToString()); KiThiLopHocSinhVien.LoaiKiThi = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["LoaiKiThi"].ToString()); KiThiLopHocSinhVien.TenBlockHoc = dtKiThiLopHocSinhVien.Rows[i]["TenBlockHoc"].ToString(); KiThiLopHocSinhVien.TenKiThi = dtKiThiLopHocSinhVien.Rows[i]["TenKiThi"].ToString(); KiThiLopHocSinhVien.TenMonHoc = dtKiThiLopHocSinhVien.Rows[i]["TenMonHoc"].ToString(); KiThiLopHocSinhVien.NoiDungDeThi = dtKiThiLopHocSinhVien.Rows[i]["NoiDungDeThi"].ToString(); KiThiLopHocSinhVien.DapAn = dtKiThiLopHocSinhVien.Rows[i]["DapAn"].ToString(); KiThiLopHocSinhVien.Diem = float.Parse(dtKiThiLopHocSinhVien.Rows[i]["Diem"].ToString()); KiThiLopHocSinhVien.BaiLam = dtKiThiLopHocSinhVien.Rows[i]["BaiLam"].ToString(); KiThiLopHocSinhVien.MaDe = dtKiThiLopHocSinhVien.Rows[i].IsNull("MaDe") ? "" : dtKiThiLopHocSinhVien.Rows[i]["MaDe"].ToString(); KiThiLopHocSinhVien.NgayGioBatDau = dtKiThiLopHocSinhVien.Rows[i].IsNull("NgayGioBatDau") ? DateTime.Now : DateTime.Parse(dtKiThiLopHocSinhVien.Rows[i]["NgayGioBatDau"].ToString()); if (KiThiLopHocSinhVien.Status.Equals(5) || KiThiLopHocSinhVien.Status.Equals(4)) { KiThiLopHocSinhVien.TongThoiGianConLai = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["TongThoiGianConLai"].ToString()); KiThiLopHocSinhVien.TongThoiGianThi = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["TongThoiGianThi"].ToString()); if (KiThiLopHocSinhVien.Status.Equals(4)) { KiThiLopHocSinhVien.Mota = string.Format("<div style='width: 80%;text-align: center;font-weight: bold;font-size: 20px;color: red;padding-top: 20px;'>Bài thi được {0:N2} điểm</div>", float.Parse(dtKiThiLopHocSinhVien.Rows[i]["Diem"].ToString())); } //KiThiLopHocSinhVien.Mota = string.Format("Bài thi được {0:N2} điểm", float.Parse(dtKiThiLopHocSinhVien.Rows[i]["Diem"].ToString())); } else { KiThiLopHocSinhVien.TongThoiGianConLai = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["ThoiGianThi"].ToString()) * 60; KiThiLopHocSinhVien.TongThoiGianThi = int.Parse(dtKiThiLopHocSinhVien.Rows[i]["ThoiGianThi"].ToString()); } KiThiLopHocSinhViens.Add(KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien, KiThiLopHocSinhVien); } Session[Utils.session_kithi_lophoc_sinhvien] = KiThiLopHocSinhViens; } #endregion #region CaLopHocSinhVien DataTable dtCaLopHocSinhVien = data.dnn_NuceQLHPM_Ca_LopHoc_SinhVien.getBySinhVien(SinhVien.SinhVienID); if (dtCaLopHocSinhVien.Rows.Count > 0) { int iLenghCaLopHocSinhVien = dtCaLopHocSinhVien.Rows.Count; Dictionary <int, model.CaLopHocSinhVien> CaLopHocSinhViens = new Dictionary <int, model.CaLopHocSinhVien>(); for (int i = 0; i < iLenghCaLopHocSinhVien; i++) { model.CaLopHocSinhVien CaLopHocSinhVien = new model.CaLopHocSinhVien(); CaLopHocSinhVien.Ca_LopHoc_SinhVienID = int.Parse(dtCaLopHocSinhVien.Rows[i]["Ca_LopHoc_SinhVienID"].ToString()); CaLopHocSinhVien.Ca_LopHocID = int.Parse(dtCaLopHocSinhVien.Rows[i]["Ca_LopHocID"].ToString()); CaLopHocSinhVien.SinhVienID = int.Parse(dtCaLopHocSinhVien.Rows[i]["SinhVienID"].ToString()); CaLopHocSinhVien.Mac = dtCaLopHocSinhVien.Rows[i]["MacAddress"].ToString(); CaLopHocSinhVien.Type = 1; CaLopHocSinhVien.Status = 1; CaLopHocSinhVien.TenMonHoc = dtCaLopHocSinhVien.Rows[i]["TenMonHoc"].ToString(); CaLopHocSinhVien.MaMonHoc = dtCaLopHocSinhVien.Rows[i]["MaMonHoc"].ToString(); CaLopHocSinhVien.TenCa = dtCaLopHocSinhVien.Rows[i]["TenCa"].ToString(); CaLopHocSinhVien.Ngay = DateTime.Parse(dtCaLopHocSinhVien.Rows[i]["Ngay"].ToString()); CaLopHocSinhVien.GioBatDau = int.Parse(dtCaLopHocSinhVien.Rows[i]["GioBatDau"].ToString()); CaLopHocSinhVien.GioKetThuc = int.Parse(dtCaLopHocSinhVien.Rows[i]["GioKetThuc"].ToString()); CaLopHocSinhVien.PhutBatDau = int.Parse(dtCaLopHocSinhVien.Rows[i]["PhutBatDau"].ToString()); CaLopHocSinhVien.PhutKetThuc = int.Parse(dtCaLopHocSinhVien.Rows[i]["PhutKetThuc"].ToString()); CaLopHocSinhViens.Add(CaLopHocSinhVien.Ca_LopHoc_SinhVienID, CaLopHocSinhVien); } Session[Utils.session_ca_lophoc_sinhvien] = CaLopHocSinhViens; } #endregion Response.Redirect(string.Format("/tabid/{0}/default.aspx", Utils.tab_trangchu_sinhvien)); tdAnnounce.InnerHtml = "Đăng nhập thành công"; } else { tdAnnounce.InnerHtml = "Đăng nhập thất bại"; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["calophoc"] == null || Request.QueryString["calophocsinhvien"] == null) { writeLog("Canh Bao", "Url bi sai " + Request.QueryString["calophoc"]); Response.Redirect(string.Format("/tabid/{0}/default.aspx", 1119)); return; } int iCaLopHoc = int.Parse(Request.QueryString["calophoc"]); m_iCaLopHocSinhVien = int.Parse(Request.QueryString["calophocsinhvien"]); Dictionary <int, model.CaLopHocSinhVien> m_CaLopHocSinhViens = (Dictionary <int, model.CaLopHocSinhVien>)Session[Utils.session_ca_lophoc_sinhvien]; model.CaLopHocSinhVien CaLopHocSinhVien = m_CaLopHocSinhViens[m_iCaLopHocSinhVien]; if (!CaLopHocSinhVien.Status.Equals(2)) { //return lai trang chu Response.Redirect(string.Format("/tabid/{0}/default.aspx", 1119)); } dtDotTraoDoi = data.dnn_NuceQLHPM_CaHoc_DotTraoDoi.getByCaLopHoc(iCaLopHoc); dtCaItems = data.dnn_NuceQLHPM_CaHoc_Items.getGetByCaLopHocSinhVien(m_iCaLopHocSinhVien); if (!IsPostBack) { dtDotTraoDoiActive = new DataTable(); dtDotTraoDoiActive.Columns.Add("id"); dtDotTraoDoiActive.Columns.Add("value"); string strHtml = ""; strHtml = "<table border='1px' style='width: 100%;'>"; strHtml += "<tr>"; strHtml += "<td style='width: 40px;text-align: center;font-weight: bold;'>STT</td>"; strHtml += "<td style='width: 12%;text-align: center;font-weight: bold;'>Tên đợt trao đổi</td>"; strHtml += "<td style='width: 18%;text-align: center;font-weight: bold;'>Thời gian</td>"; strHtml += "<td style='width: 18%;text-align: center;font-weight: bold;'>Nội dung</td>"; strHtml += "<td style='width: 18%;text-align: center;font-weight: bold;'>FileUpload</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'>Trạng thái</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; strHtml += "</tr>"; // Lay du lieu de xe ly for (int i = 0; i < dtDotTraoDoi.Rows.Count; i++) { int ID = int.Parse(dtDotTraoDoi.Rows[i]["CaHoc_DotTraoDoiID"].ToString()); string TenDotTraoDoi = dtDotTraoDoi.Rows[i]["Ten"].ToString(); strHtml += "<tr>"; strHtml += string.Format("<td style='width: 40px;text-align: center;font-weight: bold;'>{0}</td>", i + 1); strHtml += string.Format("<td style='width: 12%;text-align: center;'>{0}</td>", TenDotTraoDoi); strHtml += string.Format("<td style='width: 18%;text-align: center;'>Từ {0} giờ {1} phút đến {2} giờ {3} phút</td>", dtDotTraoDoi.Rows[i]["GioBatDau"].ToString(), dtDotTraoDoi.Rows[i]["PhutBatDau"].ToString(), dtDotTraoDoi.Rows[i]["GioKetThuc"].ToString(), dtDotTraoDoi.Rows[i]["PhutKetThuc"].ToString()); int iStatus = int.Parse(dtDotTraoDoi.Rows[i]["Status"].ToString()); string strTrangThai = ""; switch (iStatus) { case 1: strTrangThai = "Gốc"; break; case 2: strTrangThai = "Thực hiện"; break; case 3: strTrangThai = "Hoàn thành"; break; default: break; } DataRow[] drs = getItemRow(dtCaItems, int.Parse(dtDotTraoDoi.Rows[i]["CaHoc_DotTraoDoiID"].ToString())); string strLinkFile = ""; string strFile = ""; int iStatusItem = -1; string strNoiDung = ""; int iCaItemID = -1; if (drs.Length > 0) { strLinkFile = drs[0]["File_Link"].ToString(); strFile = string.Format("{0} (Loại File {1} - Dung lượng {2}B)", drs[0]["File_TenGoc"].ToString() , drs[0]["File_Loai"].ToString() , drs[0]["File_DungLuong"].ToString()); iStatusItem = int.Parse(drs[0]["Status"].ToString()); strNoiDung = drs[0]["NoiDung"].ToString(); iCaItemID = int.Parse(drs[0]["CaHoc_ItemID"].ToString()); } strHtml += string.Format("<td style='width: 20%;text-align: center;'>{0}</td>", strNoiDung); if (strLinkFile == "") { strHtml += "<td style='width: 20%;text-align: center;font-weight: bold;'></td>"; strHtml += "<td style='text-align: center;font-weight: bold;'>" + strTrangThai + "</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'>Chưa nộp</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; } else { strHtml += "<td style='width: 25%;text-align: center;font-weight: bold;'>" + strFile + "</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'>" + strTrangThai + "</td>"; if (iStatusItem.Equals(1)) { strHtml += "<td style='text-align: center;font-weight: bold;'>Chưa nộp bài</td>"; if (iStatus.Equals(3)) { strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; } else { strHtml += string.Format("<td style='text-align: center;font-weight: bold;'><a href='javascript:nopbai({0});'>Nộp bài</a></td>", iCaItemID); } } else { strHtml += "<td style='text-align: center;font-weight: bold;'>Đã nộp bài</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; } } strHtml += "</tr>"; //Them vao datatable if (iStatus.Equals(2) && !iStatusItem.Equals(2)) { dtDotTraoDoiActive.Rows.Add(ID.ToString(), TenDotTraoDoi); } } strHtml += "</table>"; divContent.InnerHtml = strHtml; if (dtDotTraoDoiActive.Rows.Count > 0) { ddlDotTraoDoi.DataValueField = "ID"; ddlDotTraoDoi.DataTextField = "Value"; ddlDotTraoDoi.DataSource = dtDotTraoDoiActive; ddlDotTraoDoi.DataBind(); } else { divUpload.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { string strData = "-1"; try { if (Session[Utils.session_ca_lophoc_sinhvien] == null) { strData = "NotAuthenticated"; } else { if (((Request.QueryString["calophocsinhvien"] != null) && (Request.QueryString["mac"] != null) && (Request.QueryString["action"] != null)) || ((Request.Form["calophocsinhvien"] != null) && (Request.Form["mac"] != null) && (Request.Form["action"] != null))) { int calophocsinhvien = -1; string mac = ""; string action = "xacthuc"; if (Request.QueryString["calophocsinhvien"] != null) { calophocsinhvien = int.Parse(Request.QueryString["calophocsinhvien"]); mac = Request.QueryString["mac"]; action = Request.QueryString["action"]; } else { calophocsinhvien = int.Parse(Request.Form["calophocsinhvien"]); mac = Request.Form["mac"]; action = Request.Form["action"]; } Dictionary <int, model.CaLopHocSinhVien> m_CaLopHocSinhViens = (Dictionary <int, model.CaLopHocSinhVien>)Session[Utils.session_ca_lophoc_sinhvien]; if (!m_CaLopHocSinhViens.ContainsKey(calophocsinhvien)) { strData = "Khong ton tai id"; } else { DateTime dtNopBai = DateTime.Now; model.CaLopHocSinhVien CaLopHocSinhVien = m_CaLopHocSinhViens[calophocsinhvien]; if (action.Equals("xacthuc")) { if (mac == "") { strData = "-3"; } else { strData = data.dnn_NuceQLHPM_Ca_LopHoc_SinhVien.xacthucmac(CaLopHocSinhVien.Ca_LopHoc_SinhVienID, CaLopHocSinhVien.Ca_LopHocID, CaLopHocSinhVien.SinhVienID, mac).ToString(); if (strData == "1") { CaLopHocSinhVien.Status = 2; } } } else { if (action.Equals("huyxacthuc")) { data.dnn_NuceQLHPM_Ca_LopHoc_SinhVien.HuyXacThucMac(CaLopHocSinhVien.Ca_LopHoc_SinhVienID); } strData = "1"; CaLopHocSinhVien.Status = 1; } m_CaLopHocSinhViens[calophocsinhvien] = CaLopHocSinhVien; Session[Utils.session_ca_lophoc_sinhvien] = m_CaLopHocSinhViens; } } } } catch (Exception ex) { strData = ex.Message; } Response.Clear(); Response.ContentType = "text/plain"; Response.Write(strData); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Thi string strHtml = "<table border='1px' style='width: 100%;'>"; strHtml += "<tr>"; strHtml += "<td style='width: 50px;text-align: center;font-weight: bold;'>STT</td>"; strHtml += "<td style='width: 50%;text-align: center;font-weight: bold;'>Tên</td>"; strHtml += "<td style='width: 12%;text-align: center;font-weight: bold;'>Thời gian thi</td>"; strHtml += "<td style='width: 12%;text-align: center;font-weight: bold;'>Thời gian thi còn lại</td>"; strHtml += "<td style='width: 12%;text-align: center;font-weight: bold;'>Trạng thái</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; strHtml += "</tr>"; int i = 0; foreach (var data in m_KiThiLopHocSinhViens) { model.KiThiLopHocSinhVien KiThiLopHocSinhVien = data.Value; i++; strHtml += "<tr>"; strHtml += string.Format("<td style='width: 50px;text-align: center;font-weight: bold;'>{0}</td>", i); strHtml += string.Format("<td style='width: 50%;'>{0} (Môn: {1};Block học: {2})</td>", KiThiLopHocSinhVien.TenKiThi, KiThiLopHocSinhVien.TenMonHoc, KiThiLopHocSinhVien.TenBlockHoc); strHtml += string.Format("<td style='width: 12%;text-align: center;'>{0} phút</td>", KiThiLopHocSinhVien.TongThoiGianThi); strHtml += string.Format("<td style='width: 12%;text-align: center;'>{0} phút {1} giây</td>", KiThiLopHocSinhVien.TongThoiGianConLai / 60, KiThiLopHocSinhVien.TongThoiGianConLai % 60); switch (KiThiLopHocSinhVien.Status) { case 2: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Chuẩn bị thi"); strHtml += string.Format("<td style='text-align: center;'><a href='/tabid/{0}/default.aspx?kithilophocsinhvien={1}'>Vào thi</a></td>", 1119, KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien); break; case 3: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Đang thi"); strHtml += string.Format("<td style='text-align: center;'><a href='/tabid/{0}/default.aspx?kithilophocsinhvien={1}'>Vào thi</a></td>", 1119, KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien); break; case 4: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Đã thi xong"); strHtml += string.Format("<td style='text-align: center; color:red;'>Điểm: {0:N2}</td>", KiThiLopHocSinhVien.Diem); break; case 5: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Chuẩn bị thi tiếp"); strHtml += string.Format("<td style='text-align: center;'><a href='/tabid/{0}/default.aspx?kithilophocsinhvien={1}'>Vào thi</a></td>", 1119, KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien); break; case 6: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Chuẩn bị thi lại"); strHtml += string.Format("<td style='text-align: center;'><a href='/tabid/{0}/default.aspx?kithilophocsinhvien={1}'>Vào thi</a></td>", 1119, KiThiLopHocSinhVien.KiThi_LopHoc_SinhVien); break; default: break; } strHtml += "</tr>"; } strHtml += "</table>"; #endregion #region Hoc strHtml += "<table border='1px' style='width: 100%;'>"; strHtml += "<tr>"; strHtml += "<td style='width: 50px;text-align: center;font-weight: bold;'>STT</td>"; strHtml += "<td style='width: 20%;text-align: center;font-weight: bold;'>Tên môn học</td>"; strHtml += "<td style='width: 20%;text-align: center;font-weight: bold;'>Tên Ca</td>"; strHtml += "<td style='width: 30%;text-align: center;font-weight: bold;'>Thời gian</td>"; strHtml += "<td style='width: 10%;text-align: center;font-weight: bold;'>Trạng thái</td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; strHtml += "<td style='text-align: center;font-weight: bold;'></td>"; strHtml += "</tr>"; i = 0; foreach (var data in m_CaLopHocSinhViens) { model.CaLopHocSinhVien CaLopHocSinhVien = data.Value; i++; strHtml += "<tr>"; strHtml += string.Format("<td style='width: 50px;text-align: center;font-weight: bold;'>{0}</td>", i); strHtml += string.Format("<td style='width: 20%;text-align: center;'>{0}</td>", CaLopHocSinhVien.TenMonHoc); strHtml += string.Format("<td style='width: 20%;text-align: center;'>{0}</td>", CaLopHocSinhVien.TenCa); strHtml += string.Format("<td style='width: 30%;text-align: center;'>Ngày {0} (từ {1} giờ {2} phút đến {3} giờ {4} phút)</td>", CaLopHocSinhVien.Ngay.ToString("dd/MM/yyyy"), CaLopHocSinhVien.GioBatDau, CaLopHocSinhVien.PhutBatDau, CaLopHocSinhVien.GioKetThuc, CaLopHocSinhVien.PhutKetThuc); switch (CaLopHocSinhVien.Status) { case 1: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Chưa xác thực"); strHtml += string.Format("<td style='text-align: center;'><a href='javascript:xacthuc({0});'>Xác thực ngay</a></td>", CaLopHocSinhVien.Ca_LopHoc_SinhVienID); strHtml += string.Format("<td style='text-align: center;'>---</td>"); break; case 2: strHtml += string.Format("<td style='width: 10%;text-align: center;'>{0}</td>", "Xác thực"); strHtml += string.Format("<td style='text-align: center;'><a href='javascript:huyxacthuc({0});'>Huỷ xác thực ngay</a></td>", CaLopHocSinhVien.Ca_LopHoc_SinhVienID); strHtml += string.Format("<td style='text-align: center;'><a href='/tabid/2129/default.aspx?calophoc={0}&&calophocsinhvien={1}'>Vào học</a></td>", CaLopHocSinhVien.Ca_LopHocID, CaLopHocSinhVien.Ca_LopHoc_SinhVienID); break; default: break; } strHtml += "</tr>"; } strHtml += "</table>"; #endregion divContent.InnerHtml = strHtml; } }