コード例 #1
0
ファイル: CustomerRepository.cs プロジェクト: linhlpv/EShop-
        public int Count(CustomerSearchEntity SearchCustomerEntity)
        {
            if (SearchCustomerEntity == null)
            {
                SearchCustomerEntity = new CustomerSearchEntity();
            }
            IQueryable <Customer> Customers = context.Customers;

            Apply(Customers, SearchCustomerEntity);
            return(Customers.Count());
        }
コード例 #2
0
ファイル: CustomerRepository.cs プロジェクト: linhlpv/EShop-
        public List <Customer> List(CustomerSearchEntity SearchCustomerEntity)
        {
            if (SearchCustomerEntity == null)
            {
                SearchCustomerEntity = new CustomerSearchEntity();
            }
            IQueryable <Customer> Customers = context.Customers;

            Apply(Customers, SearchCustomerEntity);
            SkipAndTake(Customers, SearchCustomerEntity);
            return(Customers.ToList());
        }
コード例 #3
0
ファイル: CustomerRepository.cs プロジェクト: linhlpv/EShop-
        private IQueryable <Customer> Apply(IQueryable <Customer> Customers, CustomerSearchEntity SearchCustomerEntity)
        {
            if (SearchCustomerEntity.Id.HasValue)
            {
                Customers = Customers.Where(wh => wh.Id == SearchCustomerEntity.Id.Value);
            }
            if (SearchCustomerEntity.CustomerGroupId.HasValue)
            {
                Customers = Customers.Where(wh => wh.CustomerGroupId == SearchCustomerEntity.CustomerGroupId.Value);
            }
            if (!string.IsNullOrEmpty(SearchCustomerEntity.Username))
            {
                Customers = Customers.Where(T => T.Username.ToLower().Contains(SearchCustomerEntity.Username.ToLower()));
            }

            if (!string.IsNullOrEmpty(SearchCustomerEntity.Display))
            {
                Customers = Customers.Where(T => T.Display.ToLower().Contains(SearchCustomerEntity.Display.ToLower()));
            }

            if (!string.IsNullOrEmpty(SearchCustomerEntity.FacebookId))
            {
                Customers = Customers.Where(T => T.FacebookId.ToLower().Contains(SearchCustomerEntity.FacebookId.ToLower()));
            }

            if (!string.IsNullOrEmpty(SearchCustomerEntity.FacebookEmail))
            {
                Customers = Customers.Where(T => T.FacebookEmail.ToLower().Contains(SearchCustomerEntity.FacebookEmail.ToLower()));
            }

            if (!string.IsNullOrEmpty(SearchCustomerEntity.GoogleId))
            {
                Customers = Customers.Where(T => T.GoogleId.ToLower().Contains(SearchCustomerEntity.GoogleId.ToLower()));
            }

            if (!string.IsNullOrEmpty(SearchCustomerEntity.GoogleEmail))
            {
                Customers = Customers.Where(T => T.GoogleEmail.ToLower().Contains(SearchCustomerEntity.GoogleEmail.ToLower()));
            }
            if (!string.IsNullOrEmpty(SearchCustomerEntity.Picture))
            {
                Customers = Customers.Where(T => T.Picture.ToLower().Contains(SearchCustomerEntity.Picture.ToLower()));
            }

            return(Customers);
        }
コード例 #4
0
ファイル: CustomerService.cs プロジェクト: linhlpv/EShop-
        public List <CustomerEntity> Get(EmployeeEntity EmployeeEntity, CustomerSearchEntity CustomerSearchEntity)
        {
            List <Customer> Customers = UnitOfWork.CustomerRepository.List(CustomerSearchEntity);

            return(Customers.ToList().Select(c => new CustomerEntity(c)).ToList());
        }
コード例 #5
0
ファイル: CustomerService.cs プロジェクト: linhlpv/EShop-
 public int Count(EmployeeEntity EmployeeEntity, CustomerSearchEntity CustomerSearchEntity)
 {
     return(UnitOfWork.CustomerRepository.Count(CustomerSearchEntity));
 }
コード例 #6
0
 public List <CustomerEntity> Get(CustomerSearchEntity SearchCustomerEntity)
 {
     return(CustomerService.Get(EmployeeEntity, SearchCustomerEntity));
 }
コード例 #7
0
 public long Count(CustomerSearchEntity SearchCustomerEntity)
 {
     return(CustomerService.Count(EmployeeEntity, SearchCustomerEntity));
 }