예제 #1
0
 public Collection(CollectionSchema CollectionSchema, string Title)
 {
     this._id = Guid.NewGuid ();
     this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
     this._collectionschemaid = CollectionSchema.Id;
     this._title = Title;
     this._sort = 0;
     this._contents = new List<Content> ();
 }
예제 #2
0
        public static CollectionSchema Load(Guid id)
        {
            CollectionSchema result;

            try
            {
                Hashtable item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (SorentoLib.Services.Datastore.Get<XmlDocument> (DatastoreAisle, id.ToString ()).SelectSingleNode ("(//scms.collectionschema)[1]")));
                result = new CollectionSchema ();

                result._id = new Guid ((string)item["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 ("fields"))
                {
                    foreach (XmlDocument field in (List<XmlDocument>)item["fields"])
                    {
                        result._fields.Add (Field.FromXmlDocument (field));
                    }
                }
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SCMS.COLLECTIONSCHEMA", exception.Message));

                // EXCEPTION: Excpetion.CollectionSchemaLoadGuid
                throw new Exception (string.Format (Strings.Exception.CollectionSchemaLoadGuid, id.ToString ()));
            }

            return result;
        }
예제 #3
0
 public static List<Collection> List(CollectionSchema CollectionSchema)
 {
     return List (CollectionSchema.Id);
 }
예제 #4
0
        public static CollectionSchema FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item;
            CollectionSchema result;

            try
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//scms.collectionschemal)[1]")));
            }
            catch
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument);
            }

            if (item.ContainsKey ("id"))
            {
                try
                {
                    result = Load (new Guid ((string)item["id"]));
                }
                catch
                {
                    result = new CollectionSchema ();
                    result._id = new Guid ((string)item["id"]);
                }
            }
            else
            {
                // EXCEPTION: Exception.CollectionSchemaFromXMLDocument
                throw new Exception (Strings.Exception.CollectionSchemaFromXMLDocument);
            }

            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 ("fields"))
            {
                result._fields.Clear ();
                foreach (XmlDocument field in (List<XmlDocument>)item["fields"])
                {
                    result._fields.Add (Field.FromXmlDocument (field));
                }
            }

            return result;
        }