/// <summary> /// 获取所有用户by key /// </summary> /// <returns></returns> public static List<User> getAllUser(string key, string currentUserLoginName) { List<User> list = new List<User>(); DataTable dt = null; string sql = string.Format("select top 10 * from ht_userInfo where (nickName like '%{0}%' or nickNamePy like '%{0}%') and loginName<>'{1}' and status=0 ", key, currentUserLoginName); try { dt = SqlHelper.ExecuteDataset(ConnString.GetConString, CommandType.Text, sql.ToString()).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { User u = new User(); u.LoginName = dt.Rows[i]["loginName"].ToString(); u.NickName = dt.Rows[i]["nickName"].ToString(); u.Status = int.Parse(dt.Rows[i]["status"].ToString()); list.Add(u); } } catch { } return list; }
/// <summary> /// 获取用户信息 /// </summary> /// <param name="loginName"></param> /// <returns></returns> public static User GetUserInfoByLoginName(string loginName) { User u = new User(); string sql = " select * from ht_userInfo where loginName='" + loginName + "'"; DataSet ds = SqlHelper.ExecuteDataset(ConnString.GetConString, CommandType.Text, sql); if (ds.Tables[0].Rows.Count > 0) { u.NickName = ds.Tables[0].Rows[0]["nickName"].ToString(); } return u; }
/// <summary> /// 获取所有用户 /// </summary> /// <returns></returns> public static List<User> getAllUser() { List<User> list = new List<User>(); DataTable dt = null; string sql = "select * from ht_userInfo where status=0 "; try { dt = SqlHelper.ExecuteDataset(ConnString.GetConString, CommandType.Text, sql.ToString()).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { User u = new User(); u.LoginName = dt.Rows[i]["loginName"].ToString(); u.NickName = dt.Rows[i]["nickName"].ToString(); u.Status = int.Parse(dt.Rows[i]["status"].ToString()); list.Add(u); } } catch { } return list; }