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", "title" ); 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._title = query.GetString (qb.ColumnPos ("title")); success = true; } } query.Dispose (); query = null; qb = null; if (!success) { throw new Exception (string.Format (Strings.Exception.ManagementLocationLoadGuid, Id)); } return result; }
public static Location FromXmlDocument(XmlDocument xmlDocument) { Hashtable item; Location result = new Location (); try { item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//allectuslib.management.location)[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.ManagementLocationFromXmlDocument, "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 ("parentid")) { result._parentid = new Guid ((string)item["parentid"]); } if (item.ContainsKey ("title")) { result._title = (string)item["title"]; } return result; }