using System; using System.Collections.Generic; using System.Text; using InMemoryDal.Entities; using InMemoryDal.Interfaces; namespace InMemoryDal.InMemoryData { [Serializable] public sealed class CustomerInMemoryDAL : ICustomerDAL { internal List<Customer> CustomerList; static readonly CustomerInMemoryDAL _istance = new CustomerInMemoryDAL(); private CustomerInMemoryDAL() { CustomerList = new List<Customer>(); } internal static CustomerInMemoryDAL Istance { get { return _istance; } } #region ICustomerDAL Members public List<Customer> Search(Guid id, String firstname, String lastname, String address, CustomerDataAdapterHandler customerDataAdapter) { List<Customer> lis = CustomerList; if (firstname != String.Empty) { lis = lis.FindAll(delegate(Customer entity) { return entity.Firstname == firstname; }); } if (id != Guid.Empty) { lis = lis.FindAll(delegate(Customer entity) { return entity.Id == id; }); } if (lastname != String.Empty) { lis = lis.FindAll(delegate(Customer entity) { return entity.Lastname == lastname; }); } if (address != String.Empty) { lis = lis.FindAll(delegate(Customer entity) { return entity.Address == address; }); } return lis; } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)