public SubscriptionItem(Subscription Subscription) { this._id = Guid.NewGuid (); this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp (); this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp (); this._subscriptionid = Subscription.Id; this._erpid = string.Empty; this._recurrencetype = AllectusLib.Enums.ItemRecurrenceType.Monthly; this._recurrencecount = 0; this._text = string.Empty; this._unit = string.Empty; this._price = 0; this._notes = string.Empty; }
public static List<SubscriptionItem> List(Subscription Subscription) { return List (Subscription.Id); }
public static Subscription FromXmlDocument(XmlDocument xmlDocument) { Hashtable item; Subscription result = new Subscription (); try { item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//allectuslib.subscription)[1]"))); } catch { item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument); } if (item.ContainsKey ("id")) { result._id = new Guid ((string)item["id"]); } else { throw new Exception (string.Format (Strings.Exception.SubscriptionFromXmlDocument, "ID")); } if (item.ContainsKey ("createtimestamp")) { result._createtimestamp = int.Parse ((string)item["createtimestamp"]); } if (item.ContainsKey ("updatetimestamp")) { result._updatetimestamp = int.Parse ((string)item["updatetimestamp"]); } if (item.ContainsKey ("title")) { result._title = (string)item["title"]; } if (item.ContainsKey ("type")) { result._type = SNDK.Convert.StringToEnum<Enums.SubscriptionType> ((string)item["type"]); } if (item.ContainsKey ("customerid")) { result._customerid = new Guid ((string)item["customerid"]); } else { throw new Exception (string.Format (Strings.Exception.SubscriptionFromXmlDocument, "CUSTOMERID")); } if (item.ContainsKey ("nextbilling")) { result._nextbilling = SNDK.Date.DateTimeToTimestamp (DateTime.ParseExact ((string)item["nextbilling"], "yyyy/MM/dd", null)); } if (item.ContainsKey ("status")) { result._status = SNDK.Convert.StringToEnum<Enums.SubscriptionStatus> ((string)item["status"]); } return result; }
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", "status" ); 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.IntToEnum<Enums.SubscriptionType> (query.GetInt (qb.ColumnPos ("type"))); result._customerid = query.GetGuid (qb.ColumnPos ("customerid")); result._title = query.GetString (qb.ColumnPos ("title")); result._nextbilling = query.GetInt (qb.ColumnPos ("nextbilling")); result._status = SNDK.Convert.StringToEnum<Enums.SubscriptionStatus> (query.GetString (qb.ColumnPos ("status"))); success = true; } } query.Dispose (); query = null; qb = null; if (!success) { throw new Exception (string.Format (Strings.Exception.SubscriptionLoadGuid, Id)); } return result; }
public static void Delete(Subscription Subscription) { Delete (Subscription.Id); }