Esempio n. 1
0
 public UloViewModel(UnliquidatedObligation ulo, Workflow workflow, IWorkflowDescription workflowDescription, bool workflowAsignedToCurrentUser, IList <GetUloSummariesByPdn_Result0> others, ICollection <Document> uniqueMissingLineageDocuments, bool belongs)
 {
     CurretUnliquidatedObligation = ulo;
     WorkflowViewModel            = new WorkflowViewModel(workflow, workflowAsignedToCurrentUser, workflowDescription, uniqueMissingLineageDocuments);
     Others = others;
     BelongsToMyUnassignmentGroup = belongs;
 }
        private void PopulateWorkflowDescriptionIntoViewBag(IWorkflowDescription workflowDescription, Workflow wf, string docType, string mostRecentNonReassignmentAnswer, string mostRecentRealAnswer)
        {
            ViewBag.JustificationByKey  = workflowDescription.GetJustificationByKey();
            ViewBag.WorkflowDescription = workflowDescription;
            var wawa = workflowDescription.Activities.FirstOrDefault(a => a.WorkflowActivityKey == wf.CurrentWorkflowActivityKey) as WebActionWorkflowActivity;
            var d    = new Dictionary <string, QuestionChoice>();

            ViewBag.QuestionChoiceByQuestionChoiceValue = d;
            wawa?.QuestionChoices?.WhereMostApplicable(docType, mostRecentNonReassignmentAnswer, mostRecentRealAnswer).ForEach(z => d[z.Value] = z);
        }
        public static IList <Justification> GetJustifications(this IWorkflowDescription workflowDescription, IEnumerable <string> justificationKeys)
        {
            var justifications = new List <Justification>();

            if (justificationKeys != null)
            {
                var d = workflowDescription.Justifications.ToDictionary(j => j.Key);
                foreach (var k in justificationKeys)
                {
                    var justification = d.FindOrDefault(k);
                    if (justification != null)
                    {
                        justifications.Add(justification);
                    }
                }
            }
            return(justifications);
        }
        Task <IWorkflowDescription> IWorkflowDescriptionFinder.FindAsync(string workflowDefinitionKey, int minVersion)
        {
            var z =
                (
                    from wd in DB.WorkflowDefinitions
                    where wd.WorkflowKey == workflowDefinitionKey && wd.Version >= minVersion
                    orderby wd.Version descending
                    select wd
                ).FirstOrDefault();

            IWorkflowDescription ret = null;

            if (z != null)
            {
                ret = z.Description;
            }

            return(Task.FromResult(ret));
        }
Esempio n. 5
0
        public WorkflowViewModel(Workflow workflow, bool workflowAssignedToCurrentUser, IWorkflowDescription workflowDescription, ICollection <Document> uniqueMissingLineageDocuments)
        {
            Requires.NonNull(workflow, nameof(workflow));

            Workflow = workflow;
            var questions = workflow.WorkflowUnliqudatedObjectsWorkflowQuestions.OrderBy(q => q.UnliqudatedWorkflowQuestionsId).ToList();

            WorkflowAssignedToCurrentUser = workflowAssignedToCurrentUser;
            bool allowDocumentEdits        = workflowAssignedToCurrentUser;
            var  expectedDateForCompletion = workflow.TargetUlo.ExpectedDateForCompletion;

            if (workflowDescription != null)
            {
                QuestionsViewModel           = new UloWfQuestionsViewModel(workflowDescription.GetJustificationByKey(), questions.Where(q => !q.Pending).ToList());
                WorkflowDescriptionViewModel =
                    new WorkflowDescriptionViewModel(
                        workflow.WorkflowId,
                        workflowDescription.WebActionWorkflowActivities.ToList(),
                        workflow.CurrentWorkflowActivityKey);

                var pending = questions.Count > 0 && questions.Last().Pending ? questions.Last() : null;
                AdvanceViewModel   = new AdvanceViewModel(WorkflowDescriptionViewModel.CurrentActivity.QuestionChoices, pending, workflow, expectedDateForCompletion, WorkflowDescriptionViewModel.CurrentActivity.ExpectedDateForCompletionEditable);
                allowDocumentEdits = workflowAssignedToCurrentUser && WorkflowDescriptionViewModel.CurrentActivity.AllowDocumentEdit;
            }
            //throw new NotImplementedException("old code in need for porting!");

            RequestForReassignment = Workflow.WorkflowRequestForReassignments.OrderByDescending(z => z.RequestForReassignmentID).FirstOrDefault();
            DocumentsViewModel     = new DocumentsViewModel(workflow.WorkflowDocuments.ToList(), allowDocumentEdits, workflow.TargetUlo.DocType, uniqueMissingLineageDocuments, workflow.WorkflowId);
        }
 public static IList <Justification> GetResassignmentJustifications(this IWorkflowDescription workflowDescription)
 => workflowDescription.GetJustifications(workflowDescription.ResassignmentJustificationKeys);
 public static IDictionary <string, Justification> GetJustificationByKey(this IWorkflowDescription workflowDescription)
 => workflowDescription.Justifications.ToDictionaryOnConflictKeepLast(j => j.Key, j => j);