public JsonResult getpassword(string account, string accounttype, string password, string verifycode) { string message = string.Empty; Entity.Error error = Entity.Error.请求成功; var mobilecode = Config.UserConfig.getVerifyCode(account); if (mobilecode != null && mobilecode.Code == verifycode && mobilecode.Deadline >= Config.SiteConfig.getLocalTime()) { if (mobilecode.Account == account) { using (var manage = new bitcms.Data.CMSManage()) { var userBindInfo = manage.getUserBindInfo(accounttype, account); if (userBindInfo != null && userBindInfo.UserId > 0) { manage.updatePassword(userBindInfo.UserId, Entity.passwordType.user, password); } } } else { error = Entity.Error.错误; message = "验证账号和原账号不一致!"; } } else { error = Entity.Error.错误; message = "验证码错误或已经过期!"; } return(this.getResult(error, message)); }
/// <summary> /// 返回JSON数据 /// </summary> /// <param name="error">错误状态</param> /// <param name="messgae">消息</param> /// <returns></returns> public JsonResult getResult(Entity.Error error, string messgae) { return(Json(new { error = error, message = messgae }, JsonRequestBehavior.AllowGet)); }
public void FillParamsDetails(SqlParameterCollection parameters, Entity.Error Entity) { parameters.AddWithValue("@ErrorId", Entity.ErrorId); parameters.AddWithValue("@Message", Entity.Message); parameters.AddWithValue("@IpAddress", Entity.IpAddress); parameters.AddWithValue("@Source", Entity.Source); parameters.AddWithValue("@UserName", Entity.UserName); parameters.AddWithValue("@Browser", Entity.Browser); }
void ErrorLog(string ErrorMsg, string source) { Entity.Error objError = new Entity.Error(); objError.IpAddress = string.IsNullOrEmpty("") ? HttpContext.Current.Request.UserHostAddress : ""; objError.Message = ErrorMsg; objError.Source = source; objError.Browser = Request.Browser.Type; objError.UserName = string.IsNullOrEmpty("") ? "End User" : ""; BAL.Errormgmt.AddUpdateError(objError); }
protected void FillEntityError(IDataReader dr, Entity.Error ObjError, int Type) { ObjError.ErrorId = GetFieldInt(dr, "ErrorId"); ObjError.Message = GetField(dr, "Message"); ObjError.Source = GetField(dr, "Source"); ObjError.UserName = GetField(dr, "UserName"); ObjError.IpAddress = GetField(dr, "IpAddress"); ObjError.Browser = GetField(dr, "Browser"); ObjError.ErrorDate = GetFieldDateTime(dr, "ErrorDate"); }
public virtual int AddUpdateError(Entity.Error Entity) { SqlCommand cmdInsert = new SqlCommand(); cmdInsert.CommandType = CommandType.StoredProcedure; cmdInsert.CommandText = "AddUpdateError"; this.FillParamsDetails(cmdInsert.Parameters, Entity); int res = this.ExecuteNonQuery(cmdInsert); base.ForceCloseConnection(cmdInsert); return(res); }
public virtual List <Entity.Error> GetErrorData(int Id) { List <Entity.Error> lstError = new List <Entity.Error>(); SqlCommand cmdSelect = new SqlCommand(); cmdSelect.CommandType = CommandType.StoredProcedure; cmdSelect.CommandText = "GetErrorData"; cmdSelect.Parameters.AddWithValue("@Id", Id); SqlDataReader dr = this.ExecuteDataReader(cmdSelect); while (dr.Read()) { Entity.Error objError = new Entity.Error(); lstError.Add(objError); this.FillEntityError(dr, objError, 0); } base.ForceCloseConnection(cmdSelect); return(lstError); }
public static int AddUpdateError(Entity.Error Entity) { return(new DAL.ErrorSQL().AddUpdateError(Entity)); }