public CustomerSubscription GetCustomerSubscription(int CustomerID, int SubscriptionID)
        {
            var result = new CustomerSubscription();

            using (var reader = GetContext().GetReader(@"
                    SELECT
                        SubscriptionID,
                        CustomerID,
                        IsActive,
                        StartDate,
                        ExpireDate
                    FROM CustomerSubscriptions
                    WHERE 
                        CustomerID = {0}
                        AND SubscriptionID = {1}
                ", CustomerID, SubscriptionID))
            {
                if (!reader.Read())
                {
                    return(null);
                }

                result.CustomerID     = reader.GetInt32("CustomerID");
                result.SubscriptionID = reader.GetInt32("SubscriptionID");
                result.IsActive       = reader.GetBoolean("IsActive");
                result.StartDate      = reader.GetDateTime("StartDate");
                result.ExpirationDate = reader.GetDateTime("ExpireDate");
            }

            return(result);
        }
        public CustomerSubscription GetCustomerSubscription(int CustomerID, int SubscriptionID)
        {
            var result = new CustomerSubscription();

            var response = GetContext().CustomerSubscriptions
                           .Where(c => c.CustomerID == CustomerID)
                           .Where(c => c.SubscriptionID == SubscriptionID)
                           .FirstOrDefault();

            if (response == null)
            {
                return(null);
            }

            result.CustomerID     = CustomerID;
            result.SubscriptionID = SubscriptionID;
            result.IsActive       = (response.SubscriptionStatus.SubscriptionStatusID == 1);
            result.StartDate      = response.StartDate;
            result.ExpirationDate = response.ExpireDate;

            return(result);
        }
        public CustomerSubscription GetCustomerSubscription(int CustomerID, int SubscriptionID)
        {
            var result = new CustomerSubscription();

            var response = GetContext().GetSubscription(new GetSubscriptionRequest()
            {
                CustomerID     = CustomerID,
                SubscriptionID = SubscriptionID
            });

            if (response == null)
            {
                return(null);
            }

            result.CustomerID     = CustomerID;
            result.SubscriptionID = SubscriptionID;
            result.IsActive       = (response.Status == Exigo.Api.WebService.SubscriptionStatus.Active);
            result.StartDate      = response.StartDate;
            result.ExpirationDate = response.ExpireDate;

            return(result);
        }