Zbiór zmian 870 dla trunk/eCard/eCardMVC/Platnosci.Core/Linq/Repository.cs
- Data:
- 2009-11-03 16:06:42 (16 years ago)
- Pliki:
-
- 1 zmodyfikowane
-
trunk/eCard/eCardMVC/Platnosci.Core/Linq/Repository.cs (zmodyfikowane) (3 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/eCard/eCardMVC/Platnosci.Core/Linq/Repository.cs
r867 r870 15 15 /// <typeparam name="T">The generic type representing the entity we are dealing with</typeparam> 16 16 /// <remarks>We use a 1 to 1 mapping of entity -> SQL table</remarks> 17 public sealed class Repository<T> : IRepository<T> 18 where T : class, IIdentifiable 17 public class Repository<T> : IRepository<T> where T : class, IIdentifiable 19 18 { 20 private readonly PlatnosciDataContext _dataContext = new PlatnosciDataContext(); 19 // private readonly PlatnosciDataContext _dataContext = new PlatnosciDataContext(); 20 //private PlatnosciDataContext _dataContext = new PlatnosciDataContext(); 21 protected readonly IDataContext _dataContext; 21 22 23 public Repository(IDataContext dataContext) 24 { 25 _dataContext = dataContext; 26 } 22 27 public int Count() 23 28 { … … 57 62 return _dataContext.GetTable<T>().Where(expression).ToList(); 58 63 } 59 60 64 public void Insert(T entity) 61 { 62 //DataContext.GetTable<T>().InsertOnSubmit(entity); 63 //DataContext.SubmitChanges(); 64 65 //using (DataContext dc = new WierszowkiDataContext()) 66 //{ 67 _dataContext.GetTable<T>().InsertOnSubmit(entity); 68 _dataContext.SubmitChanges(); 69 //} 70 } 65 { 66 _dataContext.Insert(entity); 67 } 71 68 public void Delete(T entity) 72 69 { 73 if (entity != null) 74 { 75 _dataContext.GetTable<T>().DeleteOnSubmit(entity); 76 _dataContext.SubmitChanges(); 77 } 70 _dataContext.Insert(entity); 78 71 } 79 72 public void Update(T entity) … … 92 85 { 93 86 return _dataContext.GetTable<T>(); 94 } 87 } 88 public IQueryable<vPlatnosciEcard> FindInvoiceByNipNumber(string nip, string numer) 89 { 90 return _dataContext.FindInvoiceByNipNumber(nip, numer); 91 } 92 public IQueryable<vPlatnosciEcard> FindInvoiceById(int id) 93 { 94 return _dataContext.FindInvoiceById(id); 95 } 96 public List<PotwierdzeniaEcard> FindItemsByIdFaktury(int idFaktury) 97 { 98 return _dataContext.FindItemsByIdFaktury(idFaktury); 99 } 95 100 } 96 101 }
