Esempio n. 1
0
        public List <MovieUserDAL> GetMovieUsers(int skip, int take)
        {
            List <MovieUserDAL> rv = new List <MovieUserDAL>();

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("GetMovieUsers", Con))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", skip);
                    command.Parameters.AddWithValue("@take", take);

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        MovieUserMapper mapper = new MovieUserMapper(reader);
                        while (reader.Read())
                        {
                            MovieUserDAL c = mapper.ToMovieUser(reader);
                            rv.Add(c);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
            return(rv);
        }
Esempio n. 2
0
        public MovieUserDAL FindMovieUserByID(int MovieUserID)
        {
            MovieUserDAL rv = null;

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("FindMovieUserByID", Con))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@MovieUserID", MovieUserID);

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        MovieUserMapper mapper = new MovieUserMapper(reader);
                        if (reader.Read())
                        {
                            rv = mapper.ToMovieUser(reader);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
            return(rv);
        }