Pokaż
Ignoruj:
Data:
2009-07-17 16:17:17 (17 years ago)
Autor:
marek
Opis:

merged with latest trunk

Lokalizacja:
branches/Abonament
Pliki:
1 zmodyfikowane
1 skopiowane

Legenda:

Bez zmian
Dodane
Usunięte
  • branches/Abonament

    • Włąściwość: svn:mergeinfo set to
      /branches/ReklamaReorganizacja:568-731
      /trunk:708-753
  • branches/Abonament/BazaReklam/Classes/Repositories/TitleRepository.cs

    r732 r754  
    88    public class TitleRepository : Repository<Title> 
    99    { 
    10         private readonly string _connectionString; 
    11  
    1210        public TitleRepository(string connectionString) 
     11            : base(connectionString) 
    1312        { 
    14             _connectionString = connectionString; 
    1513        } 
    1614 
     
    2119            List<Title> titles = new List<Title>(); 
    2220 
    23             SqlConnection conn = null; 
    24             SqlCommand cmd = null; 
    25             SqlDataReader reader = null; 
    2621            try 
    2722            { 
    28                 conn = new SqlConnection(_connectionString); 
    29                 conn.Open(); 
    30                 cmd = new SqlCommand(query, conn); 
    31                 reader = cmd.ExecuteReader(); 
    32                 if (reader != null) 
     23                _connection.Open(); 
     24                _command = new SqlCommand(query, _connection); 
     25                _reader = _command.ExecuteReader(); 
     26                if (_reader != null) 
    3327                { 
    34                     while (reader.Read()) 
     28                    while (_reader.Read()) 
    3529                    { 
    36                         titles.Add(new Title(reader.GetInt32(0), reader.GetString(1), reader.GetString(2).Trim(), reader.GetDouble(3))); 
     30                        titles.Add(new Title(_reader.GetInt32(0), _reader.GetString(1), _reader.GetString(2).Trim(), _reader.GetDouble(3))); 
    3731                    } 
    3832                } 
     
    4034            finally 
    4135            { 
    42                 if (reader != null) 
    43                 { 
    44                     reader.Close(); 
    45                     reader.Dispose(); 
    46                 } 
    47                 if (cmd != null) cmd.Dispose(); 
    48                 if (conn != null) 
    49                 { 
    50                     conn.Close(); 
    51                     conn.Dispose(); 
    52                 } 
    53  
     36               CleanUp(); 
    5437            } 
    5538            return titles; 
    5639        } 
     40 
     41        public List<Section> FindSectionsByTitle(Title title) 
     42        { 
     43            SectionRepository sectionRepository = new SectionRepository(_connectionString); 
     44            return sectionRepository.FindAllActiveByTitle(title);  
     45        } 
    5746    } 
    5847}