Beispiel #1
0
        public TGSerializedObject GetTGSerializedObject()
        {
            StringBuilder sb = new StringBuilder();

            string value = null;

            if (Count > 0)
            {
                foreach (Attribute attribute in this)
                {
                    TGSerializedObject tg = attribute.GetTGSerializedObject();
                    sb.Append(tg);
                    sb.Append("||");
                }

                if (sb.Length > 2)
                {
                    sb.Remove(sb.Length - 2, 2);
                }

                value = sb.ToString();
            }

            TGSerializedObject returnValue = new TGSerializedObject();

            returnValue.Add("AttributeDefinitionGuid", AttributeDefinitionGuid);
            returnValue.Add("Attributes", value);
            return(returnValue);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tg"></param>
        public virtual void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            Guid = _tg.GetGuid("Guid");
            if (Guid == Guid.Empty)
            {
                Guid = Guid.NewGuid();
            }

            Active = _tg.GetBoolean("Active");
            LastModifiedDateTime = _tg.GetDateTime("LastModifiedDateTime");
            LastModifiedBy       = _tg.GetNullableGuid("LastModifiedBy");

            string versionTimeStamp = _tg.GetString("VersionTimeStamp");

            if (VersionTimeStamp == null)
            {
                VersionTimeStamp = DateHelper.GetCurrentTimeStamp();
            }
            else
            {
                VersionTimeStamp = versionTimeStamp;
            }

            ParentGuid        = _tg.GetNullableGuid("ParentGuid");
            VersionGuid       = _tg.GetGuid("VersionGuid");
            PersistedDateTime = _tg.GetDateTime("PersistedDateTime");
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_tg"></param>
 public void LoadFromTGSerializedObject(TGSerializedObject _tg)
 {
     Name          = _tg.GetString("Name");
     Value         = _tg.GetString("Value");
     AttributeType = (AttributeTypes)_tg.GetNullableEnum("AttributeType",
                                                         typeof(AttributeTypes));
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_serializedValue"></param>
        public TGListWrapper(string _serializedValue)
        {
            Values = new List <T>();
            TGSerializedObject obj = new TGSerializedObject(_serializedValue);

            LoadFromTGSerializedObject(obj);
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="_name"></param>
        /// <param name="_values"></param>
        public void Add <T>(string _name, List <T> _values) where T : ITGSerializable, new()
        {
            TGListWrapper <T> wrapper = new TGListWrapper <T>(_values);

            TGSerializedObject obj = wrapper.GetTGSerializedObject();

            Properties.Add(_name, new TGSerializedProperty(_name, obj.ToString()));
        }
Beispiel #6
0
        public static T GetTGSerializable <T>(TGSerializedObject _tg) where T : ITGSerializable, new()
        {
            T obj = new T();

            obj.LoadFromTGSerializedObject(_tg);

            return(obj);
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tg"></param>
        public override void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            base.LoadFromTGSerializedObject(_tg);

            MinimumValue = _tg.GetNullableInt64("MinimumValue");
            MaximumValue = _tg.GetNullableInt64("MaximumValue");
            DefaultValue = _tg.GetNullableInt64("DefaultValue");
        }
Beispiel #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_json"></param>
        /// <returns></returns>
        public static TGSerializedObject FromJSON(string _json)
        {
            Dictionary <string, TGSerializedProperty> temp =
                JsonConvert.DeserializeObject <Dictionary <string, TGSerializedProperty> >(_json);

            TGSerializedObject tg = new TGSerializedObject(temp);

            return(tg);
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = base.GetTGSerializedObject();

            tg.Add("MinimumValue", MinimumValue);
            tg.Add("MaximumValue", MaximumValue);
            tg.Add("DefaultValue", DefaultValue);

            return(tg);
        }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tg"></param>
        public void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            int itemCount = _tg.Properties.Count;

            for (int i = 0; i < itemCount; i++)
            {
                T value = _tg.GetITGSerializableObject <T>(Convert.ToString(i));
                Values.Add(value);
            }
        }
Beispiel #11
0
        public override TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = base.GetTGSerializedObject();

            tg.Add("Name", Name);
            tg.Add("Value", Value);
            tg.Add("AttributeType", Enum.GetName(typeof(AttributeTypes), AttributeType));

            return(tg);
        }
Beispiel #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tg"></param>
        public override void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            base.LoadFromTGSerializedObject(_tg);

            MinimumDateTime               = _tg.GetNullableDateTime("MinimumDateTime");
            MaximumDateTime               = _tg.GetNullableDateTime("MaximumDateTime");
            UseFixedDefault               = _tg.GetBoolean("UseFixedDefault");
            FixedDefaultDateTime          = _tg.GetNullableDateTime("FixedDefaultDateTime");
            RelativeDefaultDateTimeOffset = _tg.GetInt64("RelativeDefaultDateTimeOffset");
        }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="_serialized"></param>
        /// <returns></returns>
        public static T GetTGSerializable <T>(string _serialized) where T : ITGSerializable, new()
        {
            T obj = new T();

            TGSerializedObject tg = new TGSerializedObject(_serialized);

            obj.LoadFromTGSerializedObject(tg);

            return(obj);
        }
Beispiel #14
0
        public override void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            base.LoadFromTGSerializedObject(_tg);

            Name  = _tg.GetString("Name");
            Value = _tg.GetString("Value");

            string temp = _tg.GetString("AttributeType");

            AttributeType = (AttributeTypes)Enum.Parse(typeof(AttributeTypes), temp);
        }
Beispiel #15
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="_name"></param>
 /// <returns></returns>
 public T GetITGSerializableObject <T>(string _name) where T : ITGSerializable, new()
 {
     if (Properties.ContainsKey(_name))
     {
         T obj = new T();
         TGSerializedObject temp = new TGSerializedObject(Properties[_name].SerializedValue);
         obj.LoadFromTGSerializedObject(temp);
         return(obj);
     }
     return(default(T));
 }
Beispiel #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_tg"></param>
        public void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            int recordCount = _tg.GetInt32("RecordCount");

            for (int i = 0; i < recordCount; i++)
            {
                string serialized = _tg.GetString(i.ToString());
                T      item       = TGSerializedObject.GetTGSerializable <T>(serialized);
                Add(item);
            }
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = new TGSerializedObject {
                TGObjectType = TGObjectType
            };

            tg.Add("Name", Name);
            tg.Add("Value", Value);
            tg.Add("AttributeType", AttributeType);

            return(tg);
        }
Beispiel #18
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = base.GetTGSerializedObject();

            tg.Add("MinimumDateTime", MinimumDateTime);
            tg.Add("MaximumDateTime", MaximumDateTime);
            tg.Add("UseFixedDefault", UseFixedDefault);
            tg.Add("FixedDefaultDateTime", FixedDefaultDateTime);
            tg.Add("RelativeDefaultDateTimeOffset", RelativeDefaultDateTimeOffset);

            return(tg);
        }
Beispiel #19
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject obj = new TGSerializedObject();

            //TODO - Resolve issues or remove.
            //int i = 0;

            //foreach (T value in Values)
            //{
            //    obj.Add(Convert.ToString(i), value);
            //}

            return(obj);
        }
Beispiel #20
0
        public void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            int?propertyCount = _tg.GetNullableInt32("PropertyCount");

            if (propertyCount != null)
            {
                for (int i = 0; i < propertyCount.Value; i++)
                {
                    string temp = _tg.GetString(i.ToString());

                    Property p = TGSerializedObject.GetTGSerializable <Property>(temp);
                    Add(p);
                }
            }
        }
Beispiel #21
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject obj = new TGSerializedObject
            {
                TGObjectType = TGObjectType
            };

            obj.Add("Guid", Guid);
            obj.Add("Active", Active);
            obj.Add("LastModifiedBy", LastModifiedBy);
            obj.Add("LastModifiedDateTime", LastModifiedDateTime);
            obj.Add("VersionTimeStamp", VersionTimeStamp);
            obj.Add("ParentGuid", ParentGuid);
            obj.Add("VersionGuid", VersionGuid);
            obj.Add("PersistedDateTime", PersistedDateTime);

            return(obj);
        }
Beispiel #22
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = new TGSerializedObject {
                TGObjectType = TGObjectType
            };

            int i = 0;

            foreach (T item in this)
            {
                tg.Add(i.ToString(), item.GetTGSerializedObject().ToString());
                i++;
            }

            tg.Add("RecordCount", i);

            return(tg);
        }
Beispiel #23
0
        public TGSerializedObject GetTGSerializedObject()
        {
            TGSerializedObject tg = new TGSerializedObject {
                TGObjectType = TGObjectType
            };

            tg.Add("PropertyCount", Count);

            int i = 0;

            foreach (Property property in this)
            {
                tg.Add(i.ToString(), property.ToString());

                i++;
            }

            return(tg);
        }
Beispiel #24
0
        /// <summary>
        /// Loads from TG serilizable object.
        /// </summary>
        /// <param name='_tg'>
        /// Bcn.
        /// </param>
        public void LoadFromTGSerializedObject(TGSerializedObject _tg)
        {
            AttributeDefinitionGuid = _tg.GetGuid("AttributeDefinitionGuid");
            string value = _tg.GetString("Attributes");

            if (value != null)
            {
                string[] temp = value.Split(new[] { "||" }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string item in temp)
                {
                    if (!string.IsNullOrEmpty(item))
                    {
                        Attribute attribute = new Attribute();
                        attribute.LoadFromTGSerializedString(item);

                        Add(attribute);
                    }
                }
            }
        }
Beispiel #25
0
        public override string ToString()
        {
            TGSerializedObject obj = GetTGSerializedObject();

            return(obj.ToString());
        }
Beispiel #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_bcnSerializedString"></param>
        public void LoadFromTGSerializedString(string _bcnSerializedString)
        {
            TGSerializedObject tgSerializedObject = new TGSerializedObject(_bcnSerializedString);

            LoadFromTGSerializedObject(tgSerializedObject);
        }
Beispiel #27
0
        public override string ToString()
        {
            TGSerializedObject tg = GetTGSerializedObject();

            return(tg.ToString());
        }