Beispiel #1
0
 public SubscriptionItem(Subscription Subscription, Product Product)
 {
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._subscriptionid = Subscription.Id;
     this._productid = Product.Id;
     this._text = string.Empty;
     this._price = -1m;
 }
Beispiel #2
0
        public static Subscription Load(Guid Id)
        {
            bool success = false;
            Subscription result = new Subscription ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns
                (
                    "id",
                    "createtimestamp",
                    "updatetimestamp",
                    "type",
                    "customerid",
                    "title",
                    "nextbilling"
                );

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._type = SNDK.Convert.StringToEnum<Enums.SubscriptionType> (query.GetString (qb.ColumnPos ("type")));
                    result._customerid = query.GetGuid (qb.ColumnPos ("customerid"));
                    result._title = query.GetString (qb.ColumnPos ("title"));
                    result._nextbilling = query.GetInt (qb.ColumnPos ("nextbilling"));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            result._items = SubscriptionItem.List (result);

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.SubscriptionLoad, Id));
            }

            return result;
        }
Beispiel #3
0
 public static List<SubscriptionItem> List(Subscription Subscription)
 {
     return List (Subscription.Id);
 }