public virtual JsonResult SaveAttributeForm(int attributeFormId)
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <AttributeFormViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateAttributesFormViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = string.Empty;

            SaveResponse response = new SaveResponse();

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response.IsValid      = false;
                response.ErrorMessage = errorMessage;
            }
            else
            {
                response = _attributesEngineService.SaveAttributeFormResponse(viewModel);
                if (response.IsValid)
                {
                }
                else
                {
                    return(Json(new
                    {
                        response.ErrorMessage
                    }));
                }
            }

            response.IsValid = true;
            return(Json(response));
        }
Esempio n. 2
0
        public virtual JsonResult SaveChecklist(int procurementId)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true
            };
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var model           = PageSerializationHelper.DeserializeObject <ProcurementDetailViewModel>(jsonDataRequest.SerializedData);
            var formData        = jsonDataRequest.ClientFieldData;

            model.UpdateChecklist(formData);

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, SGP_PROCUREMENT_DETAIL_URL + procurementId, IDBContext.Current.Operation, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            var response = _procurementDetailsService.SaveProcurementChecklist(procurementId, model);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                var url = Url.Action("Read", "ProcurementDetail", new { area = "SGP", tabName = ProcurementDetailNavigation.TAB_NAME_CHECKLIST, procurementId = procurementId });
                responseView.UrlRedirect = url;
            }

            return(Json(responseView));
        }
        public virtual JsonResult AttributeEditSave(int id = 0)
        {
            AttributeEditSaveResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <AttributeEditViewModel>(jsonDataRequest.SerializedData);
            var isNew           = viewModel.AttributeId == 0;

            viewModel.UpdateAttributeViewModel(jsonDataRequest.ClientFieldData);
            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit", UrlAttributeView, id.ToString(), userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new AttributeEditSaveResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _attributesManagementService.AttributeEditSave(viewModel);
                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(UrlAttributeView, id.ToString(), userName);
                }

                response.IsValid = !isNew;
            }

            return(Json(response));
        }
Esempio n. 4
0
        public virtual JsonResult Mission(string operationNumber)
        {
            SaveMissionResponse response = new SaveMissionResponse();
            var jsonDataRequest          = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel = PageSerializationHelper.DeserializeObject <MissionViewModel>(jsonDataRequest.SerializedData);

            if (viewModel == null)
            {
                viewModel = new MissionViewModel();
            }

            viewModel.UpdateMissionViewModel(jsonDataRequest.ClientFieldData);

            string userName  = IDBContext.Current.UserName;
            string missionId = viewModel.MissionId.ToString();

            response = _missionService.SaveMission(viewModel, operationNumber);

            if (!viewModel.IsNewMission)
            {
                SynchronizationHelper.TryReleaseLock(UrlMission, missionId, userName);
            }

            return(Json(response));
        }
Esempio n. 5
0
        public virtual JsonResult SaveProcurementList(string operationNumber)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true
            };

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, SYNC_PROCUREMENT_LIST, operationNumber, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var model           = PageSerializationHelper.DeserializeObject <ProcurementViewModel>(jsonDataRequest.SerializedData);

            model.UpdateProcurementList(jsonDataRequest.ClientFieldData, _enumMappingService);

            var response = _firmProcurementService.SaveProcurementList(operationNumber, model);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(SYNC_PROCUREMENT_LIST, operationNumber, IDBContext.Current.UserLoginName);
                var url = Url.Action("ProcurementList", "FirmProcurement", new { area = "Procurement" });
                responseView.UrlRedirect = url;
            }

            return(Json(responseView));
        }
        public virtual JsonResult SaveBasicData(string operationNumber)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true
            };

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var model           = PageSerializationHelper.DeserializeObject <BasicDataViewModel>(jsonDataRequest.SerializedData);

            model.UpdateProductDataBasicData(jsonDataRequest.ClientFieldData);
            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources(OPUS_EDIT, URL_OPERATION_BASIC_DATA, operationNumber, userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
            }
            else
            {
                var response = _productProfileService.SaveBasicData(operationNumber, model);
                responseView.IsValid      = response.IsValid;
                responseView.ErrorMessage = response.ErrorMessage;
            }

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(URL_OPERATION_BASIC_DATA, operationNumber, userName);
                var url = Url.Action(READ_ACTION, PP_CONTROLLER, new { area = AttributeValue.CPD, tabName = TAB_NAME_BASICDATA });
                responseView.UrlRedirect = url;
            }

            return(Json(responseView));
        }
        public virtual ActionResult SaveIndicativePipeline(string operationNumber)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true, ErrorMessage = string.Empty
            };

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <IndicativePipelineTabViewModel>(jsonDataRequest.SerializedData);
            var formData        = jsonDataRequest.ClientFieldData;

            viewModel.UpdateIndicativePipelineTabViewModel(formData);

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, CPD_ANNEXES_INDICATIVE_PIPELINE, operationNumber, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            var response = _annexesService.SaveIndicativePipelineTab(operationNumber, viewModel);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(CPD_ANNEXES_INDICATIVE_PIPELINE, operationNumber, IDBContext.Current.UserLoginName);
                responseView.UrlRedirect = Url.Action("Read", "Annexes", new { area = "CPD", tabName = NavigationAttributes.TAB_NAME_INDICATIVE_PIPELINE });
            }

            return(Json(responseView));
        }
Esempio n. 8
0
        public virtual JsonResult SaveParticipant(string operationNumber)
        {
            SaveParticipantResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <VerParticipantViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateParticipantViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources(
                "edit", VerGlobalValues.URL_PARTICIPANT, operationNumber, userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new SaveParticipantResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _verService.SaveParticipant(viewModel);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(VerGlobalValues.URL_PARTICIPANT, operationNumber, userName);
                }
            }

            return(Json(response));
        }
        public virtual ActionResult SaveUseOfCountrySystems(string operationNumber)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true, ErrorMessage = string.Empty
            };

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <CSPDUseOfCountrySystemsTabViewModel>(jsonDataRequest.SerializedData);
            var formData        = jsonDataRequest.ClientFieldData;

            viewModel.UpdateUseOfCountrySystemsTabCSViewModel(formData);

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, CPD_PROGRESS_DATE_UCS_URL, operationNumber, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            var response = _csProgressToDateService.SaveUseOfCSTab(operationNumber, viewModel);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(CPD_PROGRESS_DATE_UCS_URL, operationNumber, IDBContext.Current.UserLoginName);
                responseView.UrlRedirect = Url.Action("Read", "CSProgressToDate", new { area = "CPD", tabName = NavigationAttributes.TAB_NAME_PD_USEOFCS });
            }

            return(Json(responseView));
        }
        public virtual JsonResult RejectTask(string operationNumber, string userRole)
        {
            var response = new StartAdvanceWorkflowResponse();

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <MissionsK2TaskViewModel>(jsonDataRequest.SerializedData);

            var parameters = new Dictionary <string, object>();

            parameters.Add(K2HelperOpus.TaskUserName, viewModel.UserName);
            parameters.Add(K2HelperOpus.UserRole, viewModel.UserRoleMissions);

            try
            {
                response = SendWorkflowAction(
                    viewModel.TaskDataModel.Code,
                    viewModel.TaskDataModel.TaskFolio,
                    operationNumber,
                    viewModel.TaskDataModel.TaskTypeCode,
                    parameters,
                    K2IntegrationEnumerator.GeneralActions.RejectWorkflow,
                    viewModel.TaskDataModel.TaskId);
            }
            catch (Exception e)
            {
                response.IsValid      = false;
                response.ErrorMessage = e.ToString();
            }

            return(Json(response));
        }
Esempio n. 11
0
        public virtual JsonResult LCUpdateTask(string operationNumber)
        {
            ResponseBase response        = new ResponseBase();
            var          jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var          viewModel       = PageSerializationHelper.DeserializeObject <TasksViewModel>(jsonDataRequest.SerializedData);
            var          splittedFolio   = viewModel.TaskDataModel.TaskFolio.Split('-');
            var          milestoneId     = splittedFolio[splittedFolio.Length - 1];

            try
            {
                var workFlow = jsonDataRequest.ClientFieldData.FirstOrDefault(o => o.Name.Equals("changeStatus"));

                switch (workFlow.Value)
                {
                case LifeCycleGlobalValues.COMPLETE_ACTION_TASK:
                    _lcTaskService.CompleteTask(viewModel.TaskDataModel.TaskId, viewModel.TaskDataModel.WorkflowInstanceId, LifeCycleGlobalValues.COMPLETE_TASK, LifeCycleGlobalValues.COMPLETE_ACTION_TASK, viewModel.TaskDataModel.UserName, milestoneId);
                    break;

                case LifeCycleGlobalValues.REJECT_ACTION_TASK:
                    _lcTaskService.CompleteTask(viewModel.TaskDataModel.TaskId, viewModel.TaskDataModel.WorkflowInstanceId, LifeCycleGlobalValues.REJECT_TASK, LifeCycleGlobalValues.REJECT_ACTION_TASK, viewModel.TaskDataModel.UserName, milestoneId);
                    break;
                }

                response.IsValid = true;
            }
            catch (Exception e)
            {
                response.IsValid      = false;
                response.ErrorMessage = e.ToString();
            }

            return(Json(response));
        }
        public virtual JsonResult RolesAndPermissionsDataSaveController()
        {
            RolesAndPermissionsSaveResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <RoleInformationViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateRoleInformationSaveViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit", UrlRolesAndPermissionsView, viewModel.IdRolePermission.ToString(), userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new RolesAndPermissionsSaveResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _rolesAndPermissionsService.RolesAndPermissionsSave(viewModel);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(UrlRolesAndPermissionsView, viewModel.IdRolePermission.ToString(), userName);
                }
            }

            return(Json(response));
        }
Esempio n. 13
0
        public virtual ActionResult SaveTemplateList()
        {
            var responseView = new SaveResponse()
            {
                IsValid = true
            };

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <TemplatePageViewModel>(jsonDataRequest.SerializedData);
            var formData        = jsonDataRequest.ClientFieldData;

            viewModel.UpdateTemplateListPage(formData);

            var response = _resultFrameworkService.SaveTemplates(viewModel.Templates);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                var url = Url.Action("TemplatesPage", base.ControllerName, new { area = "Indicators" });
                responseView.UrlRedirect = url;
            }

            return(Json(responseView));
        }
Esempio n. 14
0
        public virtual JsonResult GeneralInformationlSave(string operationNumber)
        {
            SaveGeneralInformationResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <GeneralInformationViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateGeneralInformationlDataViewModel(jsonDataRequest.ClientFieldData, _enumMappingService);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit", URL_GENERAL_INFORMATION, operationNumber, userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new SaveGeneralInformationResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _generalInformationService.SaveGeneralInformation(operationNumber, viewModel);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(URL_GENERAL_INFORMATION, operationNumber, userName);
                }
            }

            return(Json(response));
        }
Esempio n. 15
0
        public virtual ActionResult SaveStrategicAlignment(string operationNumber)
        {
            var responseView = new SaveResponse()
            {
                IsValid = true, ErrorMessage = string.Empty
            };

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <StrategicAlignmentTabViewModel>(jsonDataRequest.SerializedData);
            var formData        = jsonDataRequest.ClientFieldData;

            viewModel.UpdateStrategicAlignmentTabViewModel(formData, operationNumber);

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, CPD_COUNTRY_PROGRAM_SA_URL, operationNumber, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            var response = _countryProgramService.SaveStrategicAligmentTab(operationNumber, viewModel);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(CPD_COUNTRY_PROGRAM_SA_URL, operationNumber, IDBContext.Current.UserLoginName);
                responseView.UrlRedirect = Url.Action("Read", "CountryProgram", new { area = "CPD", tabName = NavigationAttributes.TAB_NAME_STRATEGICALIGNMENT });
            }

            return(Json(responseView));
        }
        public virtual JsonResult InstitutionEditSave(int id = 0, bool repeatAddress = false)
        {
            InstitutionEditSaveResponse response;

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <InstitutionEditViewModel>(jsonDataRequest.SerializedData);
            var isNew           = viewModel.InstitutionId == 0;

            viewModel.UpdateInstitutionViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit", URL_INSTITUTION_VIEW, id.ToString(), userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new InstitutionEditSaveResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _institutionService.InstitutionEditSave(viewModel, repeatAddress);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(URL_INSTITUTION_VIEW, id.ToString(), userName);
                }

                response.IsValid = !isNew;
            }

            return(Json(response));
        }
Esempio n. 17
0
        public virtual JsonResult SaveOutputIndicatorDetail(string operationNumber)
        {
            var response  = new SaveOutputIndicatorDetailResponse();
            var userName  = IDBContext.Current.UserName;
            var loginName = IDBContext.Current.UserLoginName;

            try
            {
                var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
                var viewModel       = PageSerializationHelper
                                      .DeserializeObject <OutputIndicatorDetailContentViewModel>(
                    jsonDataRequest.SerializedData);

                viewModel.UpdateOutputIndicatorDetail(jsonDataRequest.ClientFieldData);
                response = _componentService.SaveOuputIndicatorDetail(viewModel, userName);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(
                        TCMGlobalValues.TCM_EDIT_COMPONENTS, operationNumber, loginName);
                }
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(Json(response));
        }
        public virtual JsonResult SaveOverallProjectManagement(string operationNumber)
        {
            SaveFindingRecommendationResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <FindingRecommendationHeaderModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateOverallProjectManagementViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit",
                                                                       TCMGlobalValues.URL_OVERRAL_PROJECT,
                                                                       operationNumber,
                                                                       userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new SaveFindingRecommendationResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _findingRecomendationService.SaveOverallProjectManagement(operationNumber, viewModel);
                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(TCMGlobalValues.URL_OVERRAL_PROJECT,
                                                         operationNumber,
                                                         userName);
                }
            }

            return(Json(response));
        }
Esempio n. 19
0
        public virtual JsonResult MappingProgressSave(string operationNumber)
        {
            SaveMappingProgressResponse response;
            var jsonDataResquest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel        =
                PageSerializationHelper.DeserializeObject <MappingProgressViewModel>(
                    jsonDataResquest.SerializedData);
            var outputViewModel = ClientFieldDataMappers
                                  .UpdateOutputViewModel(jsonDataResquest.ClientFieldData, viewModel);
            var outputYearVisualizationViewModel = ClientFieldDataMappers
                                                   .UpdateOutputYearVisualizationViewModel(jsonDataResquest.ClientFieldData, viewModel);

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = SynchronizationHelper.AccessToResources(
                "edit", TCMGlobalValues.URL_MAPPING_PROGRESS, operationNumber, userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new SaveMappingProgressResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _componentService.UpdateMappingProgressData(
                    outputViewModel, outputYearVisualizationViewModel);
            }

            return(Json(response));
        }
Esempio n. 20
0
        public virtual JsonResult Effectiveness(string operationNumber)
        {
            SaveEffectivenessResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <PCRChecklistViewModel>(jsonDataRequest.SerializedData);

            viewModel.PCREffectivenessViewModel.UpdatePCREffectivenessViewModel(jsonDataRequest.ClientFieldData);

            var userName     = IDBContext.Current.UserName;
            var errorMessage = SynchronizationHelper.AccessToResources("edit", UrlEffectiveness, operationNumber, userName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new SaveEffectivenessResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _pcrChecklistService.SaveEffectiveness(viewModel.PCREffectivenessViewModel);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(UrlEffectiveness, operationNumber, userName);
                }
            }

            return(Json(response));
        }
Esempio n. 21
0
        public virtual JsonResult SubmitTask()
        {
            var result = new JsonResult();

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <PCRWorkflowTaskViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateWorkflowTask(jsonDataRequest.ClientFieldData);

            var responseComment = _k2UIIntegrationService.CreateWorkflowComment(viewModel);

            if (!responseComment.IsValid)
            {
                result.Data = new
                {
                    responseComment.IsValid,
                    responseComment.ErrorMessage
                };
                return(result);
            }

            var response = _pcrChecklistService.ChangeStage(viewModel.OperationNumber, viewModel.WorkflowInstanceTaskId, viewModel.TaskTypeId, viewModel.FolioId);

            result.Data = new
            {
                response.IsValid,
                response.ErrorMessage
            };

            return(result);
        }
Esempio n. 22
0
        public virtual JsonResult Save(string operationNumber)
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <DynamicQuestionnaireViewModel>(jsonDataRequest.SerializedData);

            return(Json(true));
        }
        public virtual JsonResult SaveTemplate()
        {
            var response = new DocumentTemplateResponse
            {
                IsValid = true
            };

            try
            {
                var jsonDataRequest   = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
                var viewModelTemplate =
                    PageSerializationHelper.DeserializeObject <TemplateViewModel>(jsonDataRequest.SerializedData);
                viewModelTemplate.UpdateDocumentTemplateViewModel(jsonDataRequest.ClientFieldData);
                viewModelTemplate.SourceDocumentVersion = "1";
                viewModelTemplate.IsValid =
                    DateTime.Compare(viewModelTemplate.DateCreated, viewModelTemplate.DateExpired) <= 0;

                var documentUpload = new UploadRequest();
                if (viewModelTemplate.DocumentTemplateId <= 0)
                {
                    var tempFileName =
                        jsonDataRequest.ClientFieldData.First(e => "templateTempFileName".Equals(e.Name)).Value;
                    var fileName = jsonDataRequest.ClientFieldData.First(e => "templateFileName".Equals(e.Name)).Value;
                    documentUpload = new UploadRequest
                    {
                        File     = System.IO.File.ReadAllBytes(Path.GetTempPath() + @"\" + tempFileName),
                        FileName = fileName
                    };
                    System.IO.File.Delete(Path.GetTempPath() + @"\" + tempFileName);
                }

                var sharePointUrl  = ConfigurationManager.AppSettings.Get("DocumentTemplate_TemplateUrl");
                var templateFolder = ConfigurationManager.AppSettings.Get("DocumentTemplate_TemplateFolder");

                if (viewModelTemplate.TemplateFieldsList == null)
                {
                    viewModelTemplate.TemplateFieldsList = new List <TemplateFieldsViewModel>();
                }

                var templateDto = new ViewModelMapperHelper().TemplateDto(viewModelTemplate);
                templateDto.DataConnection = new DataConnectionRequest
                {
                    Site        = sharePointUrl,
                    Library     = templateFolder,
                    CurrentUser = IDBContext.Current.UserName,
                    IsVer       = false
                };

                response = _documentTemplateServices.SaveDocumentTemplateResponse(documentUpload, templateDto);
                return(Json(response));
            }
            catch (Exception e)
            {
                response.IsValid      = false;
                response.ErrorMessage = e.GetBaseException().Message;
                return(Json(response));
            }
        }
        public virtual JsonResult DelegationSave()
        {
            DelegationSaveResponse response;
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper
                                  .DeserializeObject <DelegationViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateDelegationViewModel(jsonDataRequest.ClientFieldData);

            viewModel.AssignSubDelegation.Attributes
            .AddRange(_delegationService
                      .GetAttributesEntitiesByOperationType(viewModel.AssignSubDelegation.OperationTypes
                                                            .Where(x => x.OperationTypeSelected)
                                                            .Select(x => x.OperationTypeName).ToList()));

            foreach (var attributeType in viewModel.AssignSubDelegation.Attributes)
            {
                var attributeTypeView =
                    jsonDataRequest.ClientFieldData.FirstOrDefault(o =>
                                                                   !string.IsNullOrWhiteSpace(o.Name) &&
                                                                   o.Name.Equals(attributeType.AttributeControlName));
                if (attributeTypeView != null)
                {
                    attributeType.AttributeSelected = Convert.ToBoolean(attributeTypeView.Value);
                }
            }

            var userName     = IDBContext.Current.UserLoginName;
            var errorMessage = viewModel.DelegationId != 0
                ? SynchronizationHelper.AccessToResources("edit",
                                                          OPUSGlobalValues.URL_DELEGATION,
                                                          viewModel.DelegationId.ToString(),
                                                          userName)
                : null;

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                response = new DelegationSaveResponse
                {
                    IsValid      = false,
                    ErrorMessage = errorMessage
                };
            }
            else
            {
                response = _delegationService.DelegatorSearchSave(viewModel);

                if (response.IsValid)
                {
                    SynchronizationHelper.TryReleaseLock(OPUSGlobalValues.URL_DELEGATION,
                                                         viewModel.DelegationId.ToString(),
                                                         userName);
                }
            }

            return(Json(response));
        }
Esempio n. 25
0
        public virtual JsonResult SaveIdentification(string operationNumber, int procurementId)
        {
            var identifier   = string.Format("{0}-proc-{1}", operationNumber, procurementId);
            var responseView = new SaveResponse()
            {
                IsValid = true
            };

            var errorMessage = SynchronizationHelper.AccessToResources(SynchronizationHelper.EDIT_MODE, SYNC_PROCUREMENT, identifier, IDBContext.Current.UserLoginName);

            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                responseView.IsValid      = false;
                responseView.ErrorMessage = errorMessage;
                return(Json(responseView));
            }

            bool isClose = Request.Params["isClose"] == "true";

            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var model           = PageSerializationHelper.DeserializeObject <IdentificationViewModel>(jsonDataRequest.SerializedData);

            model.UpdateIdentification(jsonDataRequest.ClientFieldData);

            var response = _firmProcurementService.SaveIdentificationData(procurementId, model, isClose);

            responseView.IsValid      = response.IsValid;
            responseView.ErrorMessage = response.ErrorMessage;

            if (response.IsValid)
            {
                if (isClose)
                {
                    //If we save properly and we are closing identification stage send a notification.
                    _firmProcurementService.SendNotificationCloseIdentification(procurementId);
                }

                _firmProcurementService.SendNotificationSaveCloseIdeNotification(procurementId, response.NewFundIds);
            }

            var tab = TAB_NAME_IDENTIFICATION;

            if (isClose)
            {
                tab = TAB_NAME_PREPARATION;
            }

            if (responseView.IsValid)
            {
                SynchronizationHelper.TryReleaseLock(SYNC_PROCUREMENT, identifier, IDBContext.Current.UserLoginName);
                var url = Url.Action("Read", "FirmProcurement", new { area = "Procurement", procurementId = procurementId, tabName = tab });
                responseView.UrlRedirect = url;
            }

            return(Json(responseView));
        }
Esempio n. 26
0
        public virtual JsonResult TemplateEditSave(int templateId)
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <TemplateViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateTemplateViewModel(jsonDataRequest.ClientFieldData);
            var response = _workspaceService.SaveTemplateEdit(viewModel);

            return(Json(response));
        }
Esempio n. 27
0
        public virtual JsonResult GeneralGuideLine()
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <PCRChecklistViewModel>(jsonDataRequest.SerializedData);

            viewModel.PCRGeneralViewModel.GeneralGuidelinesViewModel.UpdateGeneralGuidelinesViewModel(jsonDataRequest.ClientFieldData);
            var response = _pcrGuidelineService.SaveGeneralGuidelines(viewModel.PCRGeneralViewModel.GeneralGuidelinesViewModel);

            return(Json(response));
        }
Esempio n. 28
0
        public virtual JsonResult RolesSave(int roleId)
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       = PageSerializationHelper.DeserializeObject <List <ChartRowViewModel> >(jsonDataRequest.SerializedData);

            viewModel.UpdateChartRowViewModel(jsonDataRequest.ClientFieldData);
            var response = _workspaceService.SaveRolesChart(viewModel, roleId);

            return(Json(response));
        }
        public virtual JsonResult CreateNewRoleSave()
        {
            var jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var viewModel       =
                PageSerializationHelper.DeserializeObject <ControlInformationViewModel>(jsonDataRequest.SerializedData);

            viewModel.UpdateControlInformationViewModel(jsonDataRequest.ClientFieldData);
            var response = _rolesAndPermissionsService.ControlInformationEditSave(viewModel);

            return(Json(response));
        }
Esempio n. 30
0
        public virtual JsonResult VERUpdateTask(string operationNumber)
        {
            ResponseBase response        = new ResponseBase();
            var          jsonDataRequest = PageSerializationHelper.DeserializeJsonForm(Request.Form[0]);
            var          viewModel       = PageSerializationHelper.DeserializeObject <TaskViewModel>(jsonDataRequest.SerializedData);

            try
            {
                viewModel.UpdateVerTaskViewModel(jsonDataRequest.ClientFieldData);
                var saveRequest = new SaveTaskRequest
                {
                    Model = viewModel
                };

                response = _verTaskService.SaveVerTask(saveRequest);

                var workFlow = jsonDataRequest.ClientFieldData.FirstOrDefault(o => o.Name.Equals("changeStatus"));

                var requestTask = new CompleteTaskRequest
                {
                    TaskId     = viewModel.TaskDataModel.TaskId,
                    InstanceId = viewModel.TaskDataModel.WorkflowInstanceId,
                    Status     = VerGlobalValues.COMPLETE_TASK,
                    Action     = VerGlobalValues.COMPLETE_ACTION_TASK
                };

                if (workFlow != null)
                {
                    switch (workFlow.Value)
                    {
                    case VerGlobalValues.COMPLETE_ACTION_TASK:
                        requestTask.Action = VerGlobalValues.COMPLETE_ACTION_TASK;
                        requestTask.Status = VerGlobalValues.COMPLETE_TASK;
                        break;

                    case VerGlobalValues.REJECT_ACTION_TASK:
                        requestTask.Action = VerGlobalValues.REJECT_ACTION_TASK;
                        requestTask.Status = VerGlobalValues.REJECT_TASK;
                        break;
                    }
                }

                _verTaskService.CompleteTask(requestTask);

                response.IsValid = true;
            }
            catch (Exception e)
            {
                response.IsValid      = false;
                response.ErrorMessage = e.ToString();
            }

            return(Json(response));
        }