Exemple #1
0
        public static List<Subscription> FetchActiveElapsedSubscriptions(DateTime fromDate, DateTime toDate)
        {
            var subscriptions = new List<Subscription>();
            using (SqlConnection conn = Config.DB.Open())
            {
                SqlDataReader reader = (SqlDataReader)
                    SqlHelper.GetDB().ExecuteReader(
                                            "FetchActiveElapsedSubscriptions", 
                                            fromDate, toDate);

                while (reader.Read())
                {
                    Subscription subscription = new Subscription();

                    subscription.id = (int) reader["ID"];
                    subscription.username = (string) reader["Username"];
                    subscription.planID = (int) reader["PlanID"];
                    subscription.orderDate = (DateTime) reader["OrderDate"];
                    subscription.renewDate = (DateTime) reader["RenewDate"];
                    subscription.confirmed = (bool) reader["Confirmed"];
                    subscription.cancelled = false;
                    subscription.cancellationRequested = (bool) reader["CancellationRequested"];
                    subscription.paymentProcessor = (string)reader["PaymentProcessor"];
                    subscription.custom = reader["Custom"] as string;

                    subscriptions.Add(subscription);
                }
                return subscriptions;
            }
        }
Exemple #2
0
        public static Subscription FetchActiveSubscription(string username)
        {
            using (SqlConnection conn = Config.DB.Open())
            {
                SqlDataReader reader = (SqlDataReader) 
                    SqlHelper.GetDB().ExecuteReader(
                                            "FetchActiveSubscription", username);

                if (reader.Read())
                {
                    Subscription subscription = new Subscription();

                    subscription.id = (int) reader["ID"];
                    subscription.username = (string) reader["Username"];
                    subscription.planID = (int) reader["PlanID"];
                    subscription.orderDate = (DateTime) reader["OrderDate"];
                    subscription.renewDate = (DateTime) reader["RenewDate"];
                    subscription.confirmed = (bool) reader["Confirmed"];
                    subscription.cancelled = false;
                    subscription.cancellationRequested = (bool) reader["CancellationRequested"];
                    subscription.paymentProcessor = (string)reader["PaymentProcessor"];
                    subscription.custom = reader["Custom"] as string;

                    return subscription;
                }
                return null;
            }
        }