コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }