Ejemplo n.º 1
0
        public Global(sCMS.Enums.FieldType Type, string Name)
        {
            this._id = Guid.NewGuid ();
            this._createtimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();
            this._updatetimestamp = SNDK.Date.CurrentDateTimeToTimestamp ();

            this._field = new Field (Type, Name);
            this._content = new Content (this._field);
        }
Ejemplo n.º 2
0
        public void SetContent(Guid Id, object Data)
        {
            try
            {
                Content content = this._contents.Find (delegate (Content c) { return c.Id == Id;});

                if (content == null)
                {
                    CollectionSchema collectionschema = CollectionSchema.Load (this._collectionschemaid);
                    content = new Content (collectionschema.GetField (Id));
                    content.Data = Data;
                }
                else
                {
                    content.Data = Data;
                    this._contents.Add (content);
                }
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SCMS.COLLECTION", exception.Message));

                // EXCEPTION: Exception.CollectionSetContent
                throw new Exception (string.Format (Strings.Exception.CollectionSetContent, Id.ToString ()));
            }
        }
Ejemplo n.º 3
0
        public static Content FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item;
            Content result = new Content ();

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

            try
            {
                result._id = new Guid ((string)item["id"]);
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SCMS.CONTENT", exception.Message));

                // EXCEPTION: Exception.FieldFromXMLDocument
                throw new Exception (Strings.Exception.ContentFromXMLDocument);
            }

            if (item.ContainsKey ("type"))
            {
                result._type = SNDK.Convert.StringToEnum<Enums.FieldType> ((string)item["type"]);
            }

            if (item.ContainsKey ("data"))
            {
                result._data = (string)item["data"];
            }

            return result;
        }
Ejemplo n.º 4
0
        public void SetContent(Guid Id, object Data)
        {
            try
            {
                Content content = this._contents.Find (delegate (Content c) { return c.Id == Id;});

                if (content == null)
                {
                    Template template = Template.Load (this._templateid);
                    content = new Content (template.GetField (Id));
                }

                content.Data = Data;

                this._contents.Add (content);
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SCMS.PAGE", exception.Message));

                // EXCEPTION: Exception.PageSetContent
                throw new Exception (string.Format (Strings.Exception.PageSetContent, Id.ToString ()));
            }
        }