示例#1
0
        public static void Del(int index)
        {
            UserInfo info = UserInfos[index];

            Dal_UserInfo.Del(info.Id);
            UserInfos.RemoveAt(index);
            LimitManager.Add(info.UserNumber);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 /// <summary>
 /// 查询用户
 /// </summary>
 /// <param name="username"></param>
 /// <returns></returns>
 public static UserInfo GetUser(string username)
 {
     return(Dal_UserInfo.GetUser(username));
 }
示例#6
0
 /// <summary>
 /// 删除用户
 /// </summary>
 /// <param name="username"></param>
 /// <returns></returns>
 public static int Delete_User(string username)
 {
     return(Dal_UserInfo.Delete_User(username));
 }
示例#7
0
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static int Add_User(UserInfo user)
 {
     return(Dal_UserInfo.Add_User(user));
 }
示例#8
0
 /// <summary>
 /// 判断是否存在该用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static int ExistsUsers(UserInfo user)
 {
     return(Dal_UserInfo.ExistsUsers(user));
 }
示例#9
0
        public static List <UserInfo> GetInfos()
        {
            List <UserInfo> infos = Dal_UserInfo.GetInfos(string.Empty, null);

            return(infos);
        }
示例#10
0
 public static int GetCount(string strContent)
 {
     return(Dal_UserInfo.GetCount(strContent));
 }