Ejemplo n.º 1
0
        public List <User> GetAllUsersWithAward(Award award)
        {
            try
            {
                List <User> usersList = new List <User>();

                using (SqlConnection connection = new SqlConnection(_connectionString))
                {
                    var stProc = "GetAllPersonsWithAward";

                    var command = new SqlCommand(stProc, connection)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    SqlParameter idParam = new SqlParameter("@id", award.id);
                    command.Parameters.Add(idParam);

                    connection.Open();

                    var reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        usersList.Add(usersDao.GetUserByID(Guid.Parse(reader["personid"] as string)));
                    }
                }

                return(usersList);
            }
            catch (SqlException)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
 public User GetUserByID(int ID)
 {
     try
     {
         return(_usersDAO.GetUserByID(ID));
     }
     catch (Exception ex)
     {
         Logger.Log.Error(ex.Message);
         return(null);
     }
 }
Ejemplo n.º 3
0
 public User GetUserByID(Guid id) => daoUsers.GetUserByID(id);
Ejemplo n.º 4
0
 public User GetUserByID(int ID)
 {
     return(_usersDAO.GetUserByID(ID));
 }