Ejemplo n.º 1
0
        public Server(Location location)
            : base(location)
        {
            Init ();

            this._type = Enums.AssetType.Server;
        }
Ejemplo n.º 2
0
 public Asset(Location location)
 {
     Init ();
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._locationid = location.Id;
 }
Ejemplo n.º 3
0
        public static Location Load(Guid Id)
        {
            bool success = false;
            Location result = new Location ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns
                (
                    "id",
                    "createtimestamp",
                    "updatetimestamp",
                    "parentid",
                    "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._parentid = query.GetGuid (qb.ColumnPos ("parentid"));
                    result._name = query.GetString (qb.ColumnPos ("name"));

                    success = true;
                }
            }

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

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

            return result;
        }
Ejemplo n.º 4
0
        public static Location FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument);

            Location result;

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

            if (item.ContainsKey ("parentid"))
            {
                result._parentid = new Guid ((string)item["parentid"]);
            }

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

            return result;
        }