private List<user> list GetAllUser()
public static List<User> UserList()
{
List<User> users = new List<User>();
string sql = "select *from Users";
DataTable dt = DBHelper.DataTables(sql, CommandType.Text, null);
User user = null;
int userRoleId = 0;
int userStateId = 0;
foreach (DataRow item in dt.Rows)
{
user = new User();
user.Id = (int)item["Id"];
user.LoginId = item["LoginId"].ToString();
user.LoginPwd = item["LoginPwd"].ToString();
user.Name = item["Name"].ToString();
user.Address = item["Address"].ToString();
user.Phone = item["Phone"].ToString();
userRoleId = (int)item["UserRoleId"];
userStateId = (int)item["UserStateId"];
user.UserRole = UserRoleService.findUserRole(userRoleId);
user.UserState = UserStateService.findUserState(userStateId);
users.Add(user);
}
DBhelper 自己会写吧
路过学习了