public List <PRODUCT> Search(PRODUCT Product, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_productDAO.Search(Product, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #2
0
 public List <CUSTOMER> Search(CUSTOMER Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_customerDAO.Search(Entity, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #3
0
 public List <BRAND> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_brandDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #4
0
 public List <INVITATION> Search(INVITATION Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_invititationDAO.Search(Entity, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #5
0
 public List <SHOPPING_CART> Search(SHOPPING_CART Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_shoppingCartDAO.Search(Entity, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #6
0
 public List <ADDRESSINFO> Search(ADDRESSINFO Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public List <ORDERS> Search(ORDERS Order, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_orderDAO.Search(Order, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
 public List <CAMPAIGN> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_campaignDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #9
0
        public List <BONUS> Search(BONUS Bonus, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
        {
            var result = Context.BONUS.AsQueryable();

            if (Bonus != null)
            {
                if (Bonus.ID != 0)
                {
                    result = result.Where(b => b.ID == Bonus.ID);
                }

                if (!String.IsNullOrEmpty(Bonus.Description))
                {
                    result = result.Where(b => b.Description.Contains(Bonus.Description));
                }

                if (Bonus.CustomerID.HasValue)
                {
                    result = result.Where(b => b.CustomerID == Bonus.CustomerID.Value);
                }

                if (!String.IsNullOrWhiteSpace(Bonus.CustomerFullName))
                {
                    result = result.Where(s => (s.CUSTOMER.Name + " " + s.CUSTOMER.Surname).Contains(Bonus.CustomerFullName));
                }

                // useful for filtering expired bonuses
                if (Bonus.Validity.HasValue)
                {
                    result = result.Where(b => b.Validity >= Bonus.Validity);
                }

                if (Bonus.CustomerID.HasValue)
                {
                    result = result.Where(b => b.CustomerID == Bonus.CustomerID);
                }
            }
            TotalRecords = result.Count();
            if (!String.IsNullOrEmpty(OrderExp) && OrderExp.Equals("CustomerFullName"))
            {
                if (SortDirection == SortDirection.Ascending)
                {
                    result = result.OrderBy(c => c.CUSTOMER.Name).ThenBy(c => c.CUSTOMER.Surname);
                }
                else
                {
                    result = result.OrderByDescending(c => c.CUSTOMER.Name).ThenBy(c => c.CUSTOMER.Surname);
                }
            }
            else
            {
                GenericSorterCaller <BONUS> sorter = new GenericSorterCaller <BONUS>();
                result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection);
            }

            // pagination
            return(result.Skip(PageIndex * PageSize).Take(PageSize).ToList());
        }
Example #10
0
 public List <BONUS> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(Search(null, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #11
0
 public List <EASYPAY_PAYMENT> Search(EASYPAY_PAYMENT Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     throw new NotImplementedException();
 }
Example #12
0
        public List <SHOPPING_CART> Search(SHOPPING_CART Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
        {
            var result = Context.SHOPPING_CART.AsQueryable();

            if (Entity != null)
            {
                if (!String.IsNullOrWhiteSpace(Entity.ProductName))
                {
                    result = result.Where(s => s.PRODUCT_ATTRIBUTE.PRODUCT.Name.Contains(Entity.ProductName));
                }

                if (!String.IsNullOrWhiteSpace(Entity.CampaignName))
                {
                    result = result.Where(s => s.CAMPAIGN.Name.Contains(Entity.CampaignName));
                }

                if (!String.IsNullOrWhiteSpace(Entity.CustomerName))
                {
                    result = result.Where(s => (s.CUSTOMER.Name + " " + s.CUSTOMER.Surname).Contains(Entity.CustomerName));
                }

                if (Entity.SearchStartDate.HasValue)
                {
                    result = result.Where(s => s.DateAdded >= Entity.SearchStartDate.Value);
                }

                if (Entity.CampaignID != 0)
                {
                    result = result.Where(s => s.CampaignID == Entity.CampaignID);
                }

                if (!String.IsNullOrWhiteSpace(Entity.ID))
                {
                    result = result.Where(s => s.ID == Entity.ID);
                }
            }

            TotalRecords = result.Count();

            if (!String.IsNullOrEmpty(OrderExp) && OrderExp.Equals("ProductName"))
            {
                if (SortDirection == SortDirection.Ascending)
                {
                    result = result.OrderBy(s => s.PRODUCT_ATTRIBUTE.PRODUCT.Name);
                }
                else
                {
                    result = result.OrderByDescending(s => s.PRODUCT_ATTRIBUTE.PRODUCT.Name);
                }
            }
            else if (!String.IsNullOrEmpty(OrderExp) && OrderExp.Equals("CustomerName"))
            {
                if (SortDirection == SortDirection.Ascending)
                {
                    result = result.OrderBy(s => s.CUSTOMER.Name).ThenBy(s => s.CUSTOMER.Surname);
                }
                else
                {
                    result = result.OrderByDescending(s => s.CUSTOMER.Name).ThenBy(s => s.CUSTOMER.Surname);
                }
            }
            else if (!String.IsNullOrEmpty(OrderExp) && OrderExp.Equals("CampaignName"))
            {
                if (SortDirection == SortDirection.Ascending)
                {
                    result = result.OrderBy(s => s.CAMPAIGN.Name);
                }
                else
                {
                    result = result.OrderByDescending(s => s.CAMPAIGN.Name);
                }
            }
            else
            {
                GenericSorterCaller <SHOPPING_CART> sorter = new GenericSorterCaller <SHOPPING_CART>();
                result = sorter.Sort(result, String.IsNullOrEmpty(OrderExp) ? "ID" : OrderExp, SortDirection);
            }
            // pagination
            return(result.Skip(PageIndex * PageSize).Take(PageSize).ToList());
        }
Example #13
0
 public List <PRODUCT> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_productDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #14
0
 public List <CUSTOMER> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_customerDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #15
0
 public List <ORDER_BONUS> SearchOrderBonuses(int BonusID, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_orderDAO.SearchOrderBonuses(BonusID, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
 public List <CAMPAIGN> Search(CAMPAIGN Campaign, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_campaignDAO.Search(Campaign, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #17
0
 public List <BONUS> Search(BONUS Bonus, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_bonusDAO.Search(Bonus, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #18
0
 public List <RETURN> Search(RETURN Return, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_returnDAO.Search(Return, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #19
0
 public List <CATEGORY> Search(CATEGORY Category, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_categoryDAO.Search(Category, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #20
0
 public List <SHOPPING_CART> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_shoppingCartDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #21
0
 public List <CATEGORY> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_categoryDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #22
0
 public List <BRAND> Search(BRAND Brand, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_brandDAO.Search(Brand, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
 public List <D_ATTRIBUTE> Search(D_ATTRIBUTE Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_attributeDAO.Search(Entity, PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #24
0
 public List <CASH_PAYMENT> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     throw new NotImplementedException();
 }
 public List <D_ATTRIBUTE> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_attributeDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #26
0
 public List <INVITATION> GetAll(int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
 {
     return(_invititationDAO.GetAll(PageSize, PageIndex, out TotalRecords, OrderExp, SortDirection));
 }
Example #27
0
        public List <INVITATION> Search(INVITATION Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
        {
            var result = Context.INVITATION.AsQueryable();

            if (Entity != null)
            {
                if (Entity.ID != 0)
                {
                    result = result.Where(b => b.ID == Entity.ID);
                }

                if (Entity.CustomerID.HasValue)
                {
                    result = result.Where(i => i.CustomerID == Entity.CustomerID);
                }

                if (!String.IsNullOrEmpty(Entity.InvitedMail))
                {
                    result = result.Where(i => i.InvitedMail.Contains(Entity.InvitedMail));
                }

                if (Entity.RegistrationDate != null)
                {
                    result = result.Where(i => i.RegistrationDate == (Entity.RegistrationDate));
                }
            }
            TotalRecords = result.Count();

            GenericSorterCaller <INVITATION> sorter = new GenericSorterCaller <INVITATION>();

            result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection);

            // pagination
            return(result.Skip(PageIndex * PageSize).Take(PageSize).ToList());
        }