/// <summary> /// 获取用户信息 /// </summary> /// <returns>DateSet类型,返回用户信息数据集</returns> public DataSet UserFill() { SH = new SqlHelp(); string str = "select UserID,UserName,RoleId from UserInfo"; SH.SqlCom(str, CommandType.Text); return SH.SqlFillDs(); }
/// <summary> /// 获取用户姓名 /// </summary> /// <param name="UserID">用户编号</param> /// <returns>string类型,返回字符串类型用户姓名</returns> public string GetUserName(string UserID) { SH = new SqlHelp(); string str = "select UserName from UserInfo where UserID=@UserID"; SH.SqlCom(str, CommandType.Text); SH.SqlPar("@UserID", UserID); return SH.SqlES().ToString(); }
/// <summary> /// 获取用户编号 /// </summary> /// <param name="userName">用户姓名</param> /// <returns>string类型,返回字符串类型用户编号</returns> public string GetUserID(string userName) { SH = new SqlHelp(); string str = "select UserID from UserInfo where UserName=@UserName"; SH.SqlCom(str, CommandType.Text); SH.SqlPar("@UserName", userName); return SH.SqlES().ToString(); }
/// <summary> /// 更新用户信息 /// </summary> public void UserUpdate() { SH = new SqlHelp(); SH.SqlUpdate(); }
/// <summary> /// 获取Command和Parmeter /// </summary> /// <param name="str">Command语句</param> /// <param name="User">用户信息实体</param> void UserNCP(string str,UserInfo User,CommandType ct) { SH = new SqlHelp(); SH.SqlCom(str, ct); SH.SqlPar("@userID", User.UserID); SH.SqlPar("@userPwd", User.UserPwd); }
/// <summary> /// 读取用户信息 /// </summary> /// <param name="UserID">用户编号</param> /// <returns>UserInfo类型,存储用户信息实体</returns> public UserInfo UserRead(string UserID) { SH = new SqlHelp(); string str = "select UserID,UserPwd,UserName,RoleId from UserInfo where UserID=@UserID"; SH.SqlCom(str, CommandType.Text); SH.SqlPar("@UserID", UserID); DataSet ds= SH.SqlFillDs(); UserInfo user =new UserInfo( ds.Tables[0].Rows[0].ItemArray[0].ToString(), ds.Tables[0].Rows[0].ItemArray[1].ToString(), ds.Tables[0].Rows[0].ItemArray[2].ToString(), (int)ds.Tables[0].Rows[0].ItemArray[3] ); return user; }