Exemple #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;
 }
Exemple #2
0
        public static Product Load(Guid Id)
        {
            bool success = false;
            Product result = new Product ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns
                (
                    "id",
                    "createtimestamp",
                    "updatetimestamp",
                    "text",
                    "price",
                    "erpid"
                );

            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._text = query.GetString (qb.ColumnPos ("text"));
                    result._price = query.GetDecimal (qb.ColumnPos ("price"));
                    result._erpid = query.GetString (qb.ColumnPos ("erpid"));

                    success = true;
                }
            }

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

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

            return result;
        }
Exemple #3
0
 public void AddItem(Product Product)
 {
     SubscriptionItem item = new SubscriptionItem (this, Product);
     this._items.Add (item);
 }