/// <summary> /// 我的简历 /// </summary> /// <returns></returns> public ActionResult MyResume() { List <MyResumeItem> myResumes = new List <MyResumeItem>(); EJ_USER241856 User = Utility.SessionHelper.GetLoginInfo(); if (User.U_MEMBER_ID > 0) { DAL.DalBase <EJ_MY_RESUME652145> dalBase = new DAL.DalBase <EJ_MY_RESUME652145>(); var data = dalBase.LoadEntities(a => a.MR_MEMBER_ID == User.U_MEMBER_ID && a.MR_DEL == false).OrderByDescending(a => a.MR_CREAT_TIME); MyResumeItem myResume; foreach (var item in data) { myResume = new MyResumeItem() { create_time = Utility.DateTimeHelper.CalculateCreateTime(item.MR_CREAT_TIME), data_visitpwd = "", data_visitype = "", data_visi_id = "", date_time = item.MR_CREAT_TIME.ToString(), download_href = "", itemid = item.MR_ITEMID.ToString(), resumeId = item.MR_RESUMEID.ToString(), resume_title = item.MR_TITLE }; myResumes.Add(myResume); } } else { return(RedirectToAction("Index", "Home", new { })); } return(View(myResumes)); }
/// <summary> /// 更新验证密码错误登录次数 /// </summary> /// <param name="User"></param> /// <param name="logerError"></param> /// <returns></returns> public static bool MondifyTimeAndCount(EJ_USER241856 User, int logerError) { int Count = logerError + 1; User.U_LOGIN_ERROR = Count; User.U_LOGIN_TIME = DateTime.Now; User.U_LOGIN_IP = Utility.IPHelper.GetWebClientIp(); User.U_SECRETKEY = Utility.Rand.Str(32); DAL.DalBase <EJ_USER241856> dalBase = new DAL.DalBase <EJ_USER241856>(); return(dalBase.UpdateEntity(User)); }
/// <summary> /// 设置的登陆信息 /// </summary> /// <param name="value"></param> public static void SetLoginInfo(EJ_USER241856 User) { HttpContext.Current.Session.Add(memberEmail, User.U_MAIL); HttpContext.Current.Session.Add(memberHead, User.U_IMG); HttpContext.Current.Session.Add(memberId, User.U_MEMBER_ID); HttpContext.Current.Session.Add(memberIsBindWeixin, false); HttpContext.Current.Session.Add(memberIsVerifyEmail, User.U_EMAIL_CHECK); HttpContext.Current.Session.Add(memberIsVerifyMobile, User.U_MOBILE_CHECK); HttpContext.Current.Session.Add(memberMobile, User.U_MOBILE); HttpContext.Current.Session.Add(memberName, User.U_NICK_NAME); HttpContext.Current.Session.Add(memberSafeKey, User.U_SECRETKEY); HttpContext.Current.Session.Add(memberVip, User.U_TYPE); }
/// <summary> /// 检测邮箱名,是否注册 /// </summary> /// <param name="username"></param> /// <returns></returns> public string check_email(string email) { DAL.DalBase <EJ_USER241856> dalBase = new DAL.DalBase <EJ_USER241856>(); EJ_USER241856 User = dalBase.LoadEntities(a => a.U_MAIL == email).FirstOrDefault(); if (User == null) { return("true"); } else { return("false"); } }
/// <summary> /// 邮箱注册用户 /// </summary> /// <param name="captcha"></param> /// <param name="captchaId"></param> /// <param name="email"></param> /// <param name="enPassword"></param> /// <returns></returns> public JsonResult Submit(string captcha, string captchaId, string email, string enPassword) { if (captcha.Trim() == System.Web.HttpContext.Current.Session["VerificationCode"].ToString()) { System.Web.HttpContext.Current.Session["VerificationCode"] = ""; DAL.DalBase <EJ_USER241856> dalBase = new DAL.DalBase <EJ_USER241856>(); EJ_USER241856 User = dalBase.LoadEntities(a => a.U_MAIL == email).FirstOrDefault(); if (User != null)//判断邮箱号是否存在 { return(Json(new { type = "error", content = "您的邮箱已经被注册了~" }, JsonRequestBehavior.AllowGet)); } else { enPassword = Utility.PwdRSAEncrypt.RSADecrypt(enPassword);//解密密码 Random r = new Random(); User = new EJ_USER241856() { U_CREAT_TIME = DateTime.Now, U_DEL = false, U_EMAIL_CHECK = false, U_IMG = "https://www.baidu.com/img/bd_logo1.png", U_LOGIN_ERROR = 0, U_LOGIN_IP = Utility.IPHelper.GetWebClientIp(), U_LOGIN_TIME = DateTime.Now, U_MAIL = email, U_MEMBER_ID = (1 + dalBase.LoadEntities(a => a.U_MEMBER_ID > 0).OrderByDescending(a => a.U_MEMBER_ID).FirstOrDefault().U_MEMBER_ID), U_MOBILE = "", U_MOBILE_CHECK = false, U_NICK_NAME = "", U_PWD = Utility.PwdRSAEncrypt.RSAEncrypt(enPassword), U_SECRETKEY = Utility.Rand.Str(32), U_TYPE = 0 }; User = dalBase.AddEntity(User); if (User.U_ID > 0) { return(Json(new { type = "success", content = "注册成功,请用重新登录!" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { type = "error", content = "注册失败,请刷新重新输入!" }, JsonRequestBehavior.AllowGet)); } } } return(Json(new { type = "error", content = "验证码错误,请重新输入!" }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取登陆信息 /// </summary> /// <returns></returns> public static EJ_USER241856 GetLoginInfo() { if (HttpContext.Current.Session[memberId] != null) { EJ_USER241856 User = new EJ_USER241856() { U_MAIL = HttpContext.Current.Session[memberEmail].ToString(), U_IMG = HttpContext.Current.Session[memberHead].ToString(), U_MEMBER_ID = (int)HttpContext.Current.Session[memberId], U_EMAIL_CHECK = (bool)HttpContext.Current.Session[memberIsVerifyEmail], U_MOBILE_CHECK = (bool)HttpContext.Current.Session[memberIsVerifyMobile], U_MOBILE = HttpContext.Current.Session[memberMobile].ToString(), U_NICK_NAME = HttpContext.Current.Session[memberName].ToString(), U_SECRETKEY = HttpContext.Current.Session[memberSafeKey].ToString(), U_TYPE = (int)HttpContext.Current.Session[memberVip] }; return(User); } else { return(null); } }
/// <summary> /// 手机号、邮箱号登录 /// </summary> /// <param name="username"></param> /// <param name="enPassword"></param> /// <param name="service"></param> /// <param name="remember"></param> /// <returns></returns> public JsonResult Submit(string username, string enPassword, string service, bool remember) { //查询用户是否存在 DAL.DalBase <EJ_USER241856> dalBase = new DAL.DalBase <EJ_USER241856>(); EJ_USER241856 User = dalBase.LoadEntities(a => a.U_MAIL == username || a.U_MOBILE == username).FirstOrDefault(); if (User == null) { return(Json(new { type = "error", content = "您输入的用户不存在,请重新输入!" }, JsonRequestBehavior.AllowGet)); } else { //判断用户是否被冻结(拉入黑名单,无法登录) if (User.U_LOGIN_ERROR == 5) //判断是否达到最大登录错误次数 { //上次登录时间 DateTime lastLoginDate = Convert.ToDateTime(User.U_LOGIN_TIME); DateTime nowTime = DateTime.Now; TimeSpan time = nowTime - lastLoginDate; if ((time.TotalMinutes) < 15) //判断登录时间间隔是否大于15分钟 { return(Json(new { type = "error", content = "您已连续登陆失败5次,请" + Convert.ToInt32(15 - time.TotalMinutes) + "分钟后再登录!" }, JsonRequestBehavior.AllowGet)); } else //大于时间间隔,登陆失败次数=0 { string[] Result = CheckPwd(User, username, -1, enPassword); //判断用户密码是否正确 return(Json(new { type = Result[0], content = Result[1] }, JsonRequestBehavior.AllowGet)); } } else //登陆没有达到最大次数 { string[] Result = CheckPwd(User, username, User.U_LOGIN_ERROR, enPassword); //验证密码 return(Json(new { type = Result[0], content = Result[1] }, JsonRequestBehavior.AllowGet)); } } }
/// <summary> /// 验证密码是否正确 /// </summary> /// <param name="User">用户对象</param> /// <param name="ErrorCount">登录错误次数</param> /// <param name="InputPasswd">用户输入的密码,已经解密(非对称RSA)</param> /// <returns></returns> public static string[] CheckPwd(EJ_USER241856 User, string username, int errorCount, string enPassword) { //解密用户密码 enPassword = Utility.PwdRSAEncrypt.RSADecrypt(enPassword); string[] result = new string[2]; if (enPassword == Utility.PwdRSAEncrypt.RSADecrypt(User.U_PWD))//登录成功! { //更新错误次数,并绑定用户信息 MondifyTimeAndCount(User, -1); //绑定cookie Utility.BaseCookies.SetCookieValue("memberEmail", User.U_MAIL); //用户邮箱 Utility.BaseCookies.SetCookieValue("memberHead", User.U_IMG); //用户头像 Utility.BaseCookies.SetCookieValue("memberId", User.U_MEMBER_ID.ToString()); //用户ID Utility.BaseCookies.SetCookieValue("memberIsBindWeixin", "false"); //是否绑定微信 Utility.BaseCookies.SetCookieValue("memberIsVerifyEmail", User.U_EMAIL_CHECK.ToString()); //用户邮箱是否已验证 Utility.BaseCookies.SetCookieValue("memberIsVerifyMobile", User.U_MOBILE_CHECK.ToString()); //用户手机是否已验证 Utility.BaseCookies.SetCookieValue("memberMobile", User.U_MOBILE); //用户手机 Utility.BaseCookies.SetCookieValue("memberName", User.U_NICK_NAME); //用户名 //Utility.BaseCookies.SetCookieValue("memberRegisterDate", User.USER_PHOTO);//用户注册时间 Utility.BaseCookies.SetCookieValue("memberSafeKey", User.U_SECRETKEY); //用户安全密匙 // Utility.BaseCookies.SetCookieValue("memberSign", User.USER_PHOTO); Utility.BaseCookies.SetCookieValue("memberVip", User.U_TYPE.ToString()); //会员类型 Utility.SessionHelper.SetLoginInfo(User); result[0] = "success"; result[1] = "/"; if (Utility.PageValidate.IsEmail(username))//判断手机或邮箱 { //邮箱 if (!User.U_EMAIL_CHECK)//判断邮箱是否验证 { result[1] = "/Member/CheckEmail"; } } else { //手机 if (!User.U_MOBILE_CHECK)//判断手机是否验证 { result[1] = "/Member/CheckMobile"; } } } else//密码输入错误! { if ((5 - (errorCount + 1)) == 0) //登陆失败最大次数 { MondifyTimeAndCount(User, 4); DateTime lastLoginDate = Convert.ToDateTime(User.U_LOGIN_TIME); DateTime nowTime = DateTime.Now; TimeSpan Time = nowTime - lastLoginDate; result[0] = "error"; result[1] = "您已连续登录失败5次,请" + Convert.ToInt32(15 - Time.TotalMinutes) + "分钟后重试!"; } else { MondifyTimeAndCount(User, errorCount); result[0] = "error"; result[1] = "密码错误,登陆失败,您还有" + Convert.ToString(5 - (errorCount + 1)) + "次机会!"; } } return(result); }
/// <summary> /// 简历在线编辑 /// </summary> /// <returns></returns> public ActionResult Edit(int itemid = 206, int resumeId = 0) { ViewBag.itemid = itemid; ViewBag.resumeid = 0; EJ_USER241856 User = Utility.SessionHelper.GetLoginInfo(); DAL.DalBase <EJ_RESUME_BANK547852> dalBaseRB = new DAL.DalBase <EJ_RESUME_BANK547852>(); EJ_RESUME_BANK547852 ResumeBank = new EJ_RESUME_BANK547852(); resume_base resume_Base = new resume_base(); ///判断用户是否登录 if (User != null && Convert.ToInt32(User.U_MEMBER_ID) > 0) { ViewBag.memberid = User.U_MEMBER_ID; } else { ViewBag.memberid = 0; } ViewBag.Type = true; //默认为加载模板 true :加载模板; false : 加载用户编辑的简历 if (resumeId == 0) //加载模板 { ResumeBank = dalBaseRB.LoadEntities(a => a.RB_ITEMID == itemid).FirstOrDefault(); //没有查询到对应的简历模板信息,加载默认模板 if (ResumeBank == null) { itemid = 206; } ResumeBank = dalBaseRB.LoadEntities(a => a.RB_ITEMID == itemid).FirstOrDefault(); resume_Base.resume_set = new resume_set(ResumeBank.RB_COLOR, ResumeBank.RB_FONT_NAME, ResumeBank.RB_FONT_SIZE, ResumeBank.RB_FONT_HEIGHT, ResumeBank.RB_MODEL_MARGIN, ResumeBank.RB_FONT_TYPE); ViewBag.Title = "在线编辑简历模板"; //判断加载的简历模板CSS ViewBag.ResumeCss = ResumeBank.RB_CONTENT + ".css"; ViewBag.resume_language = ResumeBank.RB_LANGUAGE; ViewBag.template_set = ResumeBank.RB_RESUME_SOFT; } else// 加载用户编辑的简历 { ViewBag.Type = false; DAL.DalBase <EJ_MY_RESUME652145> dalBaseMR = new DAL.DalBase <EJ_MY_RESUME652145>(); EJ_MY_RESUME652145 Resume = dalBaseMR.LoadEntities(a => a.MR_DEL == false && a.MR_RESUMEID == resumeId && a.MR_MEMBER_ID == User.U_MEMBER_ID).FirstOrDefault(); if (Resume == null)//没有查询到用户简历 { //跳转错误界面,提示不存在该简历 return(RedirectToAction("Index", "Home", new { })); } else { resume_Base = JsonConvert.DeserializeObject <resume_base>(Resume.MR_JSON); ViewBag.Title = Resume.MR_TITLE; //判断加载的简历模板CSS ResumeBank = dalBaseRB.LoadEntities(a => a.RB_ITEMID == Resume.MR_ITEMID).FirstOrDefault(); ViewBag.ResumeCss = ResumeBank.RB_CONTENT + ".css"; ViewBag.resume_language = ResumeBank.RB_LANGUAGE; ViewBag.template_set = ResumeBank.RB_RESUME_SOFT; ViewBag.letterShow = "hidden"; if (resume_Base.modul_show.letterShow) { ViewBag.letterShow = ""; } ViewBag.coverShow = "hidden"; if (resume_Base.modul_show.coverShow) { ViewBag.coverShow = ""; } } } ViewBag.ResumeBase = resume_Base; return(View()); }