Exemplo 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);
        }
Exemplo n.º 2
0
 public void SetContent(Field Field, object Data)
 {
     SetContent (Field.Id, Data);
 }
Exemplo n.º 3
0
 public object GetContent(Field Field)
 {
     return GetContent (Field.Id);
 }
Exemplo n.º 4
0
 public void RemoveField(Field Field)
 {
     this._fields.RemoveAll (delegate (Field f) { return f.Id == Field.Id; });
 }
Exemplo n.º 5
0
 public void AddField(Field Field)
 {
     this._fields.Add (Field);
 }
Exemplo n.º 6
0
 public Content(Field Field, object Data)
 {
     this._id = Field.Id;
     this._type = Field.Type;
     this.Data = Data;
 }
Exemplo n.º 7
0
 public Content(Field field)
 {
     this._id = field.Id;
     this._type = field.Type;
     this.Data = Field.DefaultValue (field.Type);
 }
Exemplo n.º 8
0
        public static Field FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item;
            Field result = new Field ();

            try
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//scms.field)[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.FIELD", exception.Message));

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

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

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

            if (item.ContainsKey ("sort"))
            {
                result._sort = int.Parse ((string)item["sort"]);
            }

            if (item.ContainsKey ("options"))
            {
                try
                {
                    result._options = (Hashtable)item["options"];
                }
                catch
                {

                }
            }

            return result;
        }