/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="min">Min value.</param> public MinValue(Csla.Core.IPropertyInfo primaryProperty, T min) : base(primaryProperty) { Min = min; this.RuleUri.AddQueryParameter("min", min.ToString()); InputProperties.Add(primaryProperty); }
public SpaceRequired(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties = new System.Collections.Generic.List <Csla.Core.IPropertyInfo> { PrimaryProperty }; }
public MakeUpper(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
protected override void PropertyHasChanged(Csla.Core.IPropertyInfo property) { base.PropertyHasChanged(property); switch (property.Name) { case "AssignedTo": this.OnAssignedToChanged(); break; case "CategoryId": this.OnCategoryIdChanged(); break; case "EstimatedCompletedDate": this.OnEstimatedCompletedDateChanged(); break; case "ProjectId": this.OnProjectIdChanged(); break; case "StatusId": this.OnStatusIdChanged(); break; default: break; } }
protected override void PropertyHasChanged(Csla.Core.IPropertyInfo property) { base.PropertyHasChanged(property); switch (property.Name) { case "AssignedTo": this.OnAssignedToChanged(); break; case "ProjectId": this.OnProjectIdChanged(); break; case "SprintId": this.OnSprintIdChanged(); break; case "StatusId": this.OnStatusIdChanged(); break; default: break; } }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Primary property.</param> /// <param name="expression">Regular expression.</param> public RegExMatch(Csla.Core.IPropertyInfo primaryProperty, string expression) : base(primaryProperty) { Expression = expression; RuleUri.AddQueryParameter("e", expression); InputProperties.Add(primaryProperty); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> public Required(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties = new List <Core.IPropertyInfo> { primaryProperty }; }
public ValidRole(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="max">Max length value.</param> public MaxValue(Csla.Core.IPropertyInfo primaryProperty, T max) : base(primaryProperty) { Max = max; this.RuleUri.AddQueryParameter("max", max.ToString()); InputProperties.Add(primaryProperty); }
public DivisionIdDuplicateRule(Csla.Core.IPropertyInfo primaryIdProperty, Csla.Core.IPropertyInfo primaryKeyProperty) : base(primaryIdProperty) { InputProperties = new List <Csla.Core.IPropertyInfo> { primaryIdProperty, primaryKeyProperty }; PrimaryKeyProperty = primaryKeyProperty; }
/// <summary> /// Add a Error severity result to the Results list. /// </summary> /// <param name="property">Property to which the result applies.</param> /// <param name="description">Human-readable description of /// why the rule failed.</param> public void AddErrorResult(Csla.Core.IPropertyInfo property, string description) { if (!Rule.AffectedProperties.Contains(property)) { throw new ArgumentOutOfRangeException(property.Name); } Results.Add(new RuleResult(Rule.RuleName, property, description)); }
public ValidRole(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { IsAsync = true; InputProperties = new System.Collections.Generic.List <Csla.Core.IPropertyInfo> { primaryProperty }; }
public DecimalRequired(Csla.Core.IPropertyInfo primaryProperty, decimal emptyValue) : base(primaryProperty) { this.EmptyValue = emptyValue; this.InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
public InvalidAsyncValidationRule(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { IsAsync = true; InputProperties = new List <Core.IPropertyInfo> { primaryProperty }; }
public GuidRequired(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { this.EmptyValue = Guid.Empty; this.InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
/// <summary> /// Creates an instance of the rule that applies /// to a specfic property. /// </summary> /// <param name="primaryProperty">Primary property for this rule.</param> protected BusinessRuleBase(Csla.Core.IPropertyInfo primaryProperty) { AffectedProperties = new List <Core.IPropertyInfo>(); InputProperties = new List <Core.IPropertyInfo>(); PrimaryProperty = primaryProperty; this.RuleUri = new RuleUri(this, primaryProperty); RunMode = RunModes.Default; }
public StringOnlyLettersAsync(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { IsAsync = true; InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
public ClearRule(Csla.Core.IPropertyInfo primaryProperty, Csla.Core.IPropertyInfo clearProperty) : base(primaryProperty) { _clearProperty = clearProperty; InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; AffectedProperties.Add(_clearProperty); }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="max">Max length value.</param> public MaxLength(Csla.Core.IPropertyInfo primaryProperty, int max) : base(primaryProperty) { Max = max; this.RuleUri.AddQueryParameter("max", max.ToString()); InputProperties = new List <Core.IPropertyInfo> { primaryProperty }; }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="min">Min length value.</param> public MinLength(Csla.Core.IPropertyInfo primaryProperty, int min) : base(primaryProperty) { Min = min; this.RuleUri.AddQueryParameter("min", min.ToString()); InputProperties = new List <Core.IPropertyInfo> { primaryProperty }; }
public override bool CanWriteProperty(Csla.Core.IPropertyInfo propertyName) { if (propertyName.Name == FirstNameProperty.Name) { return(ReadProperty(AuthLevelProperty) > 1); } return(base.CanWriteProperty(propertyName)); }
public DateRequired(Csla.Core.IPropertyInfo primaryProperty, DateTime minValue, DateTime maxValue) : base(primaryProperty) { this.MinValue = minValue.Date; this.MaxValue = maxValue.Date; this.InputProperties = new List <Csla.Core.IPropertyInfo> { primaryProperty }; }
/// <summary> /// Creates an instance of the rule. /// </summary> /// <param name="primaryProperty">Property to which the rule applies.</param> /// <param name="attribute">ValidationAttribute instance.</param> public DataAnnotation(Csla.Core.IPropertyInfo primaryProperty, System.ComponentModel.DataAnnotations.ValidationAttribute attribute) : base(primaryProperty) { this.Attribute = attribute; RuleUri.AddQueryParameter("a", attribute.GetType().FullName); if (primaryProperty != null) { InputProperties.Add(primaryProperty); } }
protected override void PropertyHasChanged(Csla.Core.IPropertyInfo property) { base.PropertyHasChanged(property); switch (property.Name) { default: break; } }
/// <summary> /// Reads a property's field value. /// </summary> /// <param name="obj"> /// Object on which to call the method. /// </param> /// <param name="propertyInfo"> /// PropertyInfo object containing property metadata.</param> /// <remarks> /// No authorization checks occur when this method is called. /// </remarks> protected object ReadProperty(object obj, Csla.Core.IPropertyInfo propertyInfo) { if (obj is Core.IManageProperties target) { return(target.ReadProperty(propertyInfo)); } else { throw new ArgumentException(Resources.IManagePropertiesRequiredException); } }
/// <summary> /// Loads a property's managed field with the /// supplied value calling PropertyHasChanged /// if the value does change. /// </summary> /// <param name="obj"> /// Object on which to call the method. /// </param> /// <param name="propertyInfo"> /// PropertyInfo object containing property metadata.</param> /// <param name="newValue"> /// The new value for the property.</param> /// <remarks> /// No authorization checks occur when this method is called, /// and no PropertyChanging or PropertyChanged events are raised. /// Loading values does not cause validation rules to be /// invoked. /// </remarks> protected void LoadProperty(object obj, Csla.Core.IPropertyInfo propertyInfo, object newValue) { if (obj is Core.IManageProperties target) { target.LoadProperty(propertyInfo, newValue); } else { throw new ArgumentException(Resources.IManagePropertiesRequiredException); } }
/// <summary> /// Add an outbound value to update a property on the business /// object once the rule is complete. /// </summary> /// <param name="property">Property to update.</param> /// <param name="value">New property value.</param> public void AddOutValue(Csla.Core.IPropertyInfo property, object value) { if (!Rule.AffectedProperties.Contains(property)) { throw new ArgumentOutOfRangeException(property.Name); } if (OutputPropertyValues == null) { OutputPropertyValues = new Dictionary <Core.IPropertyInfo, object>(); } OutputPropertyValues.Add(property, value); }
/// <summary> /// Gets a value indicating whether a managed field /// exists for the specified property. /// </summary> /// <param name="obj">Business object.</param> /// <param name="property">Property info object.</param> protected bool FieldExists(object obj, Csla.Core.IPropertyInfo property) { var target = obj as Core.IManageProperties; if (target != null) { return(target.FieldExists(property)); } else { throw new ArgumentException(Resources.IManagePropertiesRequiredException); } }
protected override void PropertyHasChanged(Csla.Core.IPropertyInfo property) { base.PropertyHasChanged(property); switch (property.Name) { case "TaskId": this.OnTaskIdChanged(); break; default: break; } }
internal void ClearRules(Csla.Core.IPropertyInfo property) { this.IsReadOnly = false; List <BrokenRule> brokenRules; if (property == null) { brokenRules = this.Where(c => c.Property == null).ToList(); } else { brokenRules = this.Where(c => c.Property == property.Name).ToList(); } foreach (var item in brokenRules) { Remove(item); } RecalculateCounts(); this.IsReadOnly = true; }