コード例 #1
0
        protected override void Execute(RuleContext context)
        {
            var activityIdValue = (int)context.InputPropertyValues[PrimaryProperty];
            var activityStatusProperty = this.InputProperties.Single(p => p.Name == this.StatusName);
            var activtyStatusValue = (ActivitySubmissionStatus)context.InputPropertyValues[activityStatusProperty];
            var approvedByIdProperty = this.InputProperties.Single(p => p.Name == this.ApprovedByIdName);
            var approvedByIdValue = (ActivitySubmissionStatus)context.InputPropertyValues[approvedByIdProperty];

            if (approvedByIdValue == 0
                && (activtyStatusValue == ActivitySubmissionStatus.Unset
                || activtyStatusValue == ActivitySubmissionStatus.AwaitingApproval
                || activtyStatusValue == ActivitySubmissionStatus.Approved))
            {
                try
                {
                    var activityTask = Task.Run(() => IoC.Container.Resolve<IObjectFactory<IActivityEdit>>().FetchAsync(activityIdValue));
                    var activity = activityTask.Result;
                    context.AddOutValue(activityStatusProperty,
                        activity.RequiresApproval
                            ? ActivitySubmissionStatus.AwaitingApproval
                            : ActivitySubmissionStatus.Approved);
                }
                catch (Exception)
                {
                    context.AddErrorResult(PrimaryProperty,
                        string.Format(CultureInfo.CurrentCulture, "Activity id {0} was not able to be retrieved.", activityIdValue));
                }
            }
        }
コード例 #2
0
ファイル: SetStateName.cs プロジェクト: eugene-h-lin/csla-svn
        /// <summary>
        /// Look up State and set the state name
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            var stateId = (string)context.InputPropertyValues[PrimaryProperty];
            var state   = StatesNVL.GetNameValueList().Where(p => p.Key == stateId).FirstOrDefault();

            context.AddOutValue(StateName, state == null ? "Unknown state" : state.Value);
        }
コード例 #3
0
ファイル: UpperCaseRule.cs プロジェクト: BiYiTuan/csla
 protected override void Execute(RuleContext context)
 {
     //modify property value, to upper
     var val1 = (string)context.InputPropertyValues[PrimaryProperty];
     if (!string.IsNullOrEmpty(val1))
         context.AddOutValue(PrimaryProperty, val1.ToUpper());
 }
コード例 #4
0
        protected override void Execute(RuleContext context)
        {
            var activityIdValue        = (int)context.InputPropertyValues[PrimaryProperty];
            var activityStatusProperty = this.InputProperties.Single(p => p.Name == this.StatusName);
            var activtyStatusValue     = (ActivitySubmissionStatus)context.InputPropertyValues[activityStatusProperty];
            var approvedByIdProperty   = this.InputProperties.Single(p => p.Name == this.ApprovedByIdName);
            var approvedByIdValue      = (ActivitySubmissionStatus)context.InputPropertyValues[approvedByIdProperty];

            if (approvedByIdValue == 0 &&
                (activtyStatusValue == ActivitySubmissionStatus.Unset ||
                 activtyStatusValue == ActivitySubmissionStatus.AwaitingApproval ||
                 activtyStatusValue == ActivitySubmissionStatus.Approved))
            {
                try
                {
                    var activityTask = Task.Run(() => IoC.Container.Resolve <IObjectFactory <IActivityEdit> >().FetchAsync(activityIdValue));
                    var activity     = activityTask.Result;
                    context.AddOutValue(activityStatusProperty,
                                        activity.RequiresApproval
                            ? ActivitySubmissionStatus.AwaitingApproval
                            : ActivitySubmissionStatus.Approved);
                }
                catch (Exception)
                {
                    context.AddErrorResult(PrimaryProperty,
                                           string.Format(CultureInfo.CurrentCulture, "Activity id {0} was not able to be retrieved.", activityIdValue));
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Business rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            object value = context.InputPropertyValues[PrimaryProperty];
            var message = string.Format(GetMessage(), PrimaryProperty.FriendlyName);

            var newValue = Convert.ToString(value);

            var words = newValue.Split(' ');
            if (words.Length > 3)
            {
                context.Results.Add(new RuleResult(RuleName, PrimaryProperty, message)
                {
                    Severity = RuleSeverity.Error
                });
            }
            else
            {
                context.Results.Add(new RuleResult(RuleName, PrimaryProperty, message)
                {
                    Severity = RuleSeverity.Information
                });
            }

            context.AddOutValue(newValue);
        }
コード例 #6
0
ファイル: CascadeRoot.cs プロジェクト: zuiwanting/csla
        /// <summary>
        /// Business or validation rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            // Use linq Sum to calculate the sum value
            dynamic sum = context.InputPropertyValues.Aggregate <KeyValuePair <IPropertyInfo, object>, dynamic>(0, (current, item) => current + (dynamic)item.Value);

            // add calculated value to OutValues
            // When rule is completed the RuleEngine will update businessobject
            context.AddOutValue(PrimaryProperty, sum);
        }
コード例 #7
0
ファイル: LookupCustomer.cs プロジェクト: Jaans/csla
    /// <summary>
    /// The execute.
    /// </summary>
    /// <param name="context">
    /// The context.
    /// </param>
    protected override void Execute(RuleContext context)
    {
      var id = (int) context.InputPropertyValues[PrimaryProperty];

      // use a command or read-only object for lookup
      var lookup = LookupCustomerCommand.Execute(id);

      context.AddOutValue(NameProperty, lookup.Name);
    }
コード例 #8
0
ファイル: CalcSum.cs プロジェクト: eugene-h-lin/csla-svn
        protected override void Execute(RuleContext context)
        {
            // Use linq Sum to calculate the sum value
            var sum = context.InputPropertyValues.Sum(property => (dynamic)property.Value);

            // add calculated value to OutValues
            // When rule is completed the RuleEngig will update businessobject
            context.AddOutValue(PrimaryProperty, sum);
        }
コード例 #9
0
ファイル: CalcSum.cs プロジェクト: Jaans/csla
    protected override void Execute(RuleContext context)
    {
      // Use linq Sum to calculate the sum value 
      var sum = context.InputPropertyValues.Sum(property => (dynamic)property.Value);

      // add calculated value to OutValues 
      // When rule is completed the RuleEngig will update businessobject
      context.AddOutValue(PrimaryProperty, sum);
    }
コード例 #10
0
ファイル: LookupCustomer.cs プロジェクト: zuiwanting/csla
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(RuleContext context)
        {
            var id = (int)context.InputPropertyValues[PrimaryProperty];

            // use a command or read-only object for lookup
            var lookup = LookupCustomerCommand.Execute(id);

            context.AddOutValue(NameProperty, lookup.Name);
        }
コード例 #11
0
ファイル: ToUpper.cs プロジェクト: nschonni/csla-svn
    /// <summary>
    /// The execute.
    /// </summary>
    /// <param name="context">
    /// The context.
    /// </param>
    protected override void Execute(RuleContext context)
    {
      var value = (string) context.InputPropertyValues[PrimaryProperty];
      context.AddOutValue(PrimaryProperty, value.ToUpper());

     if (context.IsCheckRulesContext)
        Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
      else
        Console.WriteLine(".... Rule {0} running from {1} was changed", this.GetType().Name, this.PrimaryProperty.Name);
    }
コード例 #12
0
        /// <summary>
        /// Business or validation rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            if (context == null)
                return;

            var input = context.InputPropertyValues[PrimaryProperty] as int?;

            if (input.HasValue && input.Value <= 0)
                context.AddOutValue(null);
        }
コード例 #13
0
        protected override void Execute(RuleContext context)
        {
            //modify property value, to upper
            var val1 = (string)context.InputPropertyValues[PrimaryProperty];

            if (!string.IsNullOrEmpty(val1))
            {
                context.AddOutValue(PrimaryProperty, val1.ToUpper());
            }
        }
コード例 #14
0
        /// <summary>
        /// Business rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            var value = (string) context.InputPropertyValues[PrimaryProperty];
            if (string.IsNullOrEmpty(value)) return;

            var newValue = value.Trim();
            var r = new Regex(@"\s+");
            newValue = r.Replace(newValue, @" ");
            context.AddOutValue(PrimaryProperty, newValue);
        }
コード例 #15
0
ファイル: StringToUpperCase.cs プロジェクト: nttung91/PLSoft
        /// <summary>
        /// Rule implementation.
        /// </summary>
        /// <param name="context">Rule context.</param>
        protected override void Execute(RuleContext context)
        {
            var valueAsString = (string) context.InputPropertyValues[PrimaryProperty];

            if (valueAsString != null && valueAsString.IsNotEmpty())
            {
                if (!valueAsString.IsUpper())
                {
                    context.AddOutValue(PrimaryProperty, valueAsString.ToUpper());
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Rule implementation.
        /// </summary>
        /// <param name="context">Rule context.</param>
        protected override void Execute(RuleContext context)
        {
            var valueAsString = (string)context.InputPropertyValues[PrimaryProperty];

            if (valueAsString != null && valueAsString.IsNotEmpty())
            {
                if (!valueAsString.IsLower())
                {
                    context.AddOutValue(PrimaryProperty, valueAsString.ToLower());
                }
            }
        }
コード例 #17
0
        /// <summary>
        /// Business or validation rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            var value = (string)context.InputPropertyValues[PrimaryProperty];

            if (string.IsNullOrEmpty(value))
            {
                return;
            }

            var newValue = value.ToLower();

            context.AddOutValue(PrimaryProperty, newValue);
        }
コード例 #18
0
        protected override void Execute(RuleContext context)
        {
            var pollDeletedFlagProperty = this.InputProperties[0];
            var isActiveProperty        = this.InputProperties[1];

            var pollDeletedFlag = context.InputPropertyValues[pollDeletedFlagProperty] as bool?;
            var isActive        = (bool)context.InputPropertyValues[isActiveProperty];

            if (pollDeletedFlag != null && pollDeletedFlag.Value)
            {
                context.AddErrorResult(pollDeletedFlagProperty, "The poll is deleted.");
                context.AddOutValue(isActiveProperty, false);
            }
        }
コード例 #19
0
ファイル: ToUpper.cs プロジェクト: eugene-h-lin/csla-svn
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(RuleContext context)
        {
            var value = (string)context.InputPropertyValues[PrimaryProperty];

            context.AddOutValue(PrimaryProperty, value.ToUpper());

            if (context.IsCheckRulesContext)
            {
                Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
            }
            else
            {
                Console.WriteLine(".... Rule {0} running from {1} was changed", this.GetType().Name, this.PrimaryProperty.Name);
            }
        }
コード例 #20
0
        /// <summary>
        /// Business rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            var value = (string)context.InputPropertyValues[PrimaryProperty];

            if (string.IsNullOrEmpty(value))
            {
                return;
            }

            var newValue = value.Trim();
            var r        = new Regex(@"\s+");

            newValue = r.Replace(newValue, @" ");
            context.AddOutValue(PrimaryProperty, newValue);
        }
コード例 #21
0
ファイル: CollapseSpace.cs プロジェクト: nschonni/csla-svn
    /// <summary>
    /// Business or validation rule implementation.
    /// </summary>
    /// <param name="context">
    /// Rule context object.
    /// </param>
    protected override void Execute(RuleContext context)
    {
      var value = (string)context.InputPropertyValues[PrimaryProperty];
      if (string.IsNullOrEmpty(value)) return;

      var newValue = value.Trim(' ');
      var r = new Regex(@" +");
      newValue = r.Replace(newValue, @" ");
      context.AddOutValue(newValue);

      if (context.IsCheckRulesContext)
        Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
      else
        Console.WriteLine(".... Rule {0} running from {1} was changed", this.GetType().Name, this.PrimaryProperty.Name);
    }
コード例 #22
0
ファイル: UtcDateRule.cs プロジェクト: JacobAtchley/MyVote
		protected override void Execute(RuleContext context)
		{
			var dateProperty = this.InputProperties[0];

			var value = context.InputPropertyValues[dateProperty];

			if (value != null)
			{
				if (typeof(DateTime?).GetTypeInfo().IsAssignableFrom(value.GetType().GetTypeInfo()))
				{
					var nullableDate = value as DateTime?;

					if (nullableDate != null)
					{
						context.AddOutValue(dateProperty, nullableDate.Value.ToUniversalTime());
					}
				}
				else if (typeof(DateTime).GetTypeInfo().IsAssignableFrom(value.GetType().GetTypeInfo()))
				{
					var date = (DateTime)context.InputPropertyValues[dateProperty];
					context.AddOutValue(dateProperty, date.ToUniversalTime());
				}
			}
		}
コード例 #23
0
        protected override void Execute(RuleContext context)
        {
            var badgeTypeValue = (BadgeType)context.InputPropertyValues[PrimaryProperty];
            var badgeStatusProperty = this.InputProperties.Single(p => p.Name == this.StatusName);
            var badgeStatusValue = (BadgeStatus)context.InputPropertyValues[badgeStatusProperty];
            var approvedByIdProperty = this.InputProperties.Single(p => p.Name == this.ApprovedByIdName);
            var approvedByIdValue = (int)context.InputPropertyValues[approvedByIdProperty];

            if (approvedByIdValue == 0 && (badgeStatusValue == BadgeStatus.AwaitingApproval
                || badgeStatusValue == BadgeStatus.Approved || badgeStatusValue == BadgeStatus.Unset))
            {
                context.AddOutValue(badgeStatusProperty,
                    badgeTypeValue == BadgeType.Community ? BadgeStatus.AwaitingApproval : BadgeStatus.Approved);
            }
        }
コード例 #24
0
        protected override void Execute(RuleContext context)
        {
            var dateProperty = this.InputProperties[0];

            var value = context.InputPropertyValues[dateProperty];

            if (value != null)
            {
                if (typeof(DateTime?).GetTypeInfo().IsAssignableFrom(value.GetType().GetTypeInfo()))
                {
                    var nullableDate = value as DateTime?;

                    if (nullableDate != null)
                    {
                        context.AddOutValue(dateProperty, nullableDate.Value.ToUniversalTime());
                    }
                }
                else if (typeof(DateTime).GetTypeInfo().IsAssignableFrom(value.GetType().GetTypeInfo()))
                {
                    var date = (DateTime)context.InputPropertyValues[dateProperty];
                    context.AddOutValue(dateProperty, date.ToUniversalTime());
                }
            }
        }
コード例 #25
0
        protected override void Execute(RuleContext context)
        {
            var badgeTypeValue       = (BadgeType)context.InputPropertyValues[PrimaryProperty];
            var badgeStatusProperty  = this.InputProperties.Single(p => p.Name == this.StatusName);
            var badgeStatusValue     = (BadgeStatus)context.InputPropertyValues[badgeStatusProperty];
            var approvedByIdProperty = this.InputProperties.Single(p => p.Name == this.ApprovedByIdName);
            var approvedByIdValue    = (int)context.InputPropertyValues[approvedByIdProperty];

            if (approvedByIdValue == 0 && (badgeStatusValue == BadgeStatus.AwaitingApproval ||
                                           badgeStatusValue == BadgeStatus.Approved || badgeStatusValue == BadgeStatus.Unset))
            {
                context.AddOutValue(badgeStatusProperty,
                                    badgeTypeValue == BadgeType.Community ? BadgeStatus.AwaitingApproval : BadgeStatus.Approved);
            }
        }
コード例 #26
0
        protected override void Execute(RuleContext context)
        {
            var pollEndDateProperty = this.InputProperties[0];
            var isActiveProperty    = this.InputProperties[1];

            var pollEndDate = (DateTime)context.InputPropertyValues[pollEndDateProperty];
            var isActive    = (bool)context.InputPropertyValues[isActiveProperty];

            var now = DateTime.UtcNow;

            if (pollEndDate < now)
            {
                context.AddErrorResult(pollEndDateProperty, "The poll has ended.");
                context.AddOutValue(isActiveProperty, false);
            }
        }
コード例 #27
0
ファイル: CalcSum.cs プロジェクト: Jaans/csla
    /// <summary>
    /// Business or validation rule implementation.
    /// </summary>
    /// <param name="context">
    /// Rule context object.
    /// </param>
    protected override void Execute(RuleContext context)
    {
      // Use linq Sum to calculate the sum value
      var sum = context.InputPropertyValues.Sum(property => (dynamic)property.Value);

      // add calculated value to OutValues
      // When rule is completed the RuleEngine will update businessobject
      context.AddOutValue(PrimaryProperty, sum);

      if (context.IsCascadeContext)
         Console.WriteLine(".... Rule {0} running from affected property or input property", this.GetType().Name);
      else if (context.IsCheckRulesContext)
        Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
      else
        Console.WriteLine(".... Rule {0} running from {2} was changed", this.GetType().Name, this.PrimaryProperty.Name);
    }
コード例 #28
0
		protected override void Execute(RuleContext context)
		{
			var pollEndDateProperty = this.InputProperties[0];
			var isActiveProperty = this.InputProperties[1];

			var pollEndDate = (DateTime)context.InputPropertyValues[pollEndDateProperty];
			var isActive = (bool)context.InputPropertyValues[isActiveProperty];

			var now = DateTime.UtcNow;

			if (pollEndDate < now)
			{
				context.AddErrorResult(pollEndDateProperty, "The poll has ended.");
				context.AddOutValue(isActiveProperty, false);
			}
		}
コード例 #29
0
ファイル: AsyncRuleRoot.cs プロジェクト: zuiwanting/csla
            protected override void Execute(RuleContext context)
            {
                var cn = (string)context.InputPropertyValues[PrimaryProperty];

                var bw = new System.ComponentModel.BackgroundWorker();

                bw.RunWorkerCompleted += (o, e) =>
                {
                    context.AddOutValue(_nameProperty, string.Format("customer name {0}", cn));

                    context.Complete();
                };
                bw.DoWork += (o, e) =>
                {
                    Thread.Sleep(50);
                };
                bw.RunWorkerAsync();
            }
コード例 #30
0
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(RuleContext context)
        {
            var id = (int)context.InputPropertyValues[PrimaryProperty];

            // uses the async methods in DataPortal to perform data access on a background thread.
            LookupCustomerCommand.BeginExecute(id, (o, e) =>
            {
                if (e.Error != null)
                {
                    context.AddErrorResult(e.Error.ToString());
                }
                else
                {
                    context.AddOutValue(NameProperty, e.Object.Name);
                }

                context.Complete();
            });
        }
コード例 #31
0
ファイル: AsyncLookupCustomer.cs プロジェクト: BiYiTuan/csla
    /// <summary>
    /// The execute.
    /// </summary>
    /// <param name="context">
    /// The context.
    /// </param>
    protected override void Execute(RuleContext context)
    {
      var id = (int) context.InputPropertyValues[PrimaryProperty];

      // uses the async methods in DataPortal to perform data access on a background thread. 
      LookupCustomerCommand.BeginExecute(id, (o, e) =>
                                               {
                                                 if (e.Error != null)
                                                 {
                                                   context.AddErrorResult(e.Error.ToString());
                                                 }
                                                 else
                                                 {
                                                   context.AddOutValue(NameProperty, e.Object.Name);
                                                 }

                                                 context.Complete();
                                               });
    }
コード例 #32
0
ファイル: CalcSum.cs プロジェクト: zuiwanting/csla
        /// <summary>
        /// Business or validation rule implementation.
        /// </summary>
        /// <param name="context">
        /// Rule context object.
        /// </param>
        protected override void Execute(RuleContext context)
        {
            // Use linq Sum to calculate the sum value
            var sum = context.InputPropertyValues.Sum(property => (dynamic)property.Value);

            // add calculated value to OutValues
            // When rule is completed the RuleEngine will update businessobject
            context.AddOutValue(PrimaryProperty, sum);

            if (context.IsCascadeContext)
            {
                Console.WriteLine(".... Rule {0} running from affected property or input property", this.GetType().Name);
            }
            else if (context.IsCheckRulesContext)
            {
                Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
            }
            else
            {
                Console.WriteLine(".... Rule {0} running from {2} was changed", this.GetType().Name, this.PrimaryProperty.Name);
            }
        }
コード例 #33
0
        /// <summary>
        /// Business rule implementation.
        /// </summary>
        /// <param name="context">Rule context object.</param>
        protected override void Execute(RuleContext context)
        {
            object value = context.InputPropertyValues[PrimaryProperty];

            var newValue = Convert.ToString(value);

            if (!string.IsNullOrEmpty(newValue))
            {
                newValue = newValue.Replace(" ", string.Empty);
                newValue = newValue.ToUpper();

                if (!CheckFormat(newValue))
                {
                    var message = string.Format(GetMessage(), PrimaryProperty.FriendlyName);
                    context.Results.Add(new RuleResult(RuleName, PrimaryProperty, message)
                    {
                        Severity = Severity
                    });
                }

                context.AddOutValue(newValue);
            }
        }
コード例 #34
0
ファイル: CollapseSpace.cs プロジェクト: zuiwanting/csla
        /// <summary>
        /// Business or validation rule implementation.
        /// </summary>
        /// <param name="context">
        /// Rule context object.
        /// </param>
        protected override void Execute(RuleContext context)
        {
            var value = (string)context.InputPropertyValues[PrimaryProperty];

            if (string.IsNullOrEmpty(value))
            {
                return;
            }

            var newValue = value.Trim(' ');
            var r        = new Regex(@" +");

            newValue = r.Replace(newValue, @" ");
            context.AddOutValue(newValue);

            if (context.IsCheckRulesContext)
            {
                Console.WriteLine(".... Rule {0} running from CheckRules", this.GetType().Name);
            }
            else
            {
                Console.WriteLine(".... Rule {0} running from {1} was changed", this.GetType().Name, this.PrimaryProperty.Name);
            }
        }
コード例 #35
0
        protected override void Execute(RuleContext context)
        {
            var customerId = (int)context.InputPropertyValues[PrimaryProperty];
            var bw         = new BackgroundWorker();

            bw.DoWork             += (o, e) => Thread.Sleep(200);
            bw.RunWorkerCompleted += (o, e) =>
            {
                string name;
                switch (customerId)
                {
                case 1:
                    name = "Rocky Lhotka";
                    break;

                default:
                    name = string.Format("Customer_{0}", customerId);
                    break;
                }
                context.AddOutValue(NameProperty, name);
                context.Complete();
            };
            bw.RunWorkerAsync();
        }
コード例 #36
0
ファイル: SetStateName.cs プロジェクト: BiYiTuan/csla
 /// <summary>
 /// Look up State and set the state name 
 /// </summary>
 /// <param name="context">Rule context object.</param>
 protected override void Execute(RuleContext context)
 {
   var stateId = (string)context.InputPropertyValues[PrimaryProperty];
   var state = StatesNVL.GetNameValueList().Where(p => p.Key == stateId).FirstOrDefault();
   context.AddOutValue(StateName, state == null ? "Unknown state" : state.Value);
 }
コード例 #37
0
ファイル: CascadeRoot.cs プロジェクト: zuiwanting/csla
        protected override void Execute(RuleContext context)
        {
            var val = context.GetInputValue(_primaryProperty);

            context.AddOutValue(_affectedProperty, val + 1);
        }
コード例 #38
0
ファイル: CascadeRoot.cs プロジェクト: zuiwanting/csla
        protected override void Execute(RuleContext context)
        {
            var source = context.GetInputValue(_sourceProperty);

            context.AddOutValue(Math.Round(source * _fraction, 2, MidpointRounding.AwayFromZero));
        }
コード例 #39
0
ファイル: CascadeRoot.cs プロジェクト: zuiwanting/csla
        protected override void Execute(RuleContext context)
        {
            var source = context.GetInputValue(_sourceProperty);

            context.AddOutValue(source);
        }
コード例 #40
0
        protected override void Execute(RuleContext context)
        {
            var value = (string)context.InputPropertyValues[PrimaryProperty];

            context.AddOutValue(PrimaryProperty, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value));
        }
コード例 #41
0
        protected override void Execute(RuleContext context)
        {
            var value = (int)context.InputPropertyValues[PrimaryProperty];

            context.AddOutValue(PrimaryProperty, value * 17 / 100);
        }
コード例 #42
0
ファイル: ValidationTests.cs プロジェクト: zuiwanting/csla
            protected override void Execute(RuleContext context)
            {
                var value = (string)context.InputPropertyValues[PrimaryProperty];

                context.AddOutValue(PrimaryProperty, value.ToUpperInvariant());
            }