Ejemplo n.º 1
0
        public static IEnumerable <CustomerWallItem> GetCustomerRecentActivity(GetCustomerRecentActivityRequest request)
        {
            List <CustomerWallItem> wallItems;

            using (var context = ExigoDAL.Sql())
            {
                wallItems = context.Query <CustomerWallItem>(@"
                                SELECT CustomerWallItemID
                                      ,CustomerID
                                      ,EntryDate
                                      ,Text
                                      ,Field1
                                      ,Field2
                                      ,Field3
                                FROM CustomerWall
                                WHERE CustomerID = @CustomerID
								ORDER BY EntryDate DESC
                    ", new
                {
                    CustomerID = request.CustomerID
                }).ToList();
            }

            if (request.StartDate != null)
            {
                wallItems = wallItems.Where(c => c.EntryDate >= request.StartDate).ToList();
            }

            return(wallItems);
        }
Ejemplo n.º 2
0
        public static IEnumerable<CustomerWallItem> GetCustomerRecentActivity(GetCustomerRecentActivityRequest request)
        {
            var query = Exigo.OData().CustomerWall
                 .Where(c => c.CustomerID == request.CustomerID);

            if (request.StartDate != null)
            {
                query = query.Where(c => c.EntryDate >= request.StartDate);
            }

            var items = query
                .OrderByDescending(c => c.EntryDate)
                .Select(c => c)
                .Skip(request.Skip)
                .Take(request.Take);

            foreach (var item in items)
            {
                var wallItem = (CustomerWallItem)item;
                yield return wallItem;
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <CustomerWallItem> GetCustomerRecentActivity(GetCustomerRecentActivityRequest request)
        {
            var query = Exigo.OData().CustomerWall
                        .Where(c => c.CustomerID == request.CustomerID);

            if (request.StartDate != null)
            {
                query = query.Where(c => c.EntryDate >= request.StartDate);
            }

            var items = query
                        .OrderByDescending(c => c.EntryDate)
                        .Select(c => c)
                        .Skip(request.Skip)
                        .Take(request.Take);


            foreach (var item in items)
            {
                var wallItem = (CustomerWallItem)item;
                yield return(wallItem);
            }
        }