Esempio n. 1
0
        public void Init(HttpApplication context)
        {
            context.AuthenticateRequest += Module_AuthenticateRequest;
            context.EndRequest          += Module_EndRequest;

            // load the configuration section from Web.config
            try
            {
                config = AuthnzConfigSection.GetConfig();

                decisionPoint = new DecisionPoint(config.AccessControl);

                Type providerType = Type.GetType(config.ProviderType);

                identityProvider = (IEsriWebIdentityProvider)Activator.CreateInstance(providerType);
                identityProvider.Initialize(config.ProviderSettings.ConvertToNVC());

                if (config.WhitelistedIPs != null)
                {
                    NameValueCollection nvc = config.WhitelistedIPs.ConvertToNVC();
                    foreach (String key in nvc.Keys)
                    {
                        whitelist.Add(nvc[key]);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("unable to create instance of provider", ex);
            }
        }
        public void Build_Basic_Graph( )
        {
            FlowDiagramControl flowDiagram = new FlowDiagramControl( );

            var initialState = new InitialState( );
            var dp           = new DecisionPoint( );
            var finalState   = new FinalState( );

            flowDiagram.AddShape(initialState);
            flowDiagram.AddShape(dp);
            flowDiagram.AddShape(finalState);

            initialState.Connection.To = dp;
            dp.True.To  = finalState;
            dp.False.To = finalState;
        }
        //    [Test]
        public void Convert_From_Graph_To_StateMap( )
        {
            FlowDiagramControl flowDiagram = new FlowDiagramControl();

            var initialState = new InitialState();
            var dp           = new DecisionPoint();
            var finalState   = new FinalState();

            flowDiagram.AddShape(initialState);
            flowDiagram.AddShape(dp);
            flowDiagram.AddShape(finalState);

            initialState.Connection.To = dp;
            dp.True.To  = finalState;
            dp.False.To = finalState;

            flowDiagram.Convert(false);
        }
Esempio n. 4
0
        public virtual void WorkFlowProcessCancel(int workFlowTraceId)
        {
            WorkFlowTrace workFlowTrace = WorkFlowTraceDetail(workFlowTraceId);

            if (workFlowTrace.Process.GetType() == typeof(DecisionPoint))
            {
                DecisionPoint decisionPoint = (DecisionPoint)workFlowTrace.Process;

                if (decisionPoint.CancelProcessId != null)
                {
                    int cancelProcessId = (int)decisionPoint.CancelProcessId;

                    if (workFlowTrace.JobId != null)
                    {
                        RecurringJob.RemoveIfExists(workFlowTrace.JobId);
                    }
                    _unitOfWork.Repository <WorkFlowTrace>().Remove(workFlowTraceId);
                    CreateWorkFlowTrace(cancelProcessId, workFlowTrace.OwnerId);
                }
            }
        }
Esempio n. 5
0
 public static ConditionOption CreateDecisionPointNoOption(
     string name,
     DecisionPoint decisionPoint)
 {
     return(new ConditionOption(decisionPoint.Task, name, ProjectRole.System, decisionPoint, "N"));
 }
Esempio n. 6
0
        public void DecisionPointTakeTheNextStep(int workFlowTraceId)
        {
            WorkFlowTrace workFlowTraceDecisionPoint = _unitOfWork.Repository <WorkFlowTrace>().Get(workFlowTraceId);

            DecisionPoint decisionPoint = _unitOfWork.Repository <DecisionPoint>().Get(x => x.Id == workFlowTraceDecisionPoint.ProcessId, x => x.DecisionMethod, x => x.Task);

            if (!string.IsNullOrEmpty(decisionPoint.DecisionMethod.MethodFunction))
            {
                string serviceName = decisionPoint.Task.MethodServiceName;
                string methodName  = string.Format("{0}.{1}", serviceName, decisionPoint.DecisionMethod.MethodFunction.Substring(0, decisionPoint.DecisionMethod.MethodFunction.LastIndexOf("(")));

                var parameters = decisionPoint.DecisionMethod.MethodFunction.Substring(
                    decisionPoint.DecisionMethod.MethodFunction.LastIndexOf("(") + 1,
                    (decisionPoint.DecisionMethod.MethodFunction.LastIndexOf(")") - decisionPoint.DecisionMethod.MethodFunction.LastIndexOf("(") - 1))
                                 .Split(',')
                                 .Select(p => p.Trim())
                                 .ToList();


                List <object> parametersValue = new List <object>();

                foreach (var parameter in parameters)
                {
                    if (!string.IsNullOrWhiteSpace(parameter))
                    {
                        var property = workFlowTraceDecisionPoint.GetType().GetProperties().Where(x => x.Name == parameter).FirstOrDefault();
                        if (property != null)
                        {
                            var value = property.GetValue(workFlowTraceDecisionPoint, null);
                            parametersValue.Add(value);
                        }
                        else
                        {
                            parametersValue.Add(parameter);
                        }
                    }
                }

                var parametersArray = parametersValue.ToArray();

                var methodCallString = string.Format("{0}({1})", methodName, string.Join(",", parametersArray));

                var decisionMethodResult =
                    DynamicMethodCallService.Caller(
                        _unitOfWork,
                        methodCallString,
                        _workFlowDataService);

                Process conditionOption = _unitOfWork.Repository <ConditionOption>().Get(x => x.ConditionId == decisionPoint.Id && x.Value == decisionMethodResult);
                if (conditionOption.NextProcessId == decisionPoint.Id)
                {
                    if (workFlowTraceDecisionPoint.JobId == null)
                    {
                        List <object> decisionPointJobCallParameterList = new List <object>();

                        string jobId = Guid.NewGuid().ToString();
                        decisionPointJobCallParameterList.Add(workFlowTraceId);
                        decisionPointJobCallParameterList.Add(jobId);
                        decisionPointJobCallParameterList.Add(decisionPoint.RepetitionFrequenceByHour);

                        var methodJobCallString = string.Format("{0}.DecisionPointJobCall({1})", serviceName, string.Join(",", decisionPointJobCallParameterList.ToArray()));

                        DynamicMethodCallService.Caller(
                            _unitOfWork,
                            methodJobCallString,
                            _workFlowDataService);
                    }
                }
                else
                {
                    workFlowTraceDecisionPoint.ConditionOptionId = conditionOption.Id;
                    AddOrUpdate(workFlowTraceDecisionPoint);
                    if (workFlowTraceDecisionPoint.JobId != null)
                    {
                        RecurringJob.RemoveIfExists(workFlowTraceDecisionPoint.JobId);
                    }
                    GoToWorkFlowNextProcess(workFlowTraceDecisionPoint.OwnerId);
                }
            }
        }
 private void Start() => _decisionPoint = GetComponent <DecisionPoint>();