/// <summary>
        /// Creates a value editor instance
        /// </summary>
        /// <returns></returns>
        protected virtual PropertyValueEditor CreateValueEditor()
        {
            if (ManifestDefinedPropertyValueEditor != null)
            {
                //detect if the view is a virtual path (in most cases, yes) then convert it
                if (ManifestDefinedPropertyValueEditor.View.StartsWith("~/"))
                {
                    ManifestDefinedPropertyValueEditor.View = IOHelper.ResolveUrl(ManifestDefinedPropertyValueEditor.View);
                }
                return(ManifestDefinedPropertyValueEditor);
            }

            //create a new editor
            var editor = new PropertyValueEditor();

            if (_attribute.EditorView.IsNullOrWhiteSpace())
            {
                throw new NotImplementedException("This method must be implemented if a view is not explicitly set");
            }

            editor.View      = _attribute.EditorView.StartsWith("~/") ? IOHelper.ResolveUrl(_attribute.EditorView) : _attribute.EditorView;
            editor.ValueType = _attribute.ValueType;
            editor.HideLabel = _attribute.HideLabel;
            return(editor);
        }
 public PropertyValueEditorWrapper(PropertyValueEditor wrapped)
 {
     this.HideLabel = wrapped.HideLabel;
     this.View = wrapped.View;
     this.ValueType = wrapped.ValueType;
     foreach (var v in wrapped.Validators)
     {
         Validators.Add(v);
     }
 }
 /// <summary>
 /// reconstruct values from original (default) property value editor
 /// </summary>
 /// <param name="propertyValueEditor"></param>
 public SaveFormatPropertyValueEditor(PropertyValueEditor propertyValueEditor)
 {
     this.HideLabel = propertyValueEditor.HideLabel;
     this.View = propertyValueEditor.View;
     this.ValueType = propertyValueEditor.ValueType;
     foreach (IPropertyValidator propertyValidator in propertyValueEditor.Validators)
     {
         this.Validators.Add(propertyValidator);
     }
 }
        public void Value_Editor_Can_Convert_To_Date_Clr_Type()
        {
            var valueEditor = new PropertyValueEditor
                {
                    ValueType = "DATE"
                };

            var result = valueEditor.TryConvertValueToCrlType("2010-02-05");
            Assert.IsTrue(result.Success);
            Assert.AreEqual(new DateTime(2010, 2, 5), result.Result);
        }
        [TestCase("DATETIME", "", null)] //test empty string for date
        public void Value_Editor_Can_Convert_To_Clr_Type(string valueType, string val, object expected)
        {
            var valueEditor = new PropertyValueEditor
                {
                    ValueType = valueType
                };

            var result = valueEditor.TryConvertValueToCrlType(val);
            Assert.IsTrue(result.Success);
            Assert.AreEqual(expected, result.Result);
        }
        [TestCase("DATETIME", "", "")] //test empty string for date
        public void Value_Editor_Can_Serialize_Value(string valueType, object val, string expected)
        {
            var prop = new Property(1, Guid.NewGuid(), new PropertyType("test", DataTypeDatabaseType.Nvarchar), val);

            var valueEditor = new PropertyValueEditor
                {
                    ValueType = valueType
                };

            var result = valueEditor.ConvertDbToEditor(prop, prop.PropertyType, new Mock<IDataTypeService>().Object);
            Assert.AreEqual(expected, result);
        }
        public void Value_Editor_Can_Convert_To_Json_Object_For_Editor(string value, bool isOk)
        {
            var prop = new Property(1, Guid.NewGuid(), new PropertyType("test", DataTypeDatabaseType.Nvarchar), value);

            var valueEditor = new PropertyValueEditor
                {
                    ValueType = "STRING"
                };

            var result = valueEditor.ConvertDbToEditor(prop, prop.PropertyType, new Mock<IDataTypeService>().Object);
            Assert.AreEqual(isOk, !(result is string));
        }
 public ArchetypePropertyValueEditor(PropertyValueEditor wrapped)
     : base(wrapped)
 {
 }
 public SecureStringPropertyValueEditor(PropertyValueEditor wrapped)
     : base(wrapped)
 {
 }
 public RichTextPropertyValueEditor(PropertyValueEditor wrapped)
     : base(wrapped)
 {
 }
 public DatePropertyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
 {
     Validators.Add(new DateTimeValidator());
 }
 internal PublishValuesMultipleValueEditor(bool publishIds, IDataTypeService dataTypeService, PropertyValueEditor wrapped)
     : base(dataTypeService, wrapped)
 {
     _publishIds = publishIds;
 }
			public MortarPropertyValueEditor(PropertyValueEditor wrapped)
				: base(wrapped)
			{ }
Esempio n. 14
0
        /// <summary>
        /// Creates a value editor instance
        /// </summary>
        /// <returns></returns>
        protected virtual PropertyValueEditor CreateValueEditor()
        {
            if (ManifestDefinedPropertyValueEditor != null)
            {
                //detect if the view is a virtual path (in most cases, yes) then convert it
                if (ManifestDefinedPropertyValueEditor.View.StartsWith("~/"))
                {
                    ManifestDefinedPropertyValueEditor.View = IOHelper.ResolveUrl(ManifestDefinedPropertyValueEditor.View);
                }
                return ManifestDefinedPropertyValueEditor;
            }

            //create a new editor
            var editor = new PropertyValueEditor();

            if (_attribute.EditorView.IsNullOrWhiteSpace())
            {
                throw new NotImplementedException("This method must be implemented if a view is not explicitly set");
            }

            editor.View = _attribute.EditorView;
            editor.ValueType = _attribute.ValueType;
            editor.HideLabel = _attribute.HideLabel;
            return editor;

        }
 public PublishValuesMultipleValueEditor(bool publishIds, PropertyValueEditor wrapped)
     : this(publishIds, ApplicationContext.Current.Services.DataTypeService, wrapped)
 {
 }
 public PublishValueValueEditor(PropertyValueEditor wrapped)
     : this(ApplicationContext.Current.Services.DataTypeService, wrapped)
 {
 }
Esempio n. 17
0
 public VortoPropertyValueEditor(PropertyValueEditor wrapped)
     : base(wrapped)
 {
 }
 public LabelPropertyValueEditor(PropertyValueEditor wrapped)
     : base(wrapped)
 {
 }
 public MultipleTextStringPropertyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
 {
 }
 public FileUploadPropertyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
 {
 }
        public void Value_Editor_Can_Serialize_Date_Value()
        {
            var now = DateTime.Now;
            var valueEditor = new PropertyValueEditor
                {
                    ValueType = "DATE"
                };

            var prop = new Property(1, Guid.NewGuid(), new PropertyType("test", DataTypeDatabaseType.Date), now);

            var result = valueEditor.ConvertDbToEditor(prop, prop.PropertyType, new Mock<IDataTypeService>().Object);
            Assert.AreEqual(now.ToIsoString(), result);
        }
 internal PublishValueValueEditor(IDataTypeService dataTypeService, PropertyValueEditor wrapped)
     : base(wrapped)
 {
     _dataTypeService = dataTypeService;
 }