Advertisement
Guest User

Untitled

a guest
May 30th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public IEnumerable<User> users()
  2. {
  3. var users = Userlist();
  4. return users.ToList();
  5. }
  6. public static List<User> Userlist()
  7. {
  8. string strSQL = "";
  9. List<User> users = new List<User>();
  10. strSQL = "select USERID,USERNAME,PASSWORD from USERS";
  11.  
  12. //if (Userlist().Count > 0)
  13. //{
  14. // return Userlist();
  15. //}
  16. //else
  17. //{
  18. using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString))
  19. {
  20. using (var command = new SqlCommand(strSQL, connection))
  21. {
  22. connection.Open();
  23. using (var dataReader = command.ExecuteReader())
  24. {
  25. while (dataReader.Read())
  26. {
  27. users.Add(new User { Id = Convert.ToInt32(dataReader["USERID"]), user = dataReader["USERNAME"].ToString(), password = Decrypt(dataReader["PASSWORD"].ToString()), estatus = true, RememberMe = true });
  28. }
  29. }
  30. }
  31. }
  32. return users;
  33. // }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement