protected void btnLogin_Click(object sender, EventArgs e) { if (Request.Cookies["CheckCode"] == null) { lblMessage.Text = "Cookies被禁止"; lblMessage.Visible = true; return; } if (String.Compare(Request.Cookies["CheckCode"].Value, Code.Value, true) != 0) { lblMessage.Text = "验证码错误"; lblMessage.Visible = true; return; } else if (String.Compare(Request.Cookies["CheckCode"].Value, Code.Value, true) == 0) { string pass = Password.Value.Trim(); pass = CY.GFive.Core.Business.StaffInfo.GetMd5Hash(pass);//加密 string type =sel.Value; if (type == "1") { user = CY.GFive.Core.Business.Student.GetStudentByCode(UserName.Value); } else if (type == "2") { user = CY.GFive.Core.Business.Student.GetByStdName(UserName.Value); } if (user != null && user.StdState == "InRegister") { int id = user.Id;//学生ID string Truepassword = CY.GFive.Core.Business.StudentPass.GetPassByStdID(id).Pass; if (string.IsNullOrEmpty(Truepassword))//注册了但没密码 { string commonPass = CY.GFive.Core.Business.StaffInfo.GetMd5Hash("123456"); CY.GFive.Core.Business.StudentPass sp = new CY.GFive.Core.Business.StudentPass(); sp.Pass = commonPass; sp.StuID = id; sp.Save(); if (pass == commonPass) { Session["User"] = user; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>window.location.href='StudentIndex.aspx';</script>"); } else { lblMessage.Text = "学号或密码错误"; } } else { if (Truepassword == pass) { Session["User"] = user; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>window.location.href='StudentIndex.aspx';</script>"); } else { lblMessage.Text = "学号或密码错误"; } } } else { lblMessage.Text = "该学生不存在"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { student = GetStudent(); if (student == null) { Response.Redirect("~/StudentLogin.aspx"); } InitialScore(student, out scores, out years); } }
private string HandlerData(HttpContext context) { StringBuilder json = new StringBuilder(); bool IsSucess = false; try { string classcode = context.Request.Params["classcode"]; string subid = context.Request.Params["subId"]; string yearstr = context.Request.Params["Year"]; if (!string.IsNullOrEmpty(classcode) && !string.IsNullOrEmpty(subid) && !string.IsNullOrEmpty(yearstr)) { CY.GFive.Core.Business.ClassInfo classInfo = null; int year = default(int); if ((classInfo = CY.GFive.Core.Business.ClassInfo.GetInstance(classcode)) != null && int.TryParse(yearstr, out year)) { StringBuilder tbsub = new StringBuilder(); StringBuilder tbunsub = new StringBuilder(); tbsub.Append("<table style=\"width:auto;\" id=\"gvPerSel\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"grid-table\" >"); tbsub.Append("<tr><td scope=\"col\"><input id=\"gvPerSel_CBAll\" type=\"checkbox\"></td><td scope=\"col\">学号</td><td scope=\"col\">姓名</td><td scope=\"col\">入学时间</td><td scope=\"col\">户籍类型</td><td scope=\"col\">政治面貌</td><td>国家助学金</td><td>重庆市助学金</td></tr>"); tbunsub.Append("<table style=\"width:auto;\" id=\"gvPerUnSel\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"grid-table\" >"); tbunsub.Append("<tr><td scope=\"col\"><input id=\"gvPerUnSel_CBAll\" type=\"checkbox\"></td><td scope=\"col\">学号</td><td scope=\"col\">姓名</td><td scope=\"col\">入学时间</td><td scope=\"col\">户籍类型</td><td scope=\"col\">政治面貌</td><td>助学金</td></tr>"); IList<CY.GFive.Core.Business.StdClass> classstdlist = CY.GFive.Core.Business.StdClass.GetStdClassByClassCode(classcode); IList<CY.GFive.Core.Business.Student> studlistSubList = new List<CY.GFive.Core.Business.Student>(); IList<CY.GFive.Core.Business.Student> studlistUnSubList = new List<CY.GFive.Core.Business.Student>(); CY.GFive.Core.Business.Student student = new CY.GFive.Core.Business.Student(); for (int i = 0; i < classstdlist.Count; i++) { if (CY.GFive.Core.Business.SubsidyRecordForStudent.SelectByStdcodeAndTime(classstdlist[i].StdCode, year, int.Parse(subid)) != null) { student = CY.GFive.Core.Business.Student.GetStudentByCode(classstdlist[i].StdCode); if (student != null) { tbsub.Append("<tr><td><input id=\"" + classstdlist[i].StdCode + "\" type=\"checkbox\"></td>"); tbsub.Append("<td>" + student.Code + "</td><td>" + student.StdName + "</td><td>" + student.AdmissDate.ToShortDateString() + "</td><td>" + student.ResidenceType + "</td><td>" + student.PoliticalName + "</td>"); tbsub.Append("<td><span style=\"text-decoration: underline; cursor: pointer; color: Blue;\" id=\"" + student.Code + "\" name=\"CountryRecord\">查看</span></td>"); tbsub.Append("<td><span style=\"text-decoration: underline; cursor: pointer; color: Blue;\" id=\"" + student.Code + "\" name=\"ChongqingRecord\">查看</span></td></tr>"); } } else { student = CY.GFive.Core.Business.Student.GetStudentByCode(classstdlist[i].StdCode); if (student != null) { tbunsub.Append("<tr><td><input id=\"" + classstdlist[i].StdCode + "\" type=\"checkbox\"></td>"); tbunsub.Append("<td>" + student.Code + "</td><td>" + student.StdName + "</td><td>" + student.AdmissDate.ToShortDateString() + "</td><td>" + student.ResidenceType + "</td><td>" + student.PoliticalName + "</td>"); tbunsub.Append("<td><span style=\"text-decoration: underline; cursor: pointer; color: Blue;\" id=\"" + classstdlist[i].StdCode + "\" name=\"addcountryrecord\">助学金申请</span></td></tr>"); } } } tbsub.Append("</table>"); tbunsub.Append("</table>"); //json = "{success:true,persel:'" + tbsub.ToString() + "',perunsel:'" + tbunsub.ToString() + "'}"; json.Append("{"); json.Append(string.Format("sucess:true,persel:'{0}',perunsel:'{1}'", tbsub.ToString(), tbunsub.ToString())); json.Append("}"); IsSucess = true; } } } catch (Exception ex) { throw ex; } finally { if (!IsSucess) { json.Remove(0, json.Length); json.Append("{sucess:false,msg:'参数错误!'}"); } } return json.ToString(); }
protected void bAddStudent_Click(object sender, EventArgs e) { string stdcode = txtCode.Text; CY.GFive.Core.Business.Student ns = new CY.GFive.Core.Business.Student(); if (String.IsNullOrEmpty(txtCode.Text)) { CY.GFive.Utility.Extend.JsHelper.Alert(this.Page, "错误", "学号不可以为空!"); return; } ns.Code = txtCode.Text; if (string.IsNullOrEmpty(txtAdmissDate.Text) || txtAdmissDate.Text.Length <4 || txtAdmissDate.Text.Substring(0, 4) == null || txtAdmissDate.Text.Substring(0, 4) != DateTime.Now.Year.ToString()) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('入学时间不能为空!,应该确定入学流水号时间和入学时间是否一致是否一致!')</script>"); return; } try { if (!string.IsNullOrEmpty(txtStdName.Text.Trim())) { ns.StdName = txtStdName.Text; txtStdName.Text = ""; } if (!string.IsNullOrEmpty(txtUsedName.Text.Trim())) { ns.UsedName = txtUsedName.Text.Trim(); txtUsedName.Text = ""; } if (!string.IsNullOrEmpty(ddlStdState.SelectedValue)) ns.StdState = ddlStdState.SelectedValue; if (!string.IsNullOrEmpty(ddlIndentifyType.SelectedValue)) ns.IndentifyType = ddlIndentifyType.SelectedValue; if (!string.IsNullOrEmpty(txtIndentifyCode.Text.Trim())) { ns.IndentifyCode = txtIndentifyCode.Text.Trim(); txtIndentifyCode.Text = ""; } if (!string.IsNullOrEmpty(ddlStdCate.SelectedValue)) ns.StdCate = ddlStdCate.SelectedValue; if (!string.IsNullOrEmpty(ddlGender.SelectedValue)) ns.Gender = Convert.ToInt32(ddlGender.SelectedValue); if (!string.IsNullOrEmpty(txtAdmissDate.Text)) { ns.AdmissDate = DateTime.Parse(txtAdmissDate.Text.Trim()); txtAdmissDate.Text = ""; } if (!string.IsNullOrEmpty(ddlProfessCode.SelectedValue)) { ns.ProfessCode = ddlProfessCode.SelectedValue; } if (!string.IsNullOrEmpty(txtResidenceName.Text)) { ns.ResidenceName = txtResidenceName.Text; txtResidenceName.Text = ""; } if (!string.IsNullOrEmpty(ddlResidenceType.SelectedValue)) { ns.ResidenceType = ddlResidenceType.SelectedValue; } if (!string.IsNullOrEmpty(txtNation.Text)) { ns.Nation = txtNation.Text; txtNation.Text = ""; } if (!string.IsNullOrEmpty(txtBirthday.Text)) { ns.Birthday = DateTime.Parse(txtBirthday.Text); txtBirthday.Text = ""; } if (!string.IsNullOrEmpty(ddlAdmissTypeCode.SelectedValue)) ns.AdmissTypeCode = ddlAdmissTypeCode.SelectedValue; if (!string.IsNullOrEmpty(txtPhone.Text)) { ns.Phone = txtPhone.Text; txtPhone.Text = ""; } if (!string.IsNullOrEmpty(txtCorSchlCode.Text)) { ns.CorSchlCode = txtCorSchlCode.Text; txtCorSchlCode.Text = ""; } if (!string.IsNullOrEmpty(ddlCorTypeCode.SelectedValue)) ns.CorTypeCode = ddlCorTypeCode.SelectedValue; if (!string.IsNullOrEmpty(txtZip_Code.Text)) { ns.Zip_Code = txtZip_Code.Text; txtZip_Code.Text = ""; } if (!string.IsNullOrEmpty(txtRegistedCode.Text.Trim())) { ns.RegistedCode = txtRegistedCode.Text.Trim(); txtRegistedCode.Text = ""; } if (!string.IsNullOrEmpty(ddlPoliticalCode.SelectedValue)) ns.PoliticalCode = ddlPoliticalCode.SelectedValue; if (!string.IsNullOrEmpty(txtOrigin.Text.Trim())) { ns.Origin = txtOrigin.Text; txtOrigin.Text = ""; } if (!string.IsNullOrEmpty(ddlOverSea.SelectedValue)) { if (ddlOverSea.SelectedValue == "true") ns.OverSea = true; else ns.OverSea = false; } if (!string.IsNullOrEmpty(txtGrdSchool.Text)) { ns.GrdSchool = txtGrdSchool.Text; txtGrdSchool.Text = ""; } if (!string.IsNullOrEmpty(txtStdAddress.Text)) { ns.StdAddress = txtStdAddress.Text; txtStdAddress.Text = ""; } if (!string.IsNullOrEmpty(txtEmail.Text)) { ns.Email = txtEmail.Text; txtEmail.Text = ""; } if (!string.IsNullOrEmpty(txtDes.Text)) { ns.Des = txtDes.Text; txtDes.Text = ""; } if (!string.IsNullOrEmpty(txtRegisteDate.Text)) { ns.RegisteDate = DateTime.Parse(txtRegisteDate.Text); txtRegisteDate.Text = ""; } txtCode.Text = ""; ns.StdState = "UnRegister"; ns.Save(); CY.GFive.Core.Business.StudentEx se = new CY.GFive.Core.Business.StudentEx(); se.StdCode = stdcode; se.Save(); //Response.Redirect("AddStudentEx.aspx?ID=" + stdcode); Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('添加成功!');window.location.href=window.location.href;</script>"); } catch (Exception ex) { ErrorMsg.Text = "错误: " + ex.Message; } }