Esempio n. 1
0
        public override Specification <Reservation> GetSpecification()
        {
            var spec = new Specification <Reservation>();

            if (!Ids.IsEmpty())
            {
                int[] ids = ArrayHelpers.StringToIntArray(Ids);
                if (ids != null && ids.Length > 0)
                {
                    spec.And(c => ids.Contains(c.Id));
                }
            }

            if (!ProductIds.IsEmpty())
            {
                int[] ids = ArrayHelpers.StringToIntArray(ProductIds);
                if (ids != null && ids.Length > 0)
                {
                    spec.And(c => ids.Contains(c.ProductId));
                }
            }

            if (!OrderNumber.IsEmpty())
            {
                spec.And(r => r.OrderNumber == OrderNumber);
            }
            if (!Sku.IsEmpty())
            {
                spec.And(r => r.Product.Sku.StartsWith(Sku));
            }
            if (!ShowAll)
            {
                spec.And(r => r.Quantity > 0);
            }
            return(spec);
        }