예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="qnax.Subscription"/> class.
 /// </summary>
 public Subscription(Customer Customer)
 {
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._customerid = Customer.Id;
 }
예제 #2
0
파일: Customer.cs 프로젝트: sundowndk/qnax
        /// <summary>
        /// Load a <see cref="qnax.Customer"/> instance from database using a <see cref="System.Guid"/> identifier.
        /// </summary>
        public static Customer Load(Guid Id)
        {
            bool success = false;
            Customer result = new Customer ();

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

            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._name = query.GetString (qb.ColumnPos ("name"));

                    success = true;
                }
            }

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

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

            return result;
        }
예제 #3
0
파일: Customer.cs 프로젝트: sundowndk/qnax
        public static Customer FromItem(Hashtable Item)
        {
            Customer result = null;

            if (Item.ContainsKey ("id"))
            {
                try
                {
                    result = Customer.Load (new Guid ((string)Item["id"]));
                }
                catch
                {
                    result = new Customer ();
                    result._id = new Guid ((string)Item["id"]);
                }
            }

            if (result == null)
            {
                result = new Customer ();
            }

            if (Item.ContainsKey ("name"))
            {
                result.Name = (string)Item["name"];
            }

            return result;
        }