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 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 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 void ProcessRequest(HttpContext context) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; StudentsUser user = context.Session["user_"] as StudentsUser; string fileName = context.Server.MapPath("~/uploads") + "//" + user.Sfzh + ".jpg"; file.SaveAs(fileName); using (StudentInfoBLL bll = new StudentInfoBLL()) { StudentInfo selectInfo = bll.getEntity(user.Sfzh); selectInfo.PicPath = "//uploads//" + user.Sfzh + ".jpg"; bll.Update(selectInfo); } } //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); }
public int Delete(StudentsUser studentsuser) { return(Dao.Delete(studentsuser)); }
public int Update(StudentsUser studentsuser) { return(Dao.Update(studentsuser)); }
public int Insert(StudentsUser user) { return((int)Dao.Insert(user)); }
public static String printInfo() { int code = 1; string message = "打印成功!!"; StudentsUser 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(); //考生志愿信息 Nation nation_ = new Nation(); AreaCode_ areaCode, areaShiCode = new AreaCode_(); 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.PicPath.Trim().Length != null) //{ // HttpContext.Current.Session["PicPath_"] =stuInfo.PicPath; //} } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } Document doc = new Document(System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "//templet.doc"); foreach (Bookmark item in doc.Range.Bookmarks) { if (item != null) { switch (item.Name) { case "SignUpNum": item.Text = user.SignUpNum; break; ///sfzh case "Sfzh_1": item.Text = user.Sfzh.Substring(0, 1); break; case "Sfzh_2": item.Text = user.Sfzh.Substring(1, 1); break; case "Sfzh_3": item.Text = user.Sfzh.Substring(2, 1); break; case "Sfzh_4": item.Text = user.Sfzh.Substring(3, 1); break; case "Sfzh_5": item.Text = user.Sfzh.Substring(4, 1); break; case "Sfzh_6": item.Text = user.Sfzh.Substring(5, 1); break; case "Sfzh_7": item.Text = user.Sfzh.Substring(6, 1); break; case "Sfzh_8": item.Text = user.Sfzh.Substring(7, 1); break; case "Sfzh_9": item.Text = user.Sfzh.Substring(8, 1); break; case "Sfzh_10": item.Text = user.Sfzh.Substring(9, 1); break; case "Sfzh_11": item.Text = user.Sfzh.Substring(10, 1); break; case "Sfzh_12": item.Text = user.Sfzh.Substring(11, 1); break; case "Sfzh_13": item.Text = user.Sfzh.Substring(12, 1); break; case "Sfzh_14": item.Text = user.Sfzh.Substring(13, 1); break; case "Sfzh_15": item.Text = user.Sfzh.Substring(14, 1); break; case "Sfzh_16": item.Text = user.Sfzh.Substring(15, 1); break; case "Sfzh_17": item.Text = user.Sfzh.Substring(16, 1); break; case "Sfzh_18": item.Text = user.Sfzh.Substring(17, 1); break; ///zkzh case "Zkzh_1": item.Text = user.Zkzh.Substring(0, 1); break; case "Zkzh_2": item.Text = user.Zkzh.Substring(1, 1); break; case "Zkzh_3": item.Text = user.Zkzh.Substring(2, 1); break; case "Zkzh_4": item.Text = user.Zkzh.Substring(3, 1); break; case "Zkzh_5": item.Text = user.Zkzh.Substring(4, 1); break; case "Zkzh_6": item.Text = user.Zkzh.Substring(5, 1); break; case "Zkzh_7": item.Text = user.Zkzh.Substring(6, 1); break; case "Zkzh_8": item.Text = user.Zkzh.Substring(7, 1); break; case "Zkzh_9": item.Text = user.Zkzh.Substring(8, 1); break; case "Zkzh_10": item.Text = user.Zkzh.Substring(9, 1); break; case "Zkzh_11": item.Text = user.Zkzh.Substring(10, 1); break; case "Zkzh_12": item.Text = user.Zkzh.Substring(11, 1); break; case "Zkzh_13": item.Text = user.Sfzh.Substring(12, 1); break; case "Zkzh_14": item.Text = user.Sfzh.Substring(13, 1); break; ///picpath case "PicPath": DocumentBuilder builder = new DocumentBuilder(doc); string imgPath = System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "\\" + user.Sfzh + ".jpg"; if (File.Exists(imgPath)) { builder.MoveToBookmark("PicPath"); builder.InsertImage(imgPath, RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Margin, 1, 80, 100, WrapType.Square); } break; ///StuName case "StuName": item.Text = user.StuName; break; ///Tel case "Tel": item.Text = stuInfo.Tel; break; ///Txdz case "Txdz": item.Text = stuInfo.Txdz; break; ///Xb case "Xb": item.Text = (stuInfo.Xb == 0 ? "女" : "男"); break; ///Yzbm case "Yzbm": item.Text = stuInfo.Yzbm; break; ///AcceptPeople case "AcceptPeople": item.Text = stuInfo.AcceptPeople; break; ///Byyx case "Byyx": item.Text = stuInfo.Byyx; break; ///Csrq case "Csrq": item.Text = stuInfo.Csrq.ToString("yyyy-MM-dd"); break; ///Health case "Health": if (stuInfo.Health == 0) { item.Text = "好"; } else if (stuInfo.Health == 1) { item.Text = "一般"; } else if (stuInfo.Health == 2) { item.Text = "比较好"; } else if (stuInfo.Health == 3) { item.Text = "差"; } break; ///IsAdjust case "IsAdjust": item.Text = (wish.IsAdjust == 0 ? "否" : "是"); break; ///LikeSpecial case "LikeSpecial": item.Text = stuInfo.LikeSpecial; break; ///Mobile case "Mobile": item.Text = stuInfo.Mobile; break; ///Nation case "Nation": using (NationBLL bll = new NationBLL()) { nation_ = bll.getNationName(stuInfo.Nation); } item.Text = nation_.NationName.ToString(); break; ///AreaCode case "AreaCode": using (AreaCodeBLL bll = new AreaCodeBLL()) { areaCode = bll.getAreaName(stuInfo.AreaCode.Substring(0, 4)); areaShiCode = bll.getAreaName(stuInfo.AreaCode); } item.Text = areaCode.AreaName.ToString() + areaShiCode.AreaName.ToString(); break; ///ZZMM case "ZZMM": var answerZzmm = (from p in listZZMM where p.ZzmmDm == stuInfo.ZZMM select p).Single(); item.Text = answerZzmm.ZzmmMc.ToString(); break; ///BYLB case "BYLB": var answerBylb = (from p in listBylb where p.BylbDm == stuInfo.BYLB select p).Single(); item.Text = answerBylb.BylbMc.ToString(); break; ///KSLB case "KSLB": var answerKslb = (from p in listKslb where p.KslbDm == stuInfo.KSLB select p).Single(); item.Text = answerKslb.KslbMc.ToString(); break; ///FrsZY case "FrsZY": var answerFrszy = (from p in listZy where p.ZYDM == wish.FrsZY.Trim() select p); string stringFrstzy = string.Empty; foreach (var item1 in answerFrszy) { stringFrstzy = item1.ZYMC; } item.Text = stringFrstzy.ToString(); break; ///SecZY case "SecZY": var answerSeczy = (from pp in listZy where pp.ZYDM == wish.SecZY.Trim() select pp); string stringSeczy = string.Empty; foreach (var item2 in answerSeczy) { stringSeczy = item2.ZYMC; } item.Text = stringSeczy.ToString(); break; } } doc.Print(); //doc.Save("d:\\adc.doc"); message = "打印成功,请请前往D盘查看!!"; } } else { code = 0; message = "打印失败,后台信息错误!"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }
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); }
public int Update(StudentsUser user) { return((int)Dao.Update(user)); }