예제 #1
0
파일: Server.cs 프로젝트: sundowndk/qnax
        public Server(Location location)
            : base(location)
        {
            Init ();

            this._type = Enums.AssetType.Server;
        }
예제 #2
0
파일: Asset.cs 프로젝트: sundowndk/qnax
 public Asset(Location location)
 {
     Init ();
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._locationid = location.Id;
 }
예제 #3
0
파일: Location.cs 프로젝트: sundowndk/qnax
        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;
        }
예제 #4
0
파일: Location.cs 프로젝트: sundowndk/qnax
        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;
        }