예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StopIfNotFieldExists"/> class.
 /// </summary>
 /// <param name="primaryProperty">Primary property for this rule.</param>
 public StopIfNotFieldExists(IPropertyInfo primaryProperty)
   : base(primaryProperty)
 {
   if (InputProperties == null)
     InputProperties = new List<IPropertyInfo>();
   InputProperties.Add(primaryProperty);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FrequencyHoursShouldBeGreaterThanZeroRule"/> class.
 /// </summary>
 /// <param name="hoursProperty">The hours property.</param>
 /// <param name="frequencyTypePorperty">The frequency type property.</param>
 /// <param name="frequencyFieldName">Name of the frequency field.</param>
 public FrequencyHoursShouldBeGreaterThanZeroRule(IPropertyInfo hoursProperty, IPropertyInfo frequencyTypePorperty, string frequencyFieldName) : base(hoursProperty)
 {
     InputProperties = new List<IPropertyInfo> { hoursProperty, frequencyTypePorperty };
     _frequencyTypeProperty = frequencyTypePorperty;
     _frequencyFieldName = frequencyFieldName;
     RuleUri.AddQueryParameter("frequencyFieldName", frequencyFieldName);
 }
        public DefaultActivityStatus(IPropertyInfo activityIdProperty, IPropertyInfo activityStatusProperty, IPropertyInfo approvedByIdProperty)
            : base(activityIdProperty)
        {
            if (activityIdProperty == null)
            {
                throw new ArgumentException("activityIdProperty cannot be null.");
            }
            if (activityStatusProperty == null)
            {
                throw new ArgumentException("activityStatusProperty cannot be null.");
            }
            if (approvedByIdProperty == null)
            {
                throw new ArgumentException("approvedByIdProperty cannot be null.");
            }
            if (activityIdProperty.Type != typeof(int))
            {
                throw new ArgumentException("activityIdProperty must be an int.");
            }
            if (activityStatusProperty.Type != typeof(ActivitySubmissionStatus))
            {
                throw new ArgumentException("activityStatusProperty must be a Common.Enums.ActivitySubmissionStatus.");
            }
            if (approvedByIdProperty.Type != typeof(int))
            {
                throw new ArgumentException("approvedByIdProperty must be a Common.Enums.ActivitySubmissionStatus.");
            }

            this.StatusName = activityStatusProperty.Name;
            this.ApprovedByIdName = approvedByIdProperty.Name;
            this.InputProperties = new List<IPropertyInfo> { activityIdProperty, activityStatusProperty, approvedByIdProperty };
            this.AffectedProperties.Add(activityStatusProperty);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GreaterThanOrEqual"/> class.
 /// </summary>
 /// <param name="primaryProperty">
 /// The primary property.
 /// </param>
 /// <param name="compareToProperty">
 /// The compare to property.
 /// </param>
 public GreaterThanOrEqual(IPropertyInfo primaryProperty, IPropertyInfo compareToProperty)
   : base(primaryProperty)
 {
   CompareTo = compareToProperty;
   InputProperties = new List<IPropertyInfo>() { primaryProperty, compareToProperty };
   this.RuleUri.AddQueryParameter("compareTo", compareToProperty.Name);
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResultFieldValidationRule"/> class.
 /// </summary>
 /// <param name="idProperty">The identifier property.</param>
 /// <param name="resultProperty">The result property.</param>
 /// <param name="resultListProperty">The result list property.</param>
 public ResultFieldValidationRule(IPropertyInfo idProperty, IPropertyInfo resultProperty, IPropertyInfo resultListProperty)
     : base(idProperty)
 {
     _resultProperty = resultProperty;
     _resultListProperty = resultListProperty;
     InputProperties = new List<IPropertyInfo> { idProperty, resultProperty, resultListProperty };
 }
예제 #6
0
 public AnyRequired(IPropertyInfo primaryProperty, params IPropertyInfo[] additionalProperties)
   : base(primaryProperty)
 {
   InputProperties = new List<IPropertyInfo>() {primaryProperty};
   InputProperties.AddRange(additionalProperties);
   this.RuleUri.AddQueryParameter("any", string.Join(",", additionalProperties.Select(p => p.Name).ToArray()));
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequiredFieldRule"/> class. 
 /// </summary>
 /// <param name="primaryProperty">
 /// Primary property for this rule.
 /// </param>
 public RequiredFieldRule(IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
     // Don't add the primary property to the InputProperties collection so that
     // we don't load the property value if the property is not required in current configuration.
     // This way we can make some heavy fields lazy loaded, for example multi cross-references.
 }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollapseWhiteSpace"/> class.
        /// </summary>
        /// <param name="primaryProperty">The primary property.</param>
        public CollapseWhiteSpace(IPropertyInfo primaryProperty)
            : base(primaryProperty)
        {
            InputProperties = new List<IPropertyInfo> {primaryProperty};

            CanRunOnServer = false;
        }
예제 #9
0
 private bool IsAlreadyLoadingProperty(IPropertyInfo property)
 {
   lock (_syncRoot)
   {
     return _loading.Any(l => l.Property == property);
   }
 }
        internal UnresolvedPropertyInfo(IPropertyInfo adapter)
        {
            if (adapter == null)
                throw new ArgumentNullException("adapter");

            this.adapter = adapter;
        }
        public DefaultBadgeStatus(IPropertyInfo badgeTypeProperty, IPropertyInfo badgeStatusProperty, IPropertyInfo approvedByIdProperty)
            : base(badgeTypeProperty)
        {
            if (badgeTypeProperty == null)
            {
                throw new ArgumentException("badgeIdProperty cannot be null.");
            }
            if (badgeStatusProperty == null)
            {
                throw new ArgumentException("badgeStatusProperty cannot be null.");
            }
            if (approvedByIdProperty == null)
            {
                throw new ArgumentException("approvedByIdProperty cannot be null.");
            }
            if (badgeTypeProperty.Type != typeof(BadgeType))
            {
                throw new ArgumentException("badgeTypeProperty must be a Common.Enums.BadgeType.");
            }
            if (badgeStatusProperty.Type != typeof(BadgeStatus))
            {
                throw new ArgumentException("badgeStatusProperty must be a Common.Enums.BadgeStatus.");
            }
            if (approvedByIdProperty.Type != typeof(int))
            {
                throw new ArgumentException("approvedByIdProperty must be an int.");
            }

            this.StatusName = badgeStatusProperty.Name;
            this.ApprovedByIdName = approvedByIdProperty.Name;
            this.InputProperties = new List<IPropertyInfo> { badgeTypeProperty, badgeStatusProperty, approvedByIdProperty };
            this.AffectedProperties.Add(badgeStatusProperty);
        }
예제 #12
0
파일: PropertyRule.cs 프로젝트: Jaans/csla
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyRule"/> class.
 /// </summary>
 /// <param name="propertyInfo">The property info.</param>
 protected PropertyRule(IPropertyInfo propertyInfo)
     : base(propertyInfo)
 {
     CanRunAsAffectedProperty = true;
       CanRunOnServer = true;
       CanRunInCheckRules = true;
 }
예제 #13
0
 public SetStateName(IPropertyInfo stateIdProperty, IPropertyInfo stateNameProperty)
   : base(stateIdProperty)
 {
   StateName = stateNameProperty;
   InputProperties = new List<IPropertyInfo> { stateIdProperty };
   AffectedProperties.Add(StateName);
 }
 public CollectionMinimumCountBusinessRule(IPropertyInfo collectionProperty, int minCount)
     : base(collectionProperty)
 {
     PrimaryProperty = collectionProperty;
       InputProperties = new List<IPropertyInfo>() { collectionProperty };
       _MinCount = minCount;
 }
예제 #15
0
        public NoDuplicates(IPropertyInfo primaryProperty, IPropertyInfo idProperty, CheckForDuplicates duplicateCommand)
            : base(primaryProperty)
        {
            if (primaryProperty == null)
            {
                throw new ArgumentException("primaryProperty cannot be null.");
            }
            if (idProperty == null)
            {
                throw new ArgumentException("idProperty cannot be null.");
            }
            if (duplicateCommand == null)
            {
                throw new ArgumentException("duplicateCommand cannot be null.");
            }
            if (primaryProperty.Type != typeof(string))
            {
                throw new ArgumentException("primaryProperty must be a string.");
            }
            if (idProperty.Type != typeof(int))
            {
                throw new ArgumentException("idProperty must be an int.");
            }

            this.IdPropertyName = idProperty.Name;
            this.InputProperties = new List<IPropertyInfo> { primaryProperty, idProperty };
            this.DuplicateCommand = duplicateCommand;
        }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AsyncLookupRule"/> class.
 /// </summary>
 /// <param name="primaryProperty">Primary property for this rule.</param>
 protected AsyncLookupRule(IPropertyInfo primaryProperty) : base(primaryProperty)
 {
   IsAsync = true;
   CanRunAsAffectedProperty = false;
   CanRunInCheckRules = false;
   CanRunOnServer = false;
 }
            /// <summary>
            /// Initializes a new instance of the <see cref="ParameterNameIsRequired"/> class.
            /// </summary>
            /// <param name="systemParameterListProperty">The system parameter list property.</param>
            public ParameterNameIsRequired(IPropertyInfo systemParameterListProperty): base(systemParameterListProperty)
            {
                this.InputProperties = new List<IPropertyInfo> {systemParameterListProperty};

                _required = new Csla.Rules.CommonRules.Required(systemParameterListProperty);
                RuleUri.AddQueryParameter("rule", System.Uri.EscapeUriString(_required.RuleName));
            }
 public PropertyXCanNotBeEmptyIfPropertyYHasValue(IPropertyInfo primaryProperty, IPropertyInfo dependentProperty)
     : base(primaryProperty)
 {
     InputProperties = new List<IPropertyInfo> {primaryProperty, dependentProperty};
     DependentProperty = dependentProperty;
     MessageText = ResourcesValidation.PropertyXCantBeEmptyIfPropertyYHasValue;
 }
 public CollectionCountsAreEqualBusinessRule(IPropertyInfo primaryProperty, IPropertyInfo secondaryProperty)
     : base(primaryProperty)
 {
     var primaryIsCorrectType = primaryProperty.Type.IsAssignableFrom(typeof(ICollection));
       var secondaryIsCorrectType = secondaryProperty.Type.IsAssignableFrom(typeof(ICollection));
       InputProperties = new List<IPropertyInfo>() { primaryProperty, secondaryProperty };
       _SecondaryProperty = secondaryProperty;
 }
예제 #20
0
 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">Property to which the rule applies.</param>
 /// <param name="insertValidation">should new records be validated</param>
 /// <param name="updateValidation">should existing records be validated</param>
 public DateTimeCurrentYear(IPropertyInfo primaryProperty, bool insertValidation = true,
     bool updateValidation = true)
     : base(primaryProperty)
 {
     InputProperties = new List<IPropertyInfo> {primaryProperty};
     _insertValidation = insertValidation;
     _updateValidation = updateValidation;
 }
예제 #21
0
 public override void SetParent(IPropertyInfo info)
 {
     var viewModel = info.PropertyValue as ViewModelBase;
     if (viewModel != null)
     {
         viewModel.SetParent(info.Instance);
     }
 }
예제 #22
0
        public IntegerLessThanOtherInteger(IPropertyInfo intFirst, IPropertyInfo intSecond)
            : base(intFirst)
        {
            InputProperties = new List<IPropertyInfo> {intFirst, intSecond};

            IntSecondProperty = intSecond;
            AffectedProperties.Add(intSecond);
        }
예제 #23
0
 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="dateFrom">Date-From Property to which the rule applies.</param>
 /// <param name="dateTo">Date-To Property to compare with</param>
 /// <param name="errMsg">Error-Message to display (2 Parameters)</param>
 /// <param name="sameDateAllowed">Is Datefrom and DateTo with the same date allowed or not ?</param>
 public DateFromToValid(IPropertyInfo dateFrom, IPropertyInfo dateTo, string errMsg, bool sameDateAllowed = true)
     : base(dateFrom)
 {
     InputProperties = new List<IPropertyInfo> {dateFrom, dateTo};
     DateTo = dateTo;
     ErrMsg = errMsg;
     SameDateAllowed = sameDateAllowed;
 }
예제 #24
0
파일: CalcSum.cs 프로젝트: Jaans/csla
 /// <summary>
 /// Initializes a new instance of the <see cref="CalcSum"/> class.
 /// </summary>
 /// <param name="primaryProperty">
 /// The primary property.
 /// </param>
 /// <param name="inputProperties">
 /// The input properties.
 /// </param>
 public CalcSum(IPropertyInfo primaryProperty, params IPropertyInfo[] inputProperties)
   : base(primaryProperty)
 {
   InputProperties = new List<IPropertyInfo>();
   InputProperties.AddRange(inputProperties);
   this.RuleUri.AddQueryParameter("input", string.Join(",", inputProperties.Select(p => p.Name).ToArray()));
   CanRunOnServer = false;
 }
 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">Property to which the rule applies.</param>
 /// <param name="prohibitedCharacters">prohibited characters</param>
 public StringNotCotaingingInvalidCharacters(IPropertyInfo primaryProperty, string prohibitedCharacters)
     : base(primaryProperty)
 {
     InputProperties = new List<IPropertyInfo> {primaryProperty};
     _prohibitedCharacters = prohibitedCharacters;
     _regex = CreateRegex(prohibitedCharacters);
     MessageText = ResourcesValidation.StringContainsInvalidCharacters;
 }
예제 #26
0
        public MoneyGreaterThanOtherMoney(IPropertyInfo moneyFirst, IPropertyInfo moneySecond)
            : base(moneyFirst)
        {
            InputProperties = new List<IPropertyInfo> {moneyFirst, moneySecond};

            MoneySecondProperty = moneySecond;
            AffectedProperties.Add(moneySecond);
        }
예제 #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AsyncRule"/> class.
        /// </summary>
        /// <param name="primaryProperty">
        /// The primary property.
        /// </param>
        protected AsyncRule(IPropertyInfo primaryProperty)
            : base(primaryProperty)
        {
#if SILVERLIGHT
            IsAsync = true;
            ProvideTargetWhenAsync = true;
#endif
        }
 public override void SetParent(IPropertyInfo info)
 {
     if (IsCollectionOfDerivedTypeOfViewModel(info.PropertyType))
     {
         var collection = info.PropertyValue.ToEnumerableOf<ViewModelBase>().ToList();
         collection.Last().SetParent(info.Instance);
     }
 }
예제 #29
0
 public AlsoRequiredRule(IPropertyInfo triggerProperty, IPropertyInfo optionalProperty, IPropertyInfo requiredProperty)
     : base(triggerProperty)
 {
     OptionalProperty = optionalProperty;
     RequiredProperty = requiredProperty;
     AffectedProperties.Add(OptionalProperty);
     AffectedProperties.Add(RequiredProperty);
     InputProperties = new List<IPropertyInfo> { OptionalProperty, RequiredProperty };
 }
예제 #30
0
파일: Range.cs 프로젝트: nschonni/csla-svn
 /// <summary>
 /// Initializes a new instance of the <see cref="Range"/> class. 
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">
 /// Property to which the rule applies.
 /// </param>
 /// <param name="min">
 /// Min value.
 /// </param>
 /// <param name="max">
 /// Max value.
 /// </param>
 public Range(IPropertyInfo primaryProperty, IComparable min, IComparable max)
   : base(primaryProperty)
 {
   Max = max;
   Min = min;
   RuleUri.AddQueryParameter("max", max.ToString());
   RuleUri.AddQueryParameter("min", min.ToString());
   InputProperties = new List<IPropertyInfo> { primaryProperty };
 }
예제 #31
0
 protected virtual void OnPropertyChanged(IPropertyInfo property)
 {
     PropertyChanged?.Invoke(this, new EditorPropertyChangedEventArgs(property));
 }
예제 #32
0
 public RequiredWhenNew(IPropertyInfo primaryProperty) : base(primaryProperty)
 {
 }
예제 #33
0
 public SizePropertyViewModel(TargetPlatform platform, IPropertyInfo property, IEnumerable <IObjectEditor> editors)
     : base(platform, property, editors)
 {
 }
예제 #34
0
 public RequiredWhenNew(IPropertyInfo primaryProperty, string message) : base(primaryProperty, message)
 {
 }
예제 #35
0
 protected BusinessRuleCore(IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
 }
예제 #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnyRequired"/> class.
 /// </summary>
 /// <param name="primaryProperty">The primary property.</param>
 /// <param name="message">The error message text.</param>
 /// <param name="additionalProperties">The additional properties.</param>
 public AnyRequired(IPropertyInfo primaryProperty, string message, params IPropertyInfo[] additionalProperties)
     : this(primaryProperty, additionalProperties)
 {
     MessageText = message;
 }
예제 #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyRule"/> class.
 /// </summary>
 /// <param name="propertyInfo">The property info.</param>
 protected PropertyRule(IPropertyInfo propertyInfo) : base(propertyInfo)
 {
     CanRunAsAffectedProperty = true;
     CanRunOnServer           = true;
     CanRunInCheckRules       = true;
 }
 public void RaisePropertyChanged(IPropertyInfo property)
 {
     PropertyChanged?.Invoke(this, new EditorPropertyChangedEventArgs(property));
 }
        public Task <IReadOnlyCollection <PropertyVariation> > GetPropertyVariantsAsync(IPropertyInfo property)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            if (!this.values.TryGetValue(property, out IDictionary <PropertyVariation, object> propertyValues))
            {
                return(Task.FromResult <IReadOnlyCollection <PropertyVariation> > (new PropertyVariation[0]));
            }

            return(Task.FromResult <IReadOnlyCollection <PropertyVariation> > (propertyValues.Keys.Except(new[] { NeutralVariations }).ToList()));
        }
예제 #40
0
 public IPropertyInfo GetReferencedKey(IPropertyInfo property)
 {
     //IsValid(property);
     return(property.Type.Properties.FirstOrDefault(p => p.HasAttribute <DbKeyAttribute>()));
 }
예제 #41
0
 public AsyncAwaitRule(IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
 }
예제 #42
0
 protected override NumericPropertyViewModel <double> GetViewModel(TargetPlatform platform, IPropertyInfo property, IEnumerable <IObjectEditor> editors)
 {
     return(new NumericPropertyViewModel <double> (platform, property, editors));
 }
예제 #43
0
 public Task RemovePropertyVariantAsync(IPropertyInfo property, PropertyVariation variant)
 {
     return(Task.CompletedTask);
 }
예제 #44
0
 /// <summary>
 /// Creates a <see cref="PropertyInfo" /> wrapper for <see cref="IPropertyInfo" />.
 /// </summary>
 /// <param name="adapter">The adapter.</param>
 /// <returns>The unresolved property.</returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="adapter"/> is null.</exception>
 public abstract PropertyInfo Wrap(IPropertyInfo adapter);
예제 #45
0
 public RequiredWhenNew(IPropertyInfo primaryProperty, Func <string> messageDelegate) : base(primaryProperty, messageDelegate)
 {
 }
예제 #46
0
 public Task <IReadOnlyList <BindingSource> > GetBindingSourcesAsync(object target, IPropertyInfo property)
 {
     return(Task.FromResult <IReadOnlyList <BindingSource> > (new[] {
         new BindingSourceInstance(RelativeSelf, $"Bind [{target.GetType().Name}] to itself."),
         StaticResource,
         Ancestor
     }));
 }
예제 #47
0
 public static string GetPropertyName(this IPropertyInfo pi) => pi.GetCustomAttribute <XmlPropertyAttribute>()?.Name ?? pi.Name;
예제 #48
0
        public TypeScriptTypeMemberDeclaration?ResolveProperty(TypeScriptUnit unit, ITypeGenerator typeGenerator, ITypeInfo typeInfo, IPropertyInfo propertyInfo)
        {
            if (!TryGetGetOnlyEnumPropertyValue(typeInfo, propertyInfo, out var value))
            {
                return(null);
            }

            return(new TypeScriptTypeMemberDeclaration
            {
                Name = propertyInfo.Name.ToLowerCamelCase(),
                Optional = false,
                Type = GetConstEnumType(typeGenerator, unit, propertyInfo, value !),
            });
 protected override ThicknessPropertyViewModel GetViewModel(TargetPlatform platform, IPropertyInfo property, IEnumerable <IObjectEditor> editors)
 {
     return(new ThicknessPropertyViewModel(platform, property, editors));
 }
예제 #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RuleResult"/> class.
 /// Creates a successful result.
 /// </summary>
 /// <param name="ruleName">
 /// Unique name of the rule creating
 /// this result.
 /// </param>
 /// <param name="property">
 /// Property to which this result should
 /// be attached.
 /// </param>
 public RuleResult(string ruleName, IPropertyInfo property)
 {
     this.RuleName        = ruleName;
     this.PrimaryProperty = property;
     this.Success         = true;
 }
예제 #51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StopIfIsNew"/> class.
 /// </summary>
 /// <param name="primaryProperty">
 /// The primary property.
 /// </param>
 public StopIfIsNew(IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
 }
예제 #52
0
 public Task <IReadOnlyCollection <PropertyVariation> > GetPropertyVariantsAsync(IPropertyInfo property)
 {
     return(Task.FromResult <IReadOnlyCollection <PropertyVariation> > (new PropertyVariation[0]));
 }
예제 #53
0
 protected virtual void OnPropertyChanging(IPropertyInfo propertyInfo)
 {
     OnPropertyChanging(propertyInfo.Name);
 }
예제 #54
0
 public Task <AssignableTypesResult> GetAssignableTypesAsync(IPropertyInfo property, bool childTypes)
 {
     return(GetAssignableTypes(property.RealType, childTypes));
 }
예제 #55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnyRequired"/> class.
 /// </summary>
 /// <param name="primaryProperty">The primary property.</param>
 /// <param name="messageDelegate">The error message function.</param>
 /// <param name="additionalProperties">The additional properties.</param>
 public AnyRequired(IPropertyInfo primaryProperty, Func <string> messageDelegate, params IPropertyInfo[] additionalProperties)
     : this(primaryProperty, additionalProperties)
 {
     MessageDelegate = messageDelegate;
 }
예제 #56
0
 public CheckEftvFromBeforeOrEqualEftvTo(IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
 }
예제 #57
0
        public DefaultActivityStatus(IPropertyInfo activityIdProperty, IPropertyInfo activityStatusProperty, IPropertyInfo approvedByIdProperty)
            : base(activityIdProperty)
        {
            if (activityIdProperty == null)
            {
                throw new ArgumentException("activityIdProperty cannot be null.");
            }
            if (activityStatusProperty == null)
            {
                throw new ArgumentException("activityStatusProperty cannot be null.");
            }
            if (approvedByIdProperty == null)
            {
                throw new ArgumentException("approvedByIdProperty cannot be null.");
            }
            if (activityIdProperty.Type != typeof(int))
            {
                throw new ArgumentException("activityIdProperty must be an int.");
            }
            if (activityStatusProperty.Type != typeof(ActivitySubmissionStatus))
            {
                throw new ArgumentException("activityStatusProperty must be a Common.Enums.ActivitySubmissionStatus.");
            }
            if (approvedByIdProperty.Type != typeof(int))
            {
                throw new ArgumentException("approvedByIdProperty must be a Common.Enums.ActivitySubmissionStatus.");
            }

            this.StatusName       = activityStatusProperty.Name;
            this.ApprovedByIdName = approvedByIdProperty.Name;
            this.InputProperties  = new List <IPropertyInfo> {
                activityIdProperty, activityStatusProperty, approvedByIdProperty
            };
            this.AffectedProperties.Add(activityStatusProperty);
        }
예제 #58
0
 /// <summary>
 /// Raises the PropertyChanged event.
 /// </summary>
 /// <param name="propertyInfo">The property info object for the changed property.</param>
 protected void OnPropertyChanged(IPropertyInfo propertyInfo)
 {
     OnPropertyChanged(propertyInfo.Name);
 }
 public CreateVariantWindow(IEnumerable <ResourceDictionary> merged, IPropertyInfo property)
 {
     DataContext = new CreateVariantViewModel(property);
     InitializeComponent();
     Resources.MergedDictionaries.AddItems(merged);
 }
예제 #60
0
        public override IClassVisitor Extend(IClassVisitor visitor, IBytecodeBehaviorState state, IList <IBytecodeBehavior> remainingPendingBehaviors, IList <IBytecodeBehavior> cascadePendingBehaviors)
        {
            MemberEnhancementHint memberHint = state.GetContext <MemberEnhancementHint>();

            if (memberHint == null)
            {
                return(visitor);
            }
            RelationMemberEnhancementHint relationMemberHint = state.GetContext <RelationMemberEnhancementHint>();

            String[] memberNameSplit = EmbeddedMember.Split(memberHint.MemberName);
            if (memberNameSplit.Length == 1)
            {
                IPropertyInfo[] sPropertyPath = new IPropertyInfo[1];
                sPropertyPath[0] = PropertyInfoProvider.GetProperty(memberHint.DeclaringType, memberHint.MemberName);
                visitor          = new EntityMetaDataMemberVisitor(visitor, memberHint.DeclaringType, memberHint.DeclaringType, memberHint.MemberName,
                                                                   EntityMetaDataProvider, sPropertyPath);
                if (relationMemberHint != null)
                {
                    visitor = new EntityMetaDataRelationMemberVisitor(visitor, memberHint.DeclaringType, memberHint.MemberName, sPropertyPath);
                }
                else
                {
                    visitor = new EntityMetaDataPrimitiveMemberVisitor(visitor, memberHint.DeclaringType, memberHint.MemberName, sPropertyPath);
                }
                return(visitor);
            }
            Member[] members  = new Member[memberNameSplit.Length];
            Type     currType = memberHint.DeclaringType;

            IPropertyInfo[] propertyPath = new IPropertyInfo[members.Length];
            StringBuilder   sb           = new StringBuilder();

            for (int a = 0, size = memberNameSplit.Length; a < size; a++)
            {
                if (a + 1 < memberNameSplit.Length)
                {
                    members[a] = MemberTypeProvider.GetMember(currType, memberNameSplit[a]);
                }
                else if (relationMemberHint != null)
                {
                    members[a] = MemberTypeProvider.GetRelationMember(currType, memberNameSplit[a]);
                }
                else
                {
                    members[a] = MemberTypeProvider.GetPrimitiveMember(currType, memberNameSplit[a]);
                }
                if (a > 0)
                {
                    sb.Append('.');
                }
                sb.Append(members[a].Name);
                propertyPath[a] = PropertyInfoProvider.GetProperty(currType, memberNameSplit[a]);
                if (a + 1 < memberNameSplit.Length)
                {
                    currType = BytecodeEnhancer.GetEnhancedType(members[a].RealType,
                                                                new EmbeddedEnhancementHint(memberHint.DeclaringType, currType, sb.ToString()));
                }
                else
                {
                    currType = members[a].RealType;
                }
            }
            visitor = new EntityMetaDataMemberVisitor(visitor, memberHint.DeclaringType, memberHint.DeclaringType, memberHint.MemberName,
                                                      EntityMetaDataProvider, propertyPath);
            if (relationMemberHint != null)
            {
                visitor = new EntityMetaDataRelationMemberVisitor(visitor, memberHint.DeclaringType, memberHint.MemberName, propertyPath);
            }
            else
            {
                visitor = new EntityMetaDataPrimitiveMemberVisitor(visitor, memberHint.DeclaringType, memberHint.MemberName, propertyPath);
            }
            visitor = new EntityMetaDataEmbeddedMemberVisitor(visitor, memberHint.DeclaringType, memberHint.MemberName, members);
            return(visitor);
        }