private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
     System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
     Sage.SalesLogix.Process.Activities.RelativeDateTime relativedatetime1 = new Sage.SalesLogix.Process.Activities.RelativeDateTime();
     System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
     this.createToDo1 = new Sage.SalesLogix.Process.Activities.CreateToDo();
     this.codeActivity1 = new System.Workflow.Activities.CodeActivity();
     this.policyActivity1 = new System.Workflow.Activities.PolicyActivity();
     activitybind1.Name = "Workflow2";
     activitybind1.Path = "CurrentEntity.Id";
     activitybind2.Name = "Workflow2";
     activitybind2.Path = "CurrentEntity.ModifyUser";
     //
     // createToDo1
     //
     this.createToDo1.ActivityDescription = "Created from Process";
     this.createToDo1.Description = "Created from Process";
     this.createToDo1.Name = "createToDo1";
     relativedatetime1.BaseDateTime = new System.DateTime(2008, 10, 2, 0, 0, 0, 0);
     relativedatetime1.Offset = System.TimeSpan.Parse("00:00:00");
     relativedatetime1.RelativeTo = Sage.SalesLogix.Process.Activities.RelativeTo.UtcNow;
     this.createToDo1.StartDate = relativedatetime1;
     this.createToDo1.SetBinding(Sage.SalesLogix.Process.Activities.CreateActivityBase.AccountIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
     this.createToDo1.SetBinding(Sage.SalesLogix.Process.Activities.CreateActivityBase.UserIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
     //
     // codeActivity1
     //
     this.codeActivity1.Name = "codeActivity1";
     this.codeActivity1.ExecuteCode += new System.EventHandler(this.codeActivity1_ExecuteCode);
     //
     // policyActivity1
     //
     this.policyActivity1.Name = "policyActivity1";
     rulesetreference1.RuleSetName = "Rule Set1";
     this.policyActivity1.RuleSetReference = rulesetreference1;
     //
     // Workflow2
     //
     this.Activities.Add(this.policyActivity1);
     this.Activities.Add(this.codeActivity1);
     this.Activities.Add(this.createToDo1);
     this.Description = "y 2nd Workflow";
     this.EntityId = null;
     this.EntityType = typeof(Sage.Entity.Interfaces.IAccount);
     this.Name = "Workflow2";
     this.CanModifyActivities = false;
 }
Esempio n. 2
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference       rulesetreference1       = new System.Workflow.Activities.Rules.RuleSetReference();
     System.Workflow.Activities.Rules.RuleConditionReference ruleconditionreference1 = new System.Workflow.Activities.Rules.RuleConditionReference();
     System.Workflow.Activities.Rules.RuleSetReference       rulesetreference2       = new System.Workflow.Activities.Rules.RuleSetReference();
     this.PriorityPolicy        = new System.Workflow.Activities.PolicyActivity();
     this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();
     this.ifReview        = new System.Workflow.Activities.IfElseBranchActivity();
     this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();
     this.ReviewPolicy    = new System.Workflow.Activities.PolicyActivity();
     //
     // PriorityPolicy
     //
     this.PriorityPolicy.Name             = "PriorityPolicy";
     rulesetreference1.RuleSetName        = "Priority Policy";
     this.PriorityPolicy.RuleSetReference = rulesetreference1;
     //
     // ifElseBranchActivity2
     //
     this.ifElseBranchActivity2.Name = "ifElseBranchActivity2";
     //
     // ifReview
     //
     this.ifReview.Activities.Add(this.PriorityPolicy);
     ruleconditionreference1.ConditionName = "Review";
     this.ifReview.Condition = ruleconditionreference1;
     this.ifReview.Name      = "ifReview";
     //
     // ifElseActivity1
     //
     this.ifElseActivity1.Activities.Add(this.ifReview);
     this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);
     this.ifElseActivity1.Name = "ifElseActivity1";
     //
     // ReviewPolicy
     //
     this.ReviewPolicy.Name             = "ReviewPolicy";
     rulesetreference2.RuleSetName      = "Review Policy";
     this.ReviewPolicy.RuleSetReference = rulesetreference2;
     //
     // QCPolicy
     //
     this.Activities.Add(this.ReviewPolicy);
     this.Activities.Add(this.ifElseActivity1);
     this.Name = "QCPolicy";
     this.CanModifyActivities = false;
 }
Esempio n. 3
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
     this.policyActivity1 = new System.Workflow.Activities.PolicyActivity();
     //
     // policyActivity1
     //
     this.policyActivity1.Name             = "policyActivity1";
     rulesetreference1.RuleSetName         = "CalculateItemTotals";
     this.policyActivity1.RuleSetReference = rulesetreference1;
     //
     // SellItemUpdateWorkflow
     //
     this.Activities.Add(this.policyActivity1);
     this.Name = "SellItemUpdateWorkflow";
     this.CanModifyActivities = false;
 }
Esempio n. 4
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
     this.DiscountPolicy = new System.Workflow.Activities.PolicyActivity();
     //
     // DiscountPolicy
     //
     this.DiscountPolicy.Name             = "DiscountPolicy";
     rulesetreference1.RuleSetName        = "Rule Set1";
     this.DiscountPolicy.RuleSetReference = rulesetreference1;
     //
     // TravelRuleSet
     //
     this.Activities.Add(this.DiscountPolicy);
     this.Name = "TravelRuleSet";
     this.CanModifyActivities = false;
 }
Esempio n. 5
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
     this.policyActivity1 = new System.Workflow.Activities.PolicyActivity();
     //
     // policyActivity1
     //
     this.policyActivity1.Name             = "policyActivity1";
     rulesetreference1.RuleSetName         = "ruleSetOne";
     this.policyActivity1.RuleSetReference = rulesetreference1;
     //
     // TrackingRulesWorkflow
     //
     this.Activities.Add(this.policyActivity1);
     this.Name = "TrackingRulesWorkflow";
     this.CanModifyActivities = false;
 }
Esempio n. 6
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
     this.simpleDiscountPolicy = new System.Workflow.Activities.PolicyActivity();
     //
     // simpleDiscountPolicy
     //
     this.simpleDiscountPolicy.Name             = "simpleDiscountPolicy";
     rulesetreference1.RuleSetName              = "DiscountRuleSet";
     this.simpleDiscountPolicy.RuleSetReference = rulesetreference1;
     //
     // SimplePolicyWorkflow
     //
     this.Activities.Add(this.simpleDiscountPolicy);
     this.Name                = "SimplePolicyWorkflow";
     this.Completed          += new System.EventHandler(this.WorkflowCompleted);
     this.CanModifyActivities = false;
 }
        private void InitializeComponent()
        {
            this.CanModifyActivities = true;
            System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
            this.DiscountPolicy = new System.Workflow.Activities.PolicyActivity();
            // 
            // DiscountPolicy
            // 
            this.DiscountPolicy.Name = "DiscountPolicy";
            rulesetreference1.RuleSetName = "Rule Set1";
            this.DiscountPolicy.RuleSetReference = rulesetreference1;
            // 
            // TravelRuleSet
            // 
            this.Activities.Add(this.DiscountPolicy);
            this.Name = "TravelRuleSet";
            this.CanModifyActivities = false;

        }
        private void InitializeComponent()
        {
            this.CanModifyActivities = true;
            System.Workflow.Activities.Rules.RuleSetReference rulesetreference1 = new System.Workflow.Activities.Rules.RuleSetReference();
            this.simpleDiscountPolicy = new System.Workflow.Activities.PolicyActivity();
            // 
            // simpleDiscountPolicy
            // 
            this.simpleDiscountPolicy.Name = "simpleDiscountPolicy";
            rulesetreference1.RuleSetName = "DiscountRuleSet";
            this.simpleDiscountPolicy.RuleSetReference = rulesetreference1;
            // 
            // SimplePolicyWorkflow
            // 
            this.Activities.Add(this.simpleDiscountPolicy);
            this.Name = "SimplePolicyWorkflow";
            this.Completed += new System.EventHandler(this.WorkflowCompleted);
            this.CanModifyActivities = false;

        }
Esempio n. 9
0
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleSetReference       rulesetreference1       = new System.Workflow.Activities.Rules.RuleSetReference();
     System.Workflow.Activities.Rules.RuleConditionReference ruleconditionreference1 = new System.Workflow.Activities.Rules.RuleConditionReference();
     System.Workflow.Activities.Rules.RuleSetReference       rulesetreference2       = new System.Workflow.Activities.Rules.RuleSetReference();
     this.PriorityPolicy        = new System.Workflow.Activities.PolicyActivity();
     this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();
     this.ifReview        = new System.Workflow.Activities.IfElseBranchActivity();
     this.UpdateConfig    = new System.Workflow.Activities.CodeActivity();
     this.Hardcode        = new System.Workflow.Activities.CodeActivity();
     this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();
     this.ReviewPolicy    = new System.Workflow.Activities.PolicyActivity();
     this.ReadConfig      = new System.Workflow.Activities.CodeActivity();
     //
     // PriorityPolicy
     //
     this.PriorityPolicy.Name             = "PriorityPolicy";
     rulesetreference1.RuleSetName        = "Priority Policy";
     this.PriorityPolicy.RuleSetReference = rulesetreference1;
     //
     // ifElseBranchActivity2
     //
     this.ifElseBranchActivity2.Name = "ifElseBranchActivity2";
     //
     // ifReview
     //
     this.ifReview.Activities.Add(this.PriorityPolicy);
     ruleconditionreference1.ConditionName = "Review";
     this.ifReview.Condition = ruleconditionreference1;
     this.ifReview.Name      = "ifReview";
     //
     // UpdateConfig
     //
     this.UpdateConfig.Name         = "UpdateConfig";
     this.UpdateConfig.ExecuteCode += new System.EventHandler(this.UpdateConfig_ExecuteCode);
     //
     // Hardcode
     //
     this.Hardcode.Enabled      = false;
     this.Hardcode.Name         = "Hardcode";
     this.Hardcode.ExecuteCode += new System.EventHandler(this.Hardcode_ExecuteCode);
     //
     // ifElseActivity1
     //
     this.ifElseActivity1.Activities.Add(this.ifReview);
     this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);
     this.ifElseActivity1.Name = "ifElseActivity1";
     //
     // ReviewPolicy
     //
     this.ReviewPolicy.Name             = "ReviewPolicy";
     rulesetreference2.RuleSetName      = "Review Policy";
     this.ReviewPolicy.RuleSetReference = rulesetreference2;
     //
     // ReadConfig
     //
     this.ReadConfig.Name         = "ReadConfig";
     this.ReadConfig.ExecuteCode += new System.EventHandler(this.ReadConfig_ExecuteCode);
     //
     // QCPolicy
     //
     this.Activities.Add(this.ReadConfig);
     this.Activities.Add(this.ReviewPolicy);
     this.Activities.Add(this.ifElseActivity1);
     this.Activities.Add(this.Hardcode);
     this.Activities.Add(this.UpdateConfig);
     this.Name = "QCPolicy";
     this.CanModifyActivities = false;
 }
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            RuleSetReference ruleSetReference = obj as RuleSetReference;

            if (ruleSetReference == null)
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.UnexpectedArgumentType, typeof(RuleSetReference).FullName, "obj");
                throw new ArgumentException(message, "obj");
            }
            Activity activity = manager.Context[typeof(Activity)] as Activity;

            if (activity == null)
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.ContextStackItemMissing, typeof(Activity).Name);
                throw new InvalidOperationException(message);
            }
            PropertyValidationContext validationContext = manager.Context[typeof(PropertyValidationContext)] as PropertyValidationContext;

            if (validationContext == null)
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.ContextStackItemMissing, typeof(PropertyValidationContext).Name);
                throw new InvalidOperationException(message);
            }
            if (!string.IsNullOrEmpty(ruleSetReference.RuleSetName))
            {
                RuleDefinitions   rules             = null;
                RuleSetCollection ruleSetCollection = null;

                CompositeActivity declaringActivity = Helpers.GetDeclaringActivity(activity);
                if (declaringActivity == null)
                {
                    declaringActivity = Helpers.GetRootActivity(activity) as CompositeActivity;
                }
                if (activity.Site != null)
                {
                    rules = ConditionHelper.Load_Rules_DT(activity.Site, declaringActivity);
                }
                else
                {
                    rules = ConditionHelper.Load_Rules_RT(declaringActivity);
                }

                if (rules != null)
                {
                    ruleSetCollection = rules.RuleSets;
                }

                if (ruleSetCollection == null || !ruleSetCollection.Contains(ruleSetReference.RuleSetName))
                {
                    string          message         = string.Format(CultureInfo.CurrentCulture, Messages.RuleSetNotFound, ruleSetReference.RuleSetName);
                    ValidationError validationError = new ValidationError(message, ErrorNumbers.Error_RuleSetNotFound);
                    validationError.PropertyName = GetFullPropertyName(manager) + "." + "RuleSetName";
                    validationErrors.Add(validationError);
                }
                else
                {
                    RuleSet actualRuleSet = ruleSetCollection[ruleSetReference.RuleSetName];

                    ITypeProvider typeProvider = (ITypeProvider)manager.GetService(typeof(ITypeProvider));

                    IDisposable localContextScope = (WorkflowCompilationContext.Current == null ? WorkflowCompilationContext.CreateScope(manager) : null);
                    try
                    {
                        RuleValidation validation = new RuleValidation(activity, typeProvider, WorkflowCompilationContext.Current.CheckTypes);
                        actualRuleSet.Validate(validation);
                        ValidationErrorCollection actualRuleSetErrors = validation.Errors;

                        if (actualRuleSetErrors.Count > 0)
                        {
                            string expressionPropertyName = GetFullPropertyName(manager);
                            string genericErrorMsg        = string.Format(CultureInfo.CurrentCulture, Messages.InvalidRuleSetExpression, expressionPropertyName);
                            int    errorNumber            = ErrorNumbers.Error_InvalidRuleSetExpression;

                            if (activity.Site != null)
                            {
                                foreach (ValidationError actualError in actualRuleSetErrors)
                                {
                                    ValidationError validationError = new ValidationError(actualError.ErrorText, errorNumber);
                                    validationError.PropertyName = expressionPropertyName + "." + "RuleSet Definition";
                                    validationErrors.Add(validationError);
                                }
                            }
                            else
                            {
                                foreach (ValidationError actualError in actualRuleSetErrors)
                                {
                                    ValidationError validationError = new ValidationError(genericErrorMsg + " " + actualError.ErrorText, errorNumber);
                                    validationError.PropertyName = expressionPropertyName;
                                    validationErrors.Add(validationError);
                                }
                            }
                        }
                        //
                    }
                    finally
                    {
                        if (localContextScope != null)
                        {
                            localContextScope.Dispose();
                        }
                    }
                }
            }
            else
            {
                string          message         = string.Format(CultureInfo.CurrentCulture, Messages.InvalidRuleSetName, "RuleSetReference");
                ValidationError validationError = new ValidationError(message, ErrorNumbers.Error_InvalidRuleSetName);
                validationError.PropertyName = GetFullPropertyName(manager) + "." + "RuleSetName";
                validationErrors.Add(validationError);
            }
            return(validationErrors);
        }
Esempio n. 11
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors    = base.Validate(manager, obj);
            RuleSetReference          reference = obj as RuleSetReference;

            if (reference == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Messages.UnexpectedArgumentType, new object[] { typeof(RuleSetReference).FullName, "obj" }), "obj");
            }
            Activity activity = manager.Context[typeof(Activity)] as Activity;

            if (activity == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.ContextStackItemMissing, new object[] { typeof(Activity).Name }));
            }
            if (!(manager.Context[typeof(PropertyValidationContext)] is PropertyValidationContext))
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.ContextStackItemMissing, new object[] { typeof(PropertyValidationContext).Name }));
            }
            if (!string.IsNullOrEmpty(reference.RuleSetName))
            {
                RuleDefinitions   definitions       = null;
                RuleSetCollection ruleSets          = null;
                CompositeActivity declaringActivity = Helpers.GetDeclaringActivity(activity);
                if (declaringActivity == null)
                {
                    declaringActivity = Helpers.GetRootActivity(activity) as CompositeActivity;
                }
                if (activity.Site != null)
                {
                    definitions = ConditionHelper.Load_Rules_DT(activity.Site, declaringActivity);
                }
                else
                {
                    definitions = ConditionHelper.Load_Rules_RT(declaringActivity);
                }
                if (definitions != null)
                {
                    ruleSets = definitions.RuleSets;
                }
                if ((ruleSets == null) || !ruleSets.Contains(reference.RuleSetName))
                {
                    ValidationError error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.RuleSetNotFound, new object[] { reference.RuleSetName }), 0x576)
                    {
                        PropertyName = base.GetFullPropertyName(manager) + ".RuleSetName"
                    };
                    errors.Add(error);
                    return(errors);
                }
                RuleSet       set     = ruleSets[reference.RuleSetName];
                ITypeProvider service = (ITypeProvider)manager.GetService(typeof(ITypeProvider));
                using ((WorkflowCompilationContext.Current == null) ? WorkflowCompilationContext.CreateScope(manager) : null)
                {
                    RuleValidation validation = new RuleValidation(activity, service, WorkflowCompilationContext.Current.CheckTypes);
                    set.Validate(validation);
                    ValidationErrorCollection errors2 = validation.Errors;
                    if (errors2.Count > 0)
                    {
                        string fullPropertyName = base.GetFullPropertyName(manager);
                        string str6             = string.Format(CultureInfo.CurrentCulture, Messages.InvalidRuleSetExpression, new object[] { fullPropertyName });
                        int    errorNumber      = 0x577;
                        if (activity.Site != null)
                        {
                            foreach (ValidationError error2 in errors2)
                            {
                                ValidationError error3 = new ValidationError(error2.ErrorText, errorNumber)
                                {
                                    PropertyName = fullPropertyName + ".RuleSet Definition"
                                };
                                errors.Add(error3);
                            }
                            return(errors);
                        }
                        foreach (ValidationError error4 in errors2)
                        {
                            ValidationError error5 = new ValidationError(str6 + " " + error4.ErrorText, errorNumber)
                            {
                                PropertyName = fullPropertyName
                            };
                            errors.Add(error5);
                        }
                    }
                    return(errors);
                }
            }
            ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.InvalidRuleSetName, new object[] { "RuleSetReference" }), 0x578)
            {
                PropertyName = base.GetFullPropertyName(manager) + ".RuleSetName"
            };

            errors.Add(item);
            return(errors);
        }