public static string editPass(int id, string password) { int code = 0; string message = "返回成功"; StudentsUser user = new StudentsUser(); try { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.getStudentsUser(id); user.Password = password; bll.Update(user); } } catch (Exception) { code = 0; message = "修改密码错误!"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }
public static string Login1(string userName, string password) { int code = 1; string message = "登陆成功"; StudentsUser user; using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.getStudentUserBySighUpNum(userName); } if (user == null) { code = 0; message = "您输入的用户不存在"; } else if (user.Password != password) { code = 0; message = "您输入的密码错误"; } if (code == 1) { HttpContext.Current.Session["user_"] = user; } string str3 = JsonConvert.SerializeObject(new { code = code, message = message }); return(str3); }
public static string showInfo(string id, string time) { int code = 1; string message = "返回成功"; string userSignUpNum = ""; string userSfzh = ""; string stuName = ""; int id_ = int.Parse(MD5Helper.DesDecrypt(id)); string time_ = MD5Helper.DesDecrypt(time); TimeSpan tSpan = DateTime.Now - DateTime.Parse(time_); if (tSpan.TotalMinutes > 10) { code = 0; message = "本链接已过期,请重新在网站上重置密码!"; } else { StudentsUser user = new StudentsUser(); using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.getStudentsUser(id_); } userSignUpNum = user.SignUpNum; userSfzh = user.Sfzh; stuName = user.StuName; } return(JsonConvert.SerializeObject(new { code = code, message = message, userSignUpNum = userSignUpNum, userSfzh = userSfzh, stuName = stuName })); }
public static string Login1(string userName, string password) { int code = 1; string message = "登陆成功"; StudentsUser user; //string DesPassword = MD5Helper.DesEncrypt(password); using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.getStudentsUserBySignUpNum(userName); } if (user == null) { code = 0; message = "您输入的用户不存在!"; } else if (MD5Helper.DesDecrypt(user.Password) != password) { code = 0; message = "您输入的密码错误!"; } if (code == 1) { HttpContext.Current.Session["user_"] = user; } string str3 = JsonConvert.SerializeObject(new { code = code, message = message, user = user }); return(str3); }
public static string getAllDataToExcel() { int code = 1; string message = "success"; List <StudentsUser> listUser = new List <StudentsUser>(); using (StudentsUserBLL bll = new StudentsUserBLL()) { listUser = bll.getStudentUser(); } XlsDocument xls = new XlsDocument(); if (listUser.Count != 0) { xls.FileName = DateTime.Now.ToString("u").Replace(":", "_").Replace(" ", "_") + ".xls"; Worksheet sheet = xls.Workbook.Worksheets.Add("考生数据"); Cells cells = sheet.Cells; cells.Add(1, 1, "身份证号"); cells.Add(1, 2, "姓名"); cells.Add(1, 3, "准考证"); cells.Add(1, 4, "手机号"); for (int i = 1; i <= listUser.Count; i++) { cells.Add(i + 1, 1, listUser[i - 1].Sfzh); cells.Add(i + 1, 2, listUser[i - 1].StuName); cells.Add(i + 1, 3, listUser[i - 1].Zkzh); cells.Add(i + 1, 4, listUser[i - 1].Mobile); } xls.Save(HttpContext.Current.Server.MapPath("~/uploads") + "//"); } return(JsonConvert.SerializeObject( new { code = code, message = message, filePath = "uploads/" + xls.FileName })); }
public static string restPassword(string Sfzh, string Zkzh) { int code = 1; string message = "发送验证邮件成功,请登陆注册时的电子邮件"; string fsurl = ""; StudentsUser user; using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.getStubySfzh(Sfzh); } if (user == null) { code = 0; message = "您输入的信息有误请重新输入"; } else if (user.Zkzh != Zkzh) { code = 0; message = "身份证和准考证号不匹配"; } else { StringBuilder MailContent = new StringBuilder(); string port = HttpContext.Current.Request.Url.Port.ToString(); string host = HttpContext.Current.Request.Url.Host; if (port != "80") { host = @"http://" + host + ":" + port; } string time_ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string urlhost = host + "/reg_EditPassword.aspx"; MailContent.Append(string.Format("亲爱的{0}会员:<br/>", user.StuName)); MailContent.Append(" 您好!你于"); MailContent.Append(time_); MailContent.Append("通过<a href='" + urlhost + "'>太原城市职业技术学院自主招生报考网站</a>审请找回密码。<br/>"); MailContent.Append(" 为了安全起见,请用户点击以下链接重设个人密码:<br/><br/>"); string url1 = "?u=" + MD5Helper.DesEncrypt(user.Id.ToString()) + "&t=" + MD5Helper.DesEncrypt(time_); //string urljiami = ""; //CryptoHelper crjiami = new CryptoHelper(); //urljiami = crjiami.GetEncryptedValue(url1); fsurl = urlhost + url1; MailContent.Append("<a href='" + fsurl + "'>" + fsurl + "</a><br/><br/>"); MailContent.Append(" (如果无法点击该URL链接地址,请将它复制并粘帖到浏览器的地址输入框,然后单击回车即可。)"); bool flag = MailService.SendEmailDefault(user.E_mail, MailContent.ToString(), user.StuName + "找回密码"); if (flag == false) { code = 0; message = "邮件发送不成功,请检查E_mail地址是否正确,或与管理员联系!"; } } string str3 = JsonConvert.SerializeObject(new { code = code, message = message }); return(str3); }
public static string getStudentInfoPage(int pageIndex, int pageSize) { int code = 1; string message = "success"; Page <StudentsUser> stuInfoPage = new Page <StudentsUser>(); using (StudentsUserBLL bll = new StudentsUserBLL()) { stuInfoPage = bll.getStuUserPage(pageIndex, pageSize); } return(JsonConvert.SerializeObject( new { code = code, message = message, stuInfoPage = stuInfoPage })); }
public string sfzhIsHave(string sfzh) { String re = string.Empty; using (StudentsUserBLL bll = new StudentsUserBLL()) { re = bll.isHaveBySfzh(sfzh) == false ? "true" : "该身份证号已经注册,请使用找回用户名或密码"; } if (re == "true") { IDCardValidation idval = new IDCardValidation(); re = idval.CheckIDCard18(sfzh) == false ? "身份证号码格式不正确,请检查":re; } return(re); }
public static string insterStuUser(string Sfzh, string Password, string Zkzh, string StuName, string StuType, string Mobile, string E_mail) { int code = 0; int _list; string message = "错误"; StudentsUser stuUser = new StudentsUser(); stuUser.Sfzh = Sfzh; stuUser.Password = MD5Helper.DesEncrypt(Password); stuUser.Zkzh = Zkzh; stuUser.StuName = StuName; stuUser.StuType = int.Parse(StuType); stuUser.Mobile = Mobile; stuUser.E_mail = E_mail; stuUser.Bz = ""; stuUser.Certificate = ""; stuUser.CheckTime = DateTime.Parse("1900-01-01"); stuUser.CriterionCouse = ""; stuUser.IsCheck = 0; stuUser.IsCriterion = 0; stuUser.IsPlan = 0; stuUser.LastLoginDate = DateTime.Now; stuUser.SignUpNum = "00"; stuUser.State = 1; stuUser.RegDate = DateTime.Now; try { using (StudentsUserBLL bll = new StudentsUserBLL()) { _list = bll.Insert(stuUser); Random ran = new Random(); int RandKey = ran.Next(1000, 9999); //stuUser.SignUpNum = RandKey.ToString().PadLeft(6, '0'); stuUser.SignUpNum = _list.ToString().PadLeft(6, '0'); bll.Update(stuUser); code = 1; message = "注册成功!用户名为" + bll.getStudentsUserBySignSfzh(stuUser.Sfzh).SignUpNum; } } catch (Exception) { message = "注册失败!"; } //string str3 = string.Format("{\"code\":\"0\",,\"message\":\"{1}\"}", code, message);// string str3 = JsonConvert.SerializeObject(new { code = code, message = message }); return(str3); }
public static string intsertStuUser(string Sfzh, string Password, string Zkzh, string StuName, string StuType, string Mobile, string E_mail) { int code = 0; string message = "错误"; int _list; StudentsUser stuUser = new StudentsUser(); stuUser.Sfzh = Sfzh; stuUser.Password = Password; stuUser.Zkzh = Zkzh; stuUser.StuName = StuName; stuUser.StuType = int.Parse(StuType); stuUser.Mobile = Mobile; stuUser.E_mail = E_mail; stuUser.Bz = ""; stuUser.Certificate = ""; stuUser.CheckTime = DateTime.Parse("1900-01-01"); stuUser.CriterionCouse = ""; stuUser.IsCheck = 0; stuUser.IsCriterion = 0; stuUser.IsPlan = 0; stuUser.LastLoginDate = DateTime.Now; stuUser.LoginCount = 1; stuUser.SignUpNum = "00"; stuUser.State = 1; stuUser.RegDate = DateTime.Now; using (StudentsUserBLL bll = new StudentsUserBLL()) { try { _list = bll.Insert(stuUser); stuUser.SignUpNum = _list.ToString().PadLeft(6, '0'); bll.Update(stuUser); code = 1; message = "提交成功 用户名为" + bll.getStudentsSignUpNumBySfzh(stuUser.Sfzh).SignUpNum; } catch (Exception) { code = 0; message = "提交失败"; } } string str = JsonConvert.SerializeObject(new { code = code, message = message }); return(str); }
public string isHavaBySfzh(string sfzh) { string re = string.Empty; using (StudentsUserBLL bll = new StudentsUserBLL()) { re = bll.isHaveBySfzh(sfzh) == false ? "true" : "改身份证号已经注册,请使用找回用户名或密码"; } if (re == "true") { IDCardValidation idval = new IDCardValidation(); //if (idval.CheckIDCard18(sfzh) == false) //{ // re = "身份证号格式不正确,请检查!"; //} re = idval.CheckIDCard18(sfzh) == false ? "身份证号格式不正确,请检查!" : re; } return(re); }
public static string getStudentInfoPage(int pageIndex, int pageSize) { int code = 1; string message = "返回数据成功"; CheckTeacher user = HttpContext.Current.Session["teacheruser_"] as CheckTeacher; Page <StudentsUser> stuUserPage = new Page <StudentsUser>(); if (user != null) { using (StudentsUserBLL bll = new StudentsUserBLL()) { stuUserPage = bll.getStuUserPage(pageIndex, pageSize); } } else { code = 0; message = "请您登陆后再填写详细信息!"; } return(JsonConvert.SerializeObject(new { code = code, message = message, stuUserPage = stuUserPage })); }
public static string getSelectInfo(string id) { int code = 1; string message = "返回数据成功"; string str3 = string.Empty; if (HttpContext.Current.Session["user_"] == null) { code = 0; message = "您还没有登录,请您登录!"; str3 = JsonConvert.SerializeObject(new { code = code, message = message }); } else { StudentsUser user = new StudentsUser(); if (HttpContext.Current.Session["user_"] == null && id != "0") { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.GetEntity(int.Parse(id)); } } else if (HttpContext.Current.Session["user_"] != null) { user = HttpContext.Current.Session["user_"] as StudentsUser; } List <Nation> listNation = new List <Nation>(); //民族列表 List <ZZMM> listZZMM = new List <ZZMM>(); //政治面貌 List <AreaCode_> listShiAreaCode = new List <AreaCode_>(); //城市列表 List <KSLB> listKslb = new List <KSLB>(); //考生类别 List <BYLB> listBylb = new List <BYLB>(); //毕业类别 List <ZY> listZy = new List <ZY>(); //专业名称 StudentInfo stuInfo = new StudentInfo(); Wish wish = new Wish(); //考生志愿信息 ZY Zy_ = new ZY(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AreaCodeBLL bll = new AreaCodeBLL()) { listShiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { stuInfo = bll.getEntity(user.Sfzh); if (stuInfo != null) { HttpContext.Current.Session["PicPath_"] = stuInfo.PicPath; } } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } } else { code = 0; message = "请您登陆后再填写详细信息!"; } str3 = JsonConvert.SerializeObject(new { code = code, message = message, listNation = listNation, ListZZMM = listZZMM, listShiAreaCode = listShiAreaCode, listKslb = listKslb, listBylb = listBylb, listZy = listZy, user = user, stuInfo = stuInfo, wish = wish, } ); } return(str3); }
public static string getSelectInfo(string id) { int code = 1; string message = "返回数据成功"; StudentsUser user = new StudentsUser(); if (HttpContext.Current.Session["user_"] == null && id != "0") { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.GetEntity(int.Parse(id)); } } else if (HttpContext.Current.Session["user_"] != null) { user = HttpContext.Current.Session["user_"] as StudentsUser; } List <Nation> listNation = new List <Nation>(); List <ZZMM> listZZMM = new List <ZZMM>(); List <AreaCode_> shiAreaCode = new List <AreaCode_>(); List <KSLB> listKslb = new List <KSLB>(); List <BYLB> listBylb = new List <BYLB>(); List <ZY> listZy = new List <ZY>(); StudentInfo info = new StudentInfo(); Wish wish = new Wish(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AfficheBLL bll = new AfficheBLL()) { shiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { info = bll.getEntity(user.Sfzh); } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } } else { code = 0; message = "请登录后在操作"; } string str3 = JsonConvert.SerializeObject(new { code = code, message = message, listNation = listNation, listZZMM = listZZMM, shiAreaCode = shiAreaCode, listBylb = listBylb, listKslb = listKslb, listZy = listZy, user = user, info = info, wish = wish }); return(str3); }