public virtual ActionResult MissionsWorkflow(string operationNumber, TaskDataModel model) { string documentReference = string.Empty; string host = string.Empty; string port = string.Empty; string fullPath = string.Empty; Logger.GetLogger().WriteDebug("ViewController", "Method: MissionsWorkflow : UserName: "******"MissionID"])); var missionModel = mission.MissionbyId; var validatorsResponse = _k2DataService.GetValidators(model.Code, model.TaskFolio); validatorsResponse.Validators = _viewModelMapperHelper .FilterMandatory( validatorsResponse.Validators, missionModel.Header.Type, missionModel.IsHaitiCountry, model.Code, mission.Mission.Operation.OperationData.OperationType.Code); var commentsResponse = _missionService.GetComments(Convert.ToInt32(model.Parameters["MissionID"])); bool isLastApproved = _viewModelMapperHelper.IsLastEmptyState(validatorsResponse.Validators); if (isLastApproved) { documentReference = _viewModelMapperHelper.GetLastDocumentTOR(Convert.ToInt32(model.Parameters["MissionID"])); host = "https://" + Request.Url.Host; port = Request.Url.Port.ToString(); fullPath = host + ":" + port + Url.RouteUrl("Document_default", new { action = "DownloadDocument", documentNumber = documentReference }); } var groupCode = _missionService.DetermineGroupCode(mission.Mission); var taskTypeCode = _missionService.DetermineWorkflowCode(groupCode); var workflowResponse = _missionService.HasWorkflowActive( operationNumber, mission.Mission.MissionId, taskTypeCode); var modelTaskView = new MissionsWorkflowViewModels { StartProfileTM = GetListMembersInString(missionModel), missionId = missionModel.MissionId, missionStatusCode = missionModel.Header.StatusCode, missionCode = missionModel.Header.MissionCode, UserComments = commentsResponse, Instructions = Localization.GetText("OP.MS.K2.ApproveMission.Instructions"), TaskDataModel = model, UserName = IDBContext.Current.UserName, Validators = validatorsResponse.Validators, Documents = _viewModelMapperHelper.GetWorkFlowMissionDocuments(Convert.ToInt32(model.Parameters["MissionID"])), IsLastApproved = isLastApproved ? "sendLastTor" : string.Empty, DocNumber = documentReference, UrlDocumentTOR = fullPath, IsGroupCodeVps = groupCode == DivisionOpusGroup.VPS, HasWorkflowActive = workflowResponse.HasCondition }; if (model.Parameters.ContainsKey("AddValidators")) { modelTaskView.Validators = _missionService.saveExistingValidators(modelTaskView.Validators, modelTaskView.TaskDataModel.WorkflowInstanceId, Convert.ToString(model.Parameters["AddValidators"])); } ViewBag.SerializedViewModel = IDB.Presentation.MVC4.Helpers.PageSerializationHelper.SerializeObject(modelTaskView); return(View(modelTaskView)); }