Пример #1
0
        public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key,
                                                         PropertyTemplateType propertyType, Guid objectRef, string groupd, bool isVisible, bool isReadonly, string meta,
                                                         object defaultValue, int groupOrder, int order)
        {
            var propertyTemplate = new PropertyTemplate();

            propertyTemplate.ObjId             = uid;
            propertyTemplate.Name              = name;
            propertyTemplate.Description       = description;
            propertyTemplate.Key               = key;
            propertyTemplate.This2PropertyType = (long)propertyType;

            propertyTemplate.This2NodeTemplate = objectRef;

            propertyTemplate.Group        = groupd;
            propertyTemplate.IsVisible    = isVisible;
            propertyTemplate.IsReadonly   = isReadonly;
            propertyTemplate.Meta         = String.IsNullOrEmpty(meta) ? "" : meta;
            propertyTemplate.DefaultValue = defaultValue == null ? "" : defaultValue.ToString();
            propertyTemplate.GroupOrder   = groupOrder;
            propertyTemplate.Order        = order;

            propertyTemplate.This2PropertyTypeNavigation      = new PropertyType();
            propertyTemplate.This2PropertyTypeNavigation.Type = (long)propertyType;

            if (!_propertyTemplates.ContainsKey(uid))
            {
                _propertyTemplates.Add(uid, propertyTemplate);
            }

            _nodeTemplates[objectRef].PropertyTemplate.Add(propertyTemplate);

            return(CreateTemplateCode.Updated);
        }
Пример #2
0
        public void AddSettingsEntry(string key, object value, string group, PropertyTemplateType type, bool isVisible)
        {
            var settings    = Db.Settings.SingleOrDefault(a => a.ValueKey == key);
            var isNewObject = false;

            if (settings == null)
            {
                settings = new Setting
                {
                    ValueKey = key,
                    Value    = value
                };
                isNewObject = true;
            }
            settings.Type      = (long)type;
            settings.IsVisible = isVisible;
            settings.Group     = group;

            if (isNewObject)
            {
                Db.Settings.Add(settings);
            }
            else
            {
                Db.Settings.Update(settings);
            }
            Db.SaveChanges();
        }
Пример #3
0
 public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key,
                                                  PropertyTemplateType propertyType, Guid nodeTemplate, string groupd, bool isVisible, bool isReadonly, string meta,
                                                  object defaultValue, int groupOrder, int order, PropertyConstraint constraint,
                                                  PropertyConstraintLevel constraintLevel, string constraintMeta = "")
 {
     throw new NotImplementedException();
 }
        private Setting CreateSetting(object value, PropertyTemplateType type)
        {
            var settings = new Setting
            {
                Type     = (long)type,
                ValueKey = "test",
                Value    = value
            };

            return(settings);
        }
        public void AddSettingsEntry(string key, object value, string group, PropertyTemplateType type, bool isVisible)
        {
            var settings = new Setting
            {
                ValueKey  = key,
                Value     = value,
                Type      = (long)type,
                IsVisible = isVisible,
                Group     = @group
            };


            _settings.Add(key, settings);
        }
Пример #6
0
 private PropertyInstance CreatePropertyInstance(string key, object value, PropertyTemplateType type)
 {
     return(new PropertyInstance
     {
         This2PropertyTemplateNavigation = new PropertyTemplate
         {
             Key = key,
             This2PropertyTypeNavigation = new PropertyType
             {
                 Type = (long)type
             }
         },
         Value = value
     });
 }
 public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key,
                                                  PropertyTemplateType propertyType, Guid objectRef, string @group, bool isVisible, bool isReadonly, string meta,
                                                  object defaultValue, int groupOrder, int order)
 {
     return(CreateTemplateCode.Updated);
 }
 public void AddSettingsEntry(string key, object value, string @group, PropertyTemplateType type, bool isVisible)
 {
 }
        public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key,
                                                         PropertyTemplateType propertyType, Guid objectRef, string groupd, bool isVisible, bool isReadonly, string meta,
                                                         object defaultValue, int groupOrder, int order)
        {
            var retValue         = CreateTemplateCode.Updated;
            var propertyTemplate = Db.PropertyTemplates.SingleOrDefault(p => p.ObjId == uid);

            bool isNewObject = false;

            if (propertyTemplate == null)
            {
                isNewObject            = true;
                propertyTemplate       = new PropertyTemplate();
                propertyTemplate.ObjId = uid;
                retValue = CreateTemplateCode.Created;
            }

            propertyTemplate.Name              = name;
            propertyTemplate.Description       = description;
            propertyTemplate.Key               = key;
            propertyTemplate.This2PropertyType = (long)propertyType;

            _propertyExpression(propertyTemplate, objectRef);

            propertyTemplate.Group        = groupd;
            propertyTemplate.IsVisible    = isVisible;
            propertyTemplate.IsReadonly   = isReadonly;
            propertyTemplate.Meta         = String.IsNullOrEmpty(meta) ? "" : meta;
            propertyTemplate.DefaultValue = defaultValue == null ? "" : defaultValue.ToString();
            propertyTemplate.GroupOrder   = groupOrder;
            propertyTemplate.Order        = order;

            if (isNewObject && propertyTemplate.This2NodeTemplate.HasValue)
            {
                Db.PropertyTemplates.Add(propertyTemplate);


                var nodeList = Db.NodeInstances.Where(a => a.This2NodeTemplate == objectRef).ToList();

                propertyTemplate.This2PropertyTypeNavigation = Db.PropertyTypes.SingleOrDefault(a =>
                                                                                                a.Type == propertyTemplate.This2PropertyType);

                foreach (var node in nodeList)
                {
                    var propertyInstance = new PropertyInstance();
                    propertyInstance.ObjId                           = Guid.NewGuid();
                    propertyInstance.This2NodeInstance               = node.ObjId;
                    propertyInstance.This2PropertyTemplate           = propertyTemplate.ObjId;
                    propertyInstance.This2PropertyTemplateNavigation = propertyTemplate;
                    propertyInstance.Value                           = propertyTemplate.DefaultValue;
                    propertyInstance.IsDeleted                       = false;

                    Db.PropertyInstances.Add(propertyInstance);
                }
            }
            else if (isNewObject && propertyTemplate.This2VisuObjectTemplate.HasValue)
            {
                Db.PropertyTemplates.Add(propertyTemplate);
            }
            else
            {
                Db.PropertyTemplates.Update(propertyTemplate);
            }


            return(retValue);
        }
Пример #10
0
 public void AddSettingsEntry(string key, object value, string @group, PropertyTemplateType type, bool isVisible)
 {
     // not needed for unit tests
 }
Пример #11
0
 public void AddSettingsEntry(string key, object value, string group, PropertyTemplateType type, bool isVisible)
 {
     throw new NotImplementedException();
 }
Пример #12
0
 public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key,
                                                  PropertyTemplateType propertyType, Guid objectRef, string groupd, bool isVisible, bool isReadonly, string meta,
                                                  object defaultValue, int groupOrder, int order)
 {
     throw new NotImplementedException();
 }
        public CreateTemplateCode CreatePropertyTemplate(Guid uid, string name, string description, string key, PropertyTemplateType propertyType, Guid objectRef,
                                                         string group, bool isVisible, bool isReadonly, string meta, object defaultValue, int groupOrder, int order)
        {
            var propertyTemplate = new PropertyTemplate
            {
                ObjId             = uid,
                Name              = name,
                Description       = description,
                Key               = key,
                This2PropertyType = (long)propertyType,
                This2NodeTemplate = objectRef,
                Group             = @group,
                IsVisible         = isVisible,
                IsReadonly        = isReadonly,
                Meta              = String.IsNullOrEmpty(meta) ? "" : meta,
                DefaultValue      = defaultValue == null ? "" : defaultValue.ToString(),
                GroupOrder        = groupOrder,
                Order             = order
            };



            _propertyTemplates.Add(uid, propertyTemplate);

            return(CreateTemplateCode.Created);
        }