- Data:
- 2009-07-17 16:17:17 (17 years ago)
- Lokalizacja:
- branches/Abonament
- Pliki:
-
- 1 zmodyfikowane
- 1 skopiowane
-
. (zmodyfikowane) (1 prop)
-
BazaReklam/Classes/Repositories/TitleRepository.cs (skopiowane) (skopiowane from trunk/BazaReklam/Classes/Repositories/TitleRepository.cs) (3 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
branches/Abonament
-
Włąściwość:
svn:mergeinfo set
to
/branches/ReklamaReorganizacja:568-731
/trunk:708-753
-
Włąściwość:
svn:mergeinfo set
to
-
branches/Abonament/BazaReklam/Classes/Repositories/TitleRepository.cs
r732 r754 8 8 public class TitleRepository : Repository<Title> 9 9 { 10 private readonly string _connectionString;11 12 10 public TitleRepository(string connectionString) 11 : base(connectionString) 13 12 { 14 _connectionString = connectionString;15 13 } 16 14 … … 21 19 List<Title> titles = new List<Title>(); 22 20 23 SqlConnection conn = null;24 SqlCommand cmd = null;25 SqlDataReader reader = null;26 21 try 27 22 { 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) 33 27 { 34 while ( reader.Read())28 while (_reader.Read()) 35 29 { 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))); 37 31 } 38 32 } … … 40 34 finally 41 35 { 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(); 54 37 } 55 38 return titles; 56 39 } 40 41 public List<Section> FindSectionsByTitle(Title title) 42 { 43 SectionRepository sectionRepository = new SectionRepository(_connectionString); 44 return sectionRepository.FindAllActiveByTitle(title); 45 } 57 46 } 58 47 }
