/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.Classification; return(condition); }
/// <summary> /// Gets value determining whether current strategy should handle the markup for the specified field. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> public virtual bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField && !this.ExcludedFieldNames.Contains(field.Name); return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && (field.FieldType == FieldType.MultipleChoice || field.FieldType == FieldType.Choices); return(condition); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var taxonomyType = FieldExtensions.GetTaxonomyType(field.ClassificationId); string templatePath = string.Empty; if (field.CanSelectMultipleItems) { if (taxonomyType == Telerik.Sitefinity.Taxonomies.Model.TaxonomyType.Flat) { templatePath = ClassificationField.FlatTaxonomyTemplatePath; } else if (taxonomyType == Telerik.Sitefinity.Taxonomies.Model.TaxonomyType.Hierarchical) { templatePath = ClassificationField.HierarchicalTaxonomyTemplatePath; } } else { if (taxonomyType == Telerik.Sitefinity.Taxonomies.Model.TaxonomyType.Flat) { templatePath = ClassificationField.SingleFlatTaxonomyTemplatePath; } else if (taxonomyType == Telerik.Sitefinity.Taxonomies.Model.TaxonomyType.Hierarchical) { templatePath = ClassificationField.SingleHierarchicalTaxonomyTemplatePath; } } return(templatePath); }
public void Test_Password_Should_Keep_Current_Value() { var samplePassord = "some secret data"; var data = new Password { Value = Password.BogusText }; var converter = FieldValueConversion.GetConverter(data.GetType()); var field = new DynamicModuleField { Data = data }; var rf = new Cell() { Data = converter.Serialize(field, new ConversionContext { Cell = new Cell { Data = "<Password>" + samplePassord + "</Password>" } }) }; var retData = converter.Deserialize(rf); Assert.IsNotNull(retData); Assert.IsInstanceOfType(retData, typeof(Password)); var pwdResult = retData as Password; Assert.AreEqual(pwdResult.Value, samplePassord); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.RelatedData; return condition; }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && (field.FieldType == FieldType.MultipleChoice || field.FieldType == FieldType.Choices); return condition; }
public void Test_Password_Should_Change_Value() { var samplePassord = "some secret data"; var data = new Password { Value = samplePassord }; var converter = FieldValueConversion.GetConverter(data.GetType()); var field = new DynamicModuleField { Data = data }; var rf = new Cell() { Data = converter.Serialize(field, new ConversionContext { Cell = new Cell { Data = "<Password>9b6ca654c29750544f6c4fba45a7c0b7f5fdf0f2</Password>" } }) }; var retData = converter.Deserialize(rf); Assert.IsNotNull(retData); Assert.IsInstanceOfType(retData, typeof(Password)); var pwdResult = retData as Password; Assert.AreNotEqual(pwdResult.Value, samplePassord); var hash = new Hash(Hash.Provider.SHA1); var hashData = hash.Calculate(new Data(samplePassord), new Data("|)0ver3ncrypt10n_k3y")).Base64; Assert.AreEqual(pwdResult.Value, hashData); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.RelatedData; return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && (field.FieldType == FieldType.ShortText || field.FieldType == FieldType.Guid); return(condition); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var isMasterView = false; var childItemTypeName = string.Empty; switch (field.MediaType) { case "image": isMasterView = field.AllowMultipleImages; childItemTypeName = typeof(Image).FullName; break; case "video": isMasterView = field.AllowMultipleVideos; childItemTypeName = typeof(Video).FullName; break; case "file": isMasterView = field.AllowMultipleFiles; childItemTypeName = typeof(Document).FullName; break; } var path = this.FindRelatedDataFieldTemplatePath(childItemTypeName, isMasterView); return(path); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.LongText && field.WidgetTypeName.EndsWith("HtmlField"); return condition; }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.Media && field.MediaType == "image"; return condition; }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.Media && field.MediaType == "file"; return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField && field.FieldType == FieldType.RelatedMedia; return condition; }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && field.FieldType == FieldType.LongText && field.WidgetTypeName.EndsWith("HtmlField"); return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && (field.FieldType == FieldType.ShortText || field.FieldType == FieldType.Guid) && field.Name != this.moduleType.MainShortTextFieldName; return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField && field.FieldType == FieldType.RelatedMedia; return(condition); }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = base.GetCondition(field) && (field.FieldType == FieldType.ShortText || field.FieldType == FieldType.Guid) && field.Name != this.moduleType.MainShortTextFieldName; return condition; }
/// <inheritdoc/> public override bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField && field.FieldType == FieldType.RelatedMedia && !this.ExcludedFieldNames.Contains(field.Name); return(condition); }
/// <summary> /// Filters a field that was not found in the Fom keys collection /// This allows us to update/add only the fields that were sent via API, i.e., /// the developer does not need to always send all the row fields. /// </summary> /// <param name="_model">A DynamicModuleViewModel bound to an Action method</param> /// <returns>A DynamicModuleFieldList with only the fields found in the request vars</returns> private bool CheckFieldExistency(DynamicModuleField _field) { string[] array = new string[1000]; var a = Request; var b = a.Form; array = b.AllKeys; return((_field.Data != null) || array.Any(k => CheckFormKey(k, _field.PropertyName))); }
/*[TestMethod] * [Ignore] * public void Test_Convert_Data_To_Xml() { * using (var db = new DoverEntities(ConnectionString)) { * foreach (var rf in db.Cell * .Include("Field.FieldDataType") * .Include("Field.Metadata") * .Include("Field.Module")) { * Type dataType = Type.GetType(rf.Field.FieldDataType.Name); * if (dataType == null) { * dataType = Type.GetType(rf.Field.FieldDataType.Name + ", Com.Dover., Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); * } * var converter = FieldValueConversion.GetConverter(dataType); * var cc = new ConversionContext { * Repository = new ModuleRepository(new EntityConnection(ConnectionString)), * Field = rf.Field, * Module = rf.Field.Module * }; * DefaultFieldValueConverter.SerializationMethod = FieldSerializationMethod.Binary; * object obj = converter.Deserialize(rf, cc); * DefaultFieldValueConverter.SerializationMethod = FieldSerializationMethod.Xml; * rf.Data = converter.Serialize(new DynamicModuleField() { * Data = obj, * DataType = dataType * }, cc); * } * db.SaveChanges(); * } * } * * [TestMethod] * [Ignore] * public void Test_Migrate_ModuleReference() { * var dataType = Type.GetType("Com.Dover.Models.DataTypes.ModuleReference, Com.Dover., Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); * var converter = FieldValueConversion.GetConverter(dataType); * * using (var db = new DoverEntities(ConnectionString)) { * foreach (var rf in db.Cell * .Include("Field.FieldDataType") * .Include("Field.Metadata") * .Include("Field.Module")) { * * if (rf.Field.FieldDataType.Name == "Com.Dover.Models.DataTypes.ModuleReference") { * var cc = new ConversionContext { * Repository = new ModuleRepository(new EntityConnection(ConnectionString)), * Field = rf.Field, * Module = rf.Field.Module * }; * if (rf.Data != null) { * var modRef = converter.Deserialize(rf, cc) as ModuleReference; * * Assert.IsNotNull(modRef); * * var row = db.Row.FirstOrDefault(r => r.Cells.Any(rf1 => rf1.ID == modRef.Id)); * * Assert.IsNotNull(row); * * modRef.Id = row.ID; * * rf.Data = converter.Serialize(new DynamicModuleField { Data = modRef }, cc); * } * } * } * db.SaveChanges(); * } * } * * [TestMethod] * [Ignore] * public void Migrate_Binary_To_String() { * * using (var db = new DoverEntities(ConnectionString)) { * foreach (var record in db.GetRowFieldBytes()) { * var bytes = record.Data; * if (bytes == null || bytes.Length == 0) { * continue; * } * * var id = record.ID; * string data = null; * if ((int)bytes[bytes.Length - 1] == 0) { * var newArray = bytes.TakeWhile((b, i) => i < bytes.Length - 1); * data = Encoding.UTF8.GetString(newArray.ToArray()); * } * else { * data = Encoding.UTF8.GetString(bytes); * } * * var rowField = db.Cell.FirstOrDefault(rf => rf.ID == id); * * Assert.IsNotNull(rowField); * * rowField.Data = data; * } * db.SaveChanges(); * } * }*/ private static object SerializeAndDeserialize(object data) { var converter = FieldValueConversion.GetConverter(data.GetType()); var field = new DynamicModuleField { Data = data }; var rf = new Cell() { Data = converter.Serialize(field) }; return(converter.Deserialize(rf)); }
private ActionResult ViewModule(Module _module, int?id, bool creating = false) { if (id != null && _module.Rows.FirstOrDefault(row => row.ID == id) == null) { TempData["Message"] = "Registro não encontrado."; return(this.RedirectToAction("List")); } DynamicModuleViewModel modelRow = new DynamicModuleViewModel() { ID = id ?? -1, ModuleName = _module.ModuleName, DisplayName = _module.DisplayName }; foreach (Field field in _module.Fields) { Cell rowField = null; if (!creating) { rowField = (id != null) ? field.Cells.FirstOrDefault(rf => rf.Row.ID == id) : field.Cells.FirstOrDefault(); } var fieldDataTpe = Type.GetType(field.FieldDataType.Name); var converter = FieldValueConversion.GetConverter(fieldDataTpe); var modelField = new DynamicModuleField() { DisplayName = field.DisplayName, PropertyName = field.FieldName, IsReadOnly = field.IsReadOnly, IsRequired = field.IsRequired, DataType = fieldDataTpe }; modelField.Data = converter.Deserialize( rowField, new ConversionContext { Field = field, Module = _module, Repository = ModRepository }); modelRow.Fields.Add(modelField); } return(View(modelRow)); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var path = string.Empty; if (field.AllowMultipleImages) { path = string.Format(ImagesField.MultiImageTemplatePath, field.Name); } else { path = string.Format(ImagesField.SingleImageTemplatePath, field.Name); } return path; }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var path = string.Empty; if (field.ChoiceRenderType.ToLowerInvariant() == "checkbox") { path = string.Format(MultipleChoiceField.MultiChoiceTemplatePath, field.Name, field.Title); } else { path = string.Format(MultipleChoiceField.SingleChoiceTemplatePath, field.Name, field.Title); } return path; }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var path = string.Empty; if (field.AllowMultipleImages) { path = string.Format(MainImagesField.MultiImageTemplatePath, field.Name); } else { path = string.Format(MainImagesField.SingleImageTemplatePath, field.Name); } return(path); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var path = string.Empty; if (field.ChoiceRenderType.ToLowerInvariant() == "checkbox") { path = string.Format(MultipleChoiceField.MultiChoiceTemplatePath, field.Name, field.Title); } else { path = string.Format(MultipleChoiceField.SingleChoiceTemplatePath, field.Name, field.Title); } return(path); }
public ActionResult List(object module) { var modToList = module as Module; ViewData["ModuleName"] = modToList.ModuleName; ViewData["DisplayName"] = modToList.DisplayName; ViewData["Fields"] = modToList.Fields.Where(f => f.ShowInListMode).Select(f => f.DisplayName); List <DynamicModuleViewModel> viewModel = new List <DynamicModuleViewModel>(); foreach (Row _row in modToList.Rows.OrderBy(r => r.SortIndex)) { DynamicModuleViewModel modelRow = new DynamicModuleViewModel() { ID = _row.ID }; foreach (Field field in modToList.Fields.Where(f => f.ShowInListMode)) { var rowField = field.Cells.FirstOrDefault(rf => rf.Row.ID == _row.ID); var fieldDataTpe = Type.GetType(field.FieldDataType.Name); var converter = FieldValueConversion.GetConverter(fieldDataTpe); var modelField = new DynamicModuleField() { DisplayName = field.DisplayName, PropertyName = field.FieldName, IsReadOnly = field.IsReadOnly, IsRequired = field.IsRequired, DataType = fieldDataTpe }; modelField.Data = converter.Deserialize( rowField, new ConversionContext { Field = field, Module = modToList, Repository = ModRepository }); modelRow.Fields.Add(modelField); } viewModel.Add(modelRow); } return(View(viewModel)); }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { if (_context == null) { throw new ArgumentNullException("_context"); } if (_obj == null) { throw new ArgumentNullException("_obj"); } var data = _obj.Data as HtmlText; if (data != null && !String.IsNullOrWhiteSpace(data.Text)) { data.Text = HttpUtility.HtmlDecode(data.Text); _obj.Data = data; } return base.Serialize(_obj, _context); }
public virtual string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { if (_obj == null || _obj.Data == null) { return(null); } switch (DataType.Name) { case "String": case "Int32": case "DateTime": case "Boolean": return(_obj.Data.ToString()); default: return(GenerateXml(_obj.Data)); } }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { if (_context == null) { throw new ArgumentNullException("_context"); } if (_obj == null) { throw new ArgumentNullException("_obj"); } var data = _obj.Data as HtmlText; if (data != null && !String.IsNullOrWhiteSpace(data.Text)) { data.Text = HttpUtility.HtmlDecode(data.Text); _obj.Data = data; } return(base.Serialize(_obj, _context)); }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { // For security reasons we cannot send the user's password in plain text to the browser. // We send a bogus text. Because of this, we need to check whether the user // has changed the password value or not. if (_context == null) { throw new ArgumentNullException("_context"); } if (_obj == null) { throw new ArgumentNullException("_obj"); } var data = _obj.Data as Password; // A Password field cannot be set to null or empty string by design if (data == null || String.IsNullOrWhiteSpace(data.Value) || data.Value == Password.BogusText) { // The user has not changed his password. // Let's retrieve the original value from the database and store it again. var originalModel = new DynamicModuleField(); originalModel.Data = Deserialize(_context.Cell, _context); _obj.Data = originalModel.Data; } else { // The user is setting a new password. We'll generate a hash for it var hash = new Hash(Hash.Provider.SHA1); data.Value = hash.Calculate(new Data(data.Value), new Data("|)0ver3ncrypt10n_k3y")).Base64; } return(base.Serialize(_obj, _context)); }
public void Test_Deserialize_ModuleReference() { // Arrange var fakeRepo = new FakeModuleRepository(); var rowField = fakeRepo.GetRandomCell(); rowField.Field.Metadata.Add(new FieldMetadata { Key = ModuleRepository.ModuleReferenceMetadataKey, Value = "\"" + rowField.Field.Module.Id + "\"" }); var value = new ModuleReference() { Id = rowField.ID }; var converter = FieldValueConversion.GetConverter(value.GetType()); var field = new DynamicModuleField { Data = value }; var rf = new Cell() { Data = converter.Serialize(field) }; var retData = converter.Deserialize(rf, new ConversionContext { Repository = fakeRepo, Field = rowField.Field, Module = rowField.Field.Module }); // Assert Assert.IsNotNull(retData); Assert.IsInstanceOfType(retData, typeof(ModuleReference)); ModuleReference result = (ModuleReference)retData; Assert.AreEqual(rowField.Row.ID, result.Id); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { var isMasterView = false; var childItemTypeName = string.Empty; switch (field.MediaType) { case "image": isMasterView = field.AllowMultipleImages; childItemTypeName = typeof(Image).FullName; break; case "video": isMasterView = field.AllowMultipleVideos; childItemTypeName = typeof(Video).FullName; break; case "file": isMasterView = field.AllowMultipleFiles; childItemTypeName = typeof(Document).FullName; break; } var path = this.FindRelatedDataFieldTemplatePath(childItemTypeName, isMasterView); return path; }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { // For security reasons we cannot send the user's password in plain text to the browser. // We send a bogus text. Because of this, we need to check whether the user // has changed the password value or not. if (_context == null) { throw new ArgumentNullException("_context"); } if (_obj == null) { throw new ArgumentNullException("_obj"); } var data = _obj.Data as Password; // A Password field cannot be set to null or empty string by design if (data == null || String.IsNullOrWhiteSpace(data.Value) || data.Value == Password.BogusText) { // The user has not changed his password. // Let's retrieve the original value from the database and store it again. var originalModel = new DynamicModuleField(); originalModel.Data = Deserialize(_context.Cell, _context); _obj.Data = originalModel.Data; } else { // The user is setting a new password. We'll generate a hash for it var hash = new Hash(Hash.Provider.SHA1); data.Value = hash.Calculate(new Data(data.Value), new Data("|)0ver3ncrypt10n_k3y")).Base64; } return base.Serialize(_obj, _context); }
/// <summary> /// Gets value determining whether current strategy should handle the markup for the specified field. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> public virtual bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField; return(condition); }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { return(base.Serialize(_obj)); }
/// <summary> /// Returns module records based on the provided module module /// and filtering parameters. /// </summary> /// <param name="module">The module to be queried</param> /// <param name="id">Optional row id for filtering</param> /// <returns>The matching rows in the specified module</returns> public DynamicModuleApiResult GetModuleData(IModule module, int?id, NameValueCollection _filters) { if (module == null) { return(null); } var moduleData = new DynamicModuleApiResult() { ModuleName = module.ModuleName, ModuleType = module.ModuleType, ModuleId = module.Id }; var rows = module.Rows; var filteredRows = (id != null) ? rows.Where(r => r.ID == id) : rows.AsEnumerable(); // Search filter string reqFilter = _filters["_Filter"]; if (!String.IsNullOrWhiteSpace(reqFilter)) { filteredRows = filteredRows.Where(r => r.Cells.Any(rf => rf.Data != null && rf.Data.IndexOf(reqFilter, StringComparison.CurrentCultureIgnoreCase) != -1)); } // Random entry filter string randomEntry = _filters["_Random"]; int randomTotal; if (!String.IsNullOrWhiteSpace(randomEntry) && Int32.TryParse(randomEntry, out randomTotal)) { filteredRows = filteredRows.OrderBy(r => Guid.NewGuid()).Take(randomTotal); } foreach (var key in _filters.AllKeys.Except(new string[] { "_Filter", "_Random" })) { var fieldName = key; var value = _filters[fieldName]; filteredRows = filteredRows.Where(r => r.Cells.Any(rf => rf.Field.FieldName == fieldName && rf.Data != null && rf.Data.IndexOf(value, StringComparison.CurrentCultureIgnoreCase) != -1)); } foreach (var row in filteredRows.OrderBy(r => r.SortIndex)) { DynamicModuleViewModel modelRow = new DynamicModuleViewModel() { ID = row.ID }; foreach (Cell rowField in row.Cells) { var field = rowField.Field; var sFieldDataType = field.FieldDataType.Name; var fieldDataTpe = Type.GetType(sFieldDataType); var modelField = new DynamicModuleField() { DisplayName = field.DisplayName, PropertyName = field.FieldName, IsReadOnly = field.IsReadOnly, IsRequired = field.IsRequired, DataType = fieldDataTpe }; var converter = FieldValueConversion.GetConverter(fieldDataTpe); modelField.Data = converter.Deserialize( rowField, new ConversionContext { Field = field, Module = module, Repository = ModRepository }); modelRow.Fields.Add(modelField); } moduleData.Rows.Add(modelRow); } return(moduleData); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var routeValues = controllerContext.RouteData.Values; var id = -1; var moduleId = -1; var account = routeValues["account"] as string; var moduleName = routeValues["modulename"] as string; Int32.TryParse(routeValues["moduleid"] as string, out moduleId); Int32.TryParse(routeValues["id"] as string, out id); var module = ModRepository.GetModuleById(moduleId, m => m.Account, m => m.Fields.Include<Field, FieldDataType>(f => f.FieldDataType), m => m.Rows.Include<Row, Cell>(r => r.Cells)); if (module == null) { bindingContext.ModelState.AddModelError("_FORM", "Módulo não encontrado"); return null; } if (module.Account == null || module.Account.SubdomainName != account) { bindingContext.ModelState.AddModelError("_FORM", "Módulo não encontrado"); return null; } // if we have a module name, use it for filtering if (!String.IsNullOrWhiteSpace(moduleName) && module.ModuleName != moduleName) { bindingContext.ModelState.AddModelError("_FORM", "Módulo não encontrado"); return null; } var theModel = new DynamicModuleViewModel() { ID = id, ModuleName = module.ModuleName, DisplayName = module.DisplayName }; // Switch back to the original data annotations model metadata implementation ModelMetadataProviders.Current = new DataAnnotationsModelMetadataProvider(); foreach (Field field in module.Fields) { field.FieldDataTypeReference.Load(); string sFieldDataType = field.FieldDataType.Name; Type fieldDataTpe = Type.GetType(sFieldDataType); var modelField = new DynamicModuleField() { DisplayName = field.DisplayName, PropertyName = field.FieldName, IsReadOnly = field.IsReadOnly, IsRequired = field.IsRequired, DataType = fieldDataTpe }; IModelBinder fieldBinder = ModelBinders.Binders.GetBinder(fieldDataTpe); var fieldBindingContext = new ModelBindingContext { ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, fieldDataTpe), ModelName = modelField.PropertyName, ModelState = bindingContext.ModelState, ValueProvider = bindingContext.ValueProvider, PropertyFilter = bindingContext.PropertyFilter }; modelField.Data = fieldBinder.BindModel(controllerContext, fieldBindingContext); if (modelField.IsRequired && (modelField.Data == null || String.IsNullOrEmpty(modelField.Data.ToString()))) { bindingContext.ModelState.AddModelError(modelField.PropertyName, "O campo " + modelField.DisplayName + " é obrigatório"); } theModel.Fields.Add(modelField); } return theModel; }
/// <summary> /// Gets value determining whether current strategy should handle the markup for the specified field. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> public virtual bool GetCondition(DynamicModuleField field) { var condition = field.FieldStatus != DynamicModuleFieldStatus.Removed && !field.IsHiddenField; return condition; }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { return(ShortTextField.TemplatePath); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { return AddressField.TemplatePath; }
public override string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { return base.Serialize(_obj); }
/// <summary> /// Gets the field markup. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> public virtual string GetMarkup(DynamicModuleField field) { var templatePath = this.GetTemplatePath(field); return Field.templateProcessor.Run(templatePath, field); }
/// <summary> /// Gets the template path. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> protected abstract string GetTemplatePath(DynamicModuleField field);
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { return LongRichTextField.TemplatePath; }
/// <summary> /// Gets the field markup. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> public virtual string GetMarkup(DynamicModuleField field) { var templatePath = this.GetTemplatePath(field); return(Field.templateProcessor.Run(templatePath, field)); }
/// <inheritdoc/> protected override string GetTemplatePath(DynamicModuleField field) { return this.FindRelatedDataFieldTemplatePath(field.RelatedDataType, field.CanSelectMultipleItems); }
/// <summary> /// Gets the template path. /// </summary> /// <param name="field">The field.</param> /// <returns></returns> protected abstract string GetTemplatePath(DynamicModuleField field);
public virtual string Serialize(DynamicModuleField _obj, ConversionContext _context = null) { if (_obj == null || _obj.Data == null) { return null; } switch (DataType.Name) { case "String": case "Int32": case "DateTime": case "Boolean": return _obj.Data.ToString(); default: return GenerateXml(_obj.Data); } }