public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { string filterName = "SystemRequired" + Property.Name; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null" }; var invalidData = new InvalidDataMarkPropertyInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "System required property " + Property.GetUserDescription() + " is not set.", DependedProperty = Property }; var reloadBeforeValidations = new ReloadBeforeValidationsInfo { DataStructure = Property.DataStructure }; return new IConceptInfo[] { filter, invalidData, reloadBeforeValidations }; }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { var itemFilter = new ItemFilterInfo { Expression = String.Format("item => item.{0} != null && item.{1} != null && item.{0} > item.{1}", PropertyFrom.Name, PropertyTo.Name), FilterName = PropertyFrom.Name + "_" + PropertyTo.Name + "_RangeFilter", Source = PropertyFrom.DataStructure }; var invalidData = new InvalidDataInfo { Source = PropertyFrom.DataStructure, FilterType = itemFilter.FilterName, ErrorMessage = "Value of {0} has to be less than or equal to {1}." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(PropertyFrom.Name) + ", " + CsUtility.QuotedString(PropertyTo.Name) }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = PropertyFrom }; return new IConceptInfo[] { itemFilter, invalidData, messageParameters, invalidProperty }; }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { var itemFilter = new ItemFilterInfo { Expression = String.Format("item => !String.IsNullOrEmpty(item.{0}) && item.{0}.Length > {1}", Property.Name, Length), FilterName = Property.Name + "_MaxLengthFilter", Source = Property.DataStructure }; var invalidData = new InvalidDataInfo { Source = Property.DataStructure, FilterType = itemFilter.FilterName, ErrorMessage = "Maximum allowed length of {0} is {1} characters." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(Property.Name) + ", " + Length }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = Property }; return(new IConceptInfo[] { itemFilter, invalidData, messageParameters, invalidProperty }); }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { var itemFilter = new ItemFilterInfo { Expression = String.Format("item => !String.IsNullOrEmpty(item.{0}) && item.{0}.Length > {1}", Property.Name, Length), FilterName = Property.Name + "_MaxLengthFilter", Source = Property.DataStructure }; var invalidData = new InvalidDataInfo { Source = Property.DataStructure, FilterType = itemFilter.FilterName, ErrorMessage = "Maximum allowed length of {0} is {1} characters." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(Property.Name) + ", " + Length }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = Property }; return new IConceptInfo[] { itemFilter, invalidData, messageParameters, invalidProperty }; }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { string filterName = "SystemRequired" + Property.Name; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null" }; var invalidData = new InvalidDataInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "System required property {0} is not set." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(Property.GetUserDescription()) }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = Property }; return new IConceptInfo[] { filter, invalidData, messageParameters, invalidProperty }; }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { var itemFilter = new ItemFilterInfo { Expression = String.Format("item => item.{0} != null && item.{1} != null && item.{0} > item.{1}", PropertyFrom.Name, PropertyTo.Name), FilterName = PropertyFrom.Name + "_" + PropertyTo.Name + "_RangeFilter", Source = PropertyFrom.DataStructure }; var invalidData = new InvalidDataInfo { Source = PropertyFrom.DataStructure, FilterType = itemFilter.FilterName, ErrorMessage = "Value of {0} has to be less than or equal to {1}." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(PropertyFrom.Name) + ", " + CsUtility.QuotedString(PropertyTo.Name) }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = PropertyFrom }; return(new IConceptInfo[] { itemFilter, invalidData, messageParameters, invalidProperty }); }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { string filterName = "SystemRequired" + Property.Name; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null" }; var invalidData = new InvalidDataInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "System required property {0} is not set." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(Property.GetUserDescription()) }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = Property }; return(new IConceptInfo[] { filter, invalidData, messageParameters, invalidProperty }); }
private string ComposableFilterParameter() { var itemFilterPrototype = new ItemFilterInfo { Source = Source, FilterName = FilterName, Expression = null }; return(ItemFilterMacro.GetGeneratedFilter(itemFilterPrototype).GetKeyProperties()); }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { // Expand the base entity: var itemFilterMinLengthProperty = new ItemFilterInfo { Expression = String.Format("item => !String.IsNullOrEmpty(item.{0}) && item.{0}.Length < {1}", Property.Name, Length), FilterName = Property.Name + "_MinLengthFilter", Source = Property.DataStructure }; var denySaveMinLengthProperty = new DenySaveForPropertyInfo { DependedProperty = Property, FilterType = itemFilterMinLengthProperty.FilterName, ErrorMessage = String.Format("Minimum allowed length of {0} is {1} characters.", Property.Name, Length), Source = Property.DataStructure }; return new IConceptInfo[] { itemFilterMinLengthProperty, denySaveMinLengthProperty }; }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { // Expand the base entity: var itemFilterRange = new ItemFilterInfo { Expression = String.Format("item => item.{0} != null && item.{1} != null && item.{0} > item.{1}", PropertyFrom.Name, PropertyTo.Name), FilterName = PropertyFrom.Name + "_" + PropertyTo.Name + "_RangeFilter", Source = PropertyFrom.DataStructure }; var denySaveRange = new DenySaveForPropertyInfo { DependedProperty = PropertyFrom, FilterType = itemFilterRange.FilterName, ErrorMessage = String.Format("Value of {0} has to be less than or equal to {1}.", PropertyFrom.Name, PropertyTo.Name), Source = PropertyFrom.DataStructure }; return new IConceptInfo[] { itemFilterRange, denySaveRange }; }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { // Expand the base entity: var itemFilterMinLengthProperty = new ItemFilterInfo { Expression = String.Format("item => !String.IsNullOrEmpty(item.{0}) && item.{0}.Length < {1}", Property.Name, Length), FilterName = Property.Name + "_MinLengthFilter", Source = Property.DataStructure }; var invalidDataMinLengthProperty = new InvalidDataMarkPropertyInfo { DependedProperty = Property, FilterType = itemFilterMinLengthProperty.FilterName, ErrorMessage = String.Format("Minimum allowed length of {0} is {1} characters.", Property.Name, Length), Source = Property.DataStructure }; return(new IConceptInfo[] { itemFilterMinLengthProperty, invalidDataMinLengthProperty }); }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { // Expand the base entity: var itemFilterRange = new ItemFilterInfo { Expression = String.Format("item => item.{0} != null && item.{1} != null && item.{0} > item.{1}", PropertyFrom.Name, PropertyTo.Name), FilterName = PropertyFrom.Name + "_" + PropertyTo.Name + "_RangeFilter", Source = PropertyFrom.DataStructure }; var invalidDataRange = new InvalidDataMarkPropertyInfo { DependedProperty = PropertyFrom, FilterType = itemFilterRange.FilterName, ErrorMessage = String.Format("Value of {0} has to be less than or equal to {1}.", PropertyFrom.Name, PropertyTo.Name), Source = PropertyFrom.DataStructure }; return(new IConceptInfo[] { itemFilterRange, invalidDataRange }); }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { var itemFilterRegExMatchProperty = new ItemFilterInfo { Expression = String.Format(@"item => !String.IsNullOrEmpty(item.{0}) && !(new System.Text.RegularExpressions.Regex({1})).IsMatch(item.{0})", Property.Name, CsUtility.QuotedString("^" + RegularExpression + "$")), FilterName = Property.Name + "_RegExMatchFilter", Source = Property.DataStructure }; var invalidDataRegExMatchProperty = new InvalidDataMarkPropertyInfo { DependedProperty = Property, FilterType = itemFilterRegExMatchProperty.FilterName, ErrorMessage = ErrorMessage, Source = Property.DataStructure }; return new IConceptInfo[] { itemFilterRegExMatchProperty, invalidDataRegExMatchProperty }; }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { string filterName = "SystemRequired" + Property.Name; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null" }; var denySave = new DenySaveForPropertyInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "System required property " + Property.GetUserDescription() + " is not set.", DependedProperty = Property }; return new IConceptInfo[] { filter, denySave }; }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { string filterName = "SystemRequired" + Property.Name; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null" }; var invalidData = new InvalidDataMarkPropertyInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "System required property " + Property.GetUserDescription() + " is not set.", DependedProperty = Property }; return(new IConceptInfo[] { filter, invalidData }); }
public IEnumerable <IConceptInfo> CreateNewConcepts(IEnumerable <IConceptInfo> existingConcepts) { string filterName = "RequiredAllowSave" + Property.Name; string emptyStringOrCondition = (Property is ShortStringPropertyInfo || Property is LongStringPropertyInfo) ? "|| item." + Property.Name + " == \"\" " : ""; var filter = new ItemFilterInfo { Source = Property.DataStructure, FilterName = filterName, Expression = "item => item." + Property.Name + " == null " + emptyStringOrCondition + OrCondition.Evaluate(this) }; var invalidData = new InvalidDataInfo { Source = Property.DataStructure, FilterType = filterName, ErrorMessage = "The required property {0} is not set." }; var messageParameters = new InvalidDataMessageParametersConstantInfo { InvalidData = invalidData, MessageParameters = CsUtility.QuotedString(Property.Name) }; var invalidProperty = new InvalidDataMarkProperty2Info { InvalidData = invalidData, MarkProperty = Property }; var allowSave = new InvalidDataAllowSaveInfo { InvalidData = invalidData }; return(new IConceptInfo[] { filter, invalidData, messageParameters, invalidProperty, allowSave }); }
private string ComposableFilterParameter() { var itemFilterPrototype = new ItemFilterInfo { Source = Source, FilterName = FilterName, Expression = null }; return ItemFilterMacro.GetGeneratedFilter(itemFilterPrototype).GetKeyProperties(); }
public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts) { string propertyPrepared = (this.Property is IntegerPropertyInfo) ? Value : (this.Property is DecimalPropertyInfo) ? "(decimal)" + Value : (this.Property is MoneyPropertyInfo) ? "(decimal)" + Value : (this.Property is DatePropertyInfo) ? String.Format(@"DateTime.Parse({0})", CsUtility.QuotedString(Value)) : (this.Property is DateTimePropertyInfo) ? String.Format(@"DateTime.Parse({0})", CsUtility.QuotedString(Value)) : ""; // Expand the base entity: var itemFilterMinValueProperty = new ItemFilterInfo { Expression = String.Format(@"item => item.{0} != null && item.{0} < {1}", Property.Name, propertyPrepared), FilterName = Property.Name + "_MinValueFilter", Source = Property.DataStructure }; var invalidDataMinValueProperty = new InvalidDataMarkPropertyInfo { DependedProperty = Property, FilterType = itemFilterMinValueProperty.FilterName, ErrorMessage = String.Format("Minimum value of {0} is {1}.", Property.Name, Value), Source = Property.DataStructure }; return new IConceptInfo[] { itemFilterMinValueProperty, invalidDataMinValueProperty }; }