Pokaż
Ignoruj:
Data:
2009-11-24 12:21:39 (16 years ago)
Autor:
sylwek
Opis:

Re #195 merged with latest trunk

Lokalizacja:
branches/Emisje
Pliki:
2 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • branches/Emisje

    • Property svn:mergeinfo
      •  

        old new  
         1/branches/Abonament:701-884 
        12/branches/AutoShopper:815-818 
        23/branches/ReklamaReorganizacja:568-731 
        34/tags/BazaReklam_1.1.28:831 
        4 /trunk:774-868 
         5/trunk:774-893 
  • branches/Emisje/eCard/eCardMVC/Platnosci.Core/Linq/Repository.cs

    r867 r895  
    1515    /// <typeparam name="T">The generic type representing the entity we are dealing with</typeparam> 
    1616    /// <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 
    1918    { 
    20         private readonly PlatnosciDataContext _dataContext = new PlatnosciDataContext(); 
     19        protected readonly IDataContext _dataContext; 
    2120 
     21        public Repository(IDataContext dataContext) 
     22        { 
     23            _dataContext = dataContext; 
     24        }   
    2225        public int Count() 
    2326        { 
     
    5760            return _dataContext.GetTable<T>().Where(expression).ToList(); 
    5861        } 
    59  
    6062        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         } 
     63            { 
     64                _dataContext.Insert(entity);             
     65            } 
    7166        public void Delete(T entity) 
    7267        { 
    73             if (entity != null) 
    74             { 
    75                 _dataContext.GetTable<T>().DeleteOnSubmit(entity); 
    76                 _dataContext.SubmitChanges(); 
    77             } 
     68            throw new NotImplementedException(); 
    7869        } 
    79         public void Update(T entity) 
     70        public void SubmitChanges() 
    8071        { 
    8172            _dataContext.SubmitChanges(); 
     
    9283        { 
    9384            return _dataContext.GetTable<T>(); 
    94         }        
     85        } 
     86        public IQueryable<vPlatnosciEcard> FindInvoiceByNipNumber(string nip, string numer) 
     87        { 
     88            return _dataContext.FindInvoiceByNipNumber(nip, numer); 
     89        } 
     90        public IQueryable<vPlatnosciEcard> FindInvoiceById(int id) 
     91        { 
     92            return _dataContext.FindInvoiceById(id); 
     93        } 
     94        public List<PotwierdzeniaEcard> FindItemsByIdFaktury(int idFaktury) 
     95        { 
     96            return _dataContext.FindItemsByIdFaktury(idFaktury); 
     97        } 
     98        public IQueryable<PlatnosciEcard> FindPaymentByOrdernumber(int ordernumber) 
     99        { 
     100            return _dataContext.FindPaymentByOrdernumber(ordernumber); 
     101        } 
    95102    } 
    96103}