public ActionResult CheckName(string id) { SuggestionRes response = new SuggestionRes(); #region 各种校验 #endregion response.errorCode = 0; return Json(response); }
public JsonResult Index(ShenQing entity) { SuggestionRes response = new SuggestionRes(); #region 各种校验 if (string.IsNullOrWhiteSpace(entity.BaoXiuRen)) { response.errorCode = 2; return Json(response); } if (string.IsNullOrWhiteSpace(entity.LianXiDianHua)) { response.errorCode = 3; return Json(response); } if (string.IsNullOrWhiteSpace(entity.MiaoShu)) { response.errorCode = 4; return Json(response); } #endregion Account account = GetCurrentAccount(); entity.HuiYuanId = account.Id; entity.BiaoShi = account.BiaoShi; entity.CreatePerson = account.PersonName; string returnValue = string.Empty; IChuLiBLL m_BLL = new ChuLiBLL(); if (!m_BLL.CreateAndCopy(ref validationErrors, entity)) { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return true; }); } response.errorCode = 99; response.content = returnValue; return Json(response); } response.errorCode = 0; return Json(response); }
public ActionResult Index(string id, string validCode, string phone) { SuggestionRes response = new SuggestionRes(); #region 各种校验 if (string.IsNullOrWhiteSpace(validCode)) { response.errorCode = 1; return Json(response); } if (string.IsNullOrWhiteSpace(phone) || (!Validator.IsPhone(phone))) { response.errorCode = 2; return Json(response); } if (string.IsNullOrWhiteSpace(validCode)) { response.errorCode = 3; return Json(response); } if (Session["__VCode"] == null || (Session["__VCode"].ToString() != validCode)) { response.errorCode = 6; return Json(response); } #endregion IHuiYuanBLL m_BLL = new HuiYuanBLL(); response.errorCode = m_BLL.GetByPhone(phone, id); //如果成功了,将手机号放入cookies中 Utils.WriteCookie("PhoneFind", phone, 1); return Json(response); }
public ActionResult Comment(string id, ChuLi entity) { SuggestionRes response = new SuggestionRes(); #region 各种校验 if (!Validator.IsNumber(entity.DaFen.GetString())) { response.errorCode = 2; return Json(response); } if (string.IsNullOrWhiteSpace(entity.PingLun)) { response.errorCode = 4; return Json(response); } #endregion string currentPerson = GetCurrentPerson(); string returnValue = string.Empty; IChuLiBLL m_BLL = new ChuLiBLL(); if (!m_BLL.Comment(ref validationErrors, entity)) { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return true; }); } response.errorCode = 1; response.content = returnValue; return Json(response); } response.errorCode = 0; return Json(response); }
public ActionResult Index(LoginViewModel model) { SuggestionRes response = new SuggestionRes(); #region 各种校验 if (string.IsNullOrWhiteSpace(model.BiaoShi)) {//标识是否存在 response.errorCode = 11; return Json(response); } if (string.IsNullOrWhiteSpace(model.UserName)) { response.errorCode = 2; return Json(response); } if (string.IsNullOrWhiteSpace(model.Password)) { response.errorCode = 3; return Json(response); } if (model.UserName.Length > 50) { response.errorCode = 4; return Json(response); } if (model.Password.Length > 20 || model.Password.Length < 6) { response.errorCode = 5; return Json(response); } #endregion Langben.IBLL.IHuiYuanBLL m_BLL = new HuiYuanBLL(); ValidationErrors validationErrors = new ValidationErrors(); HuiYuan item = m_BLL.GetByPhone(model.UserName, model.Password, model.BiaoShi); if (item != null) { if (item.State == "未审核") { response.errorCode = 6; } else { //写cookie Account account = new Account(); account.Name = item.MyName; account.PersonName = item.Name; account.Id = item.Id; account.BiaoShi = model.BiaoShi; Utils.WriteCookie("myaccount", account, 7); Utils.WriteCookie("SchoolName", item.SchoolName, 7); Utils.WriteCookie("Name", item.Name, 7); Utils.WriteCookie("PhoneNumber", item.PhoneNumber, 7); Utils.WriteCookie("BiaoShi", model.BiaoShi, 7); response.errorCode = 0; } } else { response.errorCode = 1; } return Json(response); }
public ActionResult Register(RegisterViewModel model) { SuggestionRes response = new SuggestionRes(); #region 各种校验 if (string.IsNullOrWhiteSpace(model.BiaoShi)) {//标识是否存在 response.errorCode = 11; return Json(response); } var vali = Validator.IsPassword(model.Password); if (vali != 0) {//标识是否存在 response.errorCode = vali; return Json(response); } if (model.Password != model.ConfirmPassword) { response.errorCode = 9; return Json(response); } if (string.IsNullOrWhiteSpace(model.UserName)) { response.errorCode = 20; return Json(response); } if (model.UserName.Length > 50) { response.errorCode = 21; return Json(response); } if (!Validator.IsMobile(model.UserName)) { response.errorCode = 22; return Json(response); } #endregion Langben.IBLL.IHuiYuanBLL m_BLL = new HuiYuanBLL(); if (m_BLL.IsPhone(model.UserName, model.BiaoShi)) { response.errorCode = 23; return Json(response); } ValidationErrors validationErrors = new ValidationErrors(); HuiYuan entity = new HuiYuan() { Password = model.Password , PhoneNumber = model.UserName , CreateTime = DateTime.Now , BiaoShi = model.BiaoShi , State = "未审核" , LogonIP = Common.IP.GetIP() }; entity.Id = Result.GetNewId(); string returnValue = string.Empty; if (m_BLL.Create(ref validationErrors, entity)) { response.errorCode = 0; return Json(response); } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return true; }); } //LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",注册的信息," + returnValue, "注册" // );//写入日志 response.errorCode = 99; return Json(response); //提示插入失败 } }
public ActionResult FindPassword(string id, string validCode) { SuggestionRes response = new SuggestionRes(); #region 各种校验 #endregion //校验验证码是否正确 //如果正确 var vcode = Utils.ReadCookie("vcode"); //从cookies中获取手机号码 var phone = Utils.ReadCookie("PhoneFind"); IHuiYuanBLL m_BLL = new HuiYuanBLL(); var data = m_BLL.GetByPhoneVC(phone, vcode, id); if (data != null) { response.errorCode = 0; } else { response.errorCode = 1; } return Json(response); }
public ActionResult NewPassword(string id, string newpassword, string password) { SuggestionRes response = new SuggestionRes(); #region 各种校验 // 获取cookies记录的验证码,如果不存在,就给出过期提示,如果存在,则销毁cookies,从安全角度考虑 string vcode = Utils.ReadCookie("vcode"); if (string.IsNullOrWhiteSpace(vcode)) { response.errorCode = 1; return Json(response); } else { Utils.DeleteCookie("vcode"); } #endregion //从cookies中获取手机号码phone //安全,拒绝漏洞 //将用户信息写入cookies,这样在下一个页面就可以自动登录了 string phone = Utils.ReadCookie("PhoneFind"); if (string.IsNullOrWhiteSpace(phone)) { response.errorCode = 1; return Json(response); } else { Utils.DeleteCookie("PhoneFind"); } Langben.IBLL.IHuiYuanBLL m_BLL = new HuiYuanBLL(); ValidationErrors validationErrors = new ValidationErrors(); HuiYuan item = m_BLL.NewPassword(phone, newpassword, id); if (item != null) { //写cookie Account account = new Account(); account.Name = item.MyName; account.PersonName = item.Name; account.Id = item.Id; account.BiaoShi = id; Utils.WriteCookie("myaccount", account, 7); Utils.WriteCookie("BiaoShi", id, 7); response.errorCode = 0; } else { response.errorCode = 1; } return Json(response); }
public ActionResult SendMobileCheckCode(string id) { SuggestionRes response = new SuggestionRes(); #region 各种校验 //从cookies中获取手机号码 var phone = Utils.ReadCookie("PhoneFind"); if (string.IsNullOrWhiteSpace(phone)) { response.errorCode = 2; return Json(response); } //验证手机号的状态是否是启用,并且标识(id)也正确 //验证码的时间不能超过半小时 #endregion //随机生成六位数字,并更新到数据库,还有当前时间 string vnum = Utils.GetByRndNum(6); IHuiYuanBLL m_BLL = new HuiYuanBLL(); response.errorCode = m_BLL.SetVC(phone, vnum, id); if (response.errorCode == 0) { //向手机发送验证码 ServiceReference1.MessageServiceSoapClient client = new ServiceReference1.MessageServiceSoapClient(); ServiceReference1.Mess mess = new ServiceReference1.Mess(); mess.Message1 = "【维修】"+vnum; mess.Phone = phone; mess.Token = "weixiu123?"; var data = client.MessageAdd(mess); if (data!=1) { } //使用cookies记录验证码,过期时间为1小时 Utils.WriteCookie("vcode", vnum, 0.1); } return Json(response); }