public static void Del(int index) { UserInfo info = UserInfos[index]; Dal_UserInfo.Del(info.Id); UserInfos.RemoveAt(index); LimitManager.Add(info.UserNumber); }
public static UserInfo Update(string json, int index) { DateTime time = UserInfos[index].RecordTime; UserInfo updateInfo = Utility.JsonDeserializeBySingleData <UserInfo>(json); updateInfo.RecordTime = time; Dal_UserInfo.Update(updateInfo); UserInfos[index] = updateInfo; return(updateInfo); }
public static UserInfo Add(string json) { UserInfo info = Utility.JsonDeserializeBySingleData <UserInfo>(json); info.RecordTime = DateTime.Now; info.Id = Dal_UserInfo.Add(info); if (UserInfos == null) { UserInfos = new List <UserInfo>(); } UserInfos.Insert(0, info); return(info); }
public static List <UserInfo> GetInfos(string strContent, int page, int count) { StringBuilder strWhere = new StringBuilder(); object param = null; if (!string.IsNullOrEmpty(strContent)) { strWhere.Append(" and UserName like @UserName "); param = new { UserName = $"%{strContent}%" }; } strWhere.Append($" order by Id desc limit {count} offset {page * count} "); UserInfos = Dal_UserInfo.GetInfos(strWhere.ToString(), param); return(UserInfos); }
/// <summary> /// 查询用户 /// </summary> /// <param name="username"></param> /// <returns></returns> public static UserInfo GetUser(string username) { return(Dal_UserInfo.GetUser(username)); }
/// <summary> /// 删除用户 /// </summary> /// <param name="username"></param> /// <returns></returns> public static int Delete_User(string username) { return(Dal_UserInfo.Delete_User(username)); }
/// <summary> /// 添加用户 /// </summary> /// <param name="user"></param> /// <returns></returns> public static int Add_User(UserInfo user) { return(Dal_UserInfo.Add_User(user)); }
/// <summary> /// 判断是否存在该用户 /// </summary> /// <param name="user"></param> /// <returns></returns> public static int ExistsUsers(UserInfo user) { return(Dal_UserInfo.ExistsUsers(user)); }
public static List <UserInfo> GetInfos() { List <UserInfo> infos = Dal_UserInfo.GetInfos(string.Empty, null); return(infos); }
public static int GetCount(string strContent) { return(Dal_UserInfo.GetCount(strContent)); }