public void Authen(int id = 0) { EFDbContext db = BaseBll.db; if (id == 0) { AjaxHelps.WriteErrorJson("认证失败"); } else { CompanyInfo ci = new CompanyInfo { CompanyId = id, IsIdentify = true }; try { DbEntityEntry <CompanyInfo> entry = db.Entry <CompanyInfo>(ci); entry.State = System.Data.Entity.EntityState.Unchanged; entry.Property("IsIdentify").IsModified = true; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); } catch (Exception e) { AjaxHelps.WriteErrorJson("认证失败"); return; } AjaxHelps.WriteSucessJson("认证成功"); } }
public void ApplyJob(EntitiesModel.ApplyJob model) { if (model == null) { AjaxHelps.WriteErrorJson("申请失败"); return; } model.Date = DateTime.Now; model.Status = 0; Bll.ApplyJobBll bll = new Bll.ApplyJobBll(); int applyNum = bll.GetUserApplyNum(model.Uid, 0); //用户已申请的简历数 if (applyNum == 5 || applyNum > 5) { AjaxHelps.WriteErrorJson("用户最只能投递5份简历"); return; } if (bll.AddResume(model)) { AjaxHelps.WriteSucessJson("申请成功"); } else { AjaxHelps.WriteErrorJson("申请失败"); } }
public void DeleteInfo(int id = 0, int id2 = 0) { if (!bllCompany.DeleteInfo(id)) { AjaxHelps.WriteErrorJson("删除失败"); } else { AjaxHelps.WriteSucessJson("删除成功"); } }
public void CheckLogin(FormCollection form) { string strLoginType = form["LoginType"]; string strIsAutoLogin = form["isAutoLogin"]; string strCaptcha = form["Captcha"]; string Username = form["Username"]; string Password = form["Password"]; EFDbContext db = BaseBll.db; if (strLoginType == "user") { IQueryable <UserInfo> userAccout = db.UserInfo.Where(o => o.Username == Username); if (userAccout.FirstOrDefault() == null) { AjaxHelps.WriteErrorJson("该用户名不存在!"); } UserInfo ui = userAccout.Where(o => o.Password == Password).SingleOrDefault(); if (ui == null) { AjaxHelps.WriteErrorJson("用户名或密码错误!"); } if (Session[Key.CAPTCHA].ToString() != strCaptcha) { AjaxHelps.WriteErrorJson("验证码错误!"); } Session[Key.Current_User] = ui; GenerateCookie(strIsAutoLogin, ui.Uid.ToString(), 1); AjaxHelps.WriteSucessJson("登录成功"); } else { IQueryable <CompanyInfo> userAccout = db.CompanyInfo.Where(o => o.Username == Username); if (userAccout.FirstOrDefault() == null) { AjaxHelps.WriteErrorJson("该用户名不存在!"); } CompanyInfo ci = userAccout.Where(o => o.PassWord == Password).SingleOrDefault(); if (ci == null) { AjaxHelps.WriteErrorJson("用户名或密码错误!"); } if (Session[Key.CAPTCHA].ToString() != strCaptcha) { AjaxHelps.WriteErrorJson("验证码错误!"); } Session[Key.Current_Company] = ci; GenerateCookie(strIsAutoLogin, ci.CompanyId.ToString(), 2); AjaxHelps.WriteSucessJson("登录成功"); } }
public void RefuseResume(int uid = 0, int jobId = 0) { ApplyJobBll applyBll = new ApplyJobBll(); if (applyBll.Refuse(uid, ViewBag.CompanyId, jobId)) { AjaxHelps.WriteSucessJson("删除成功"); } else { AjaxHelps.WriteErrorJson("删除失败"); } }
public void CreateUserAccout(UserInfo ui) { ModelState.Remove("Name"); if (!ModelState.IsValid) { AjaxHelps.WriteErrorJson("请填写正确信息"); return; } if (bllUserInfo.IsExistUserName(ui.Username)) { AjaxHelps.WriteErrorJson("已存在该用户名!"); return; } if (bllUserInfo.CreateUserAccount(ui.Username, ui.Password)) { AjaxHelps.WriteSucessJson("注册成功"); } else { AjaxHelps.WriteErrorJson("服务错误,请稍后重试!"); } return; }
public void CreateCompanyAccount(CompanyInfo ci) { ModelState.Remove("CompanyName"); if (!ModelState.IsValid) { AjaxHelps.WriteErrorJson("请填写正确信息"); return; } if (bllCompanyInfo.IsExistUserName(ci.Username)) { AjaxHelps.WriteErrorJson("已存在该用户名!"); return; } if (bllCompanyInfo.CreateCompanyAccount(ci.Username, ci.PassWord)) { AjaxHelps.WriteSucessJson("注册成功"); } else { AjaxHelps.WriteErrorJson("服务错误,请稍后重试!"); } return; }