예제 #1
0
        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 };
        }
예제 #2
0
 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 };
 }
예제 #3
0
        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 });
        }
예제 #4
0
 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 };
 }
예제 #5
0
        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 };
        }
예제 #6
0
        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 });
        }
예제 #7
0
        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());
        }
예제 #9
0
 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 };
 }
예제 #10
0
파일: RangeInfo.cs 프로젝트: koav/Rhetos
 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 };
 }
예제 #11
0
        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 });
        }
예제 #12
0
        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 });
        }
예제 #13
0
 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 };
 }
예제 #14
0
        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 };
        }
예제 #15
0
        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 });
        }
예제 #16
0
        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 });
        }
예제 #17
0
 private string ComposableFilterParameter()
 {
     var itemFilterPrototype = new ItemFilterInfo { Source = Source, FilterName = FilterName, Expression = null };
     return ItemFilterMacro.GetGeneratedFilter(itemFilterPrototype).GetKeyProperties();
 }
예제 #18
0
 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 };
 }