Ejemplo n.º 1
0
        public void PersistSelectedIRP(int assessmentId, IRPModel irp)
        {
            if (assessmentId == 0)
            {
                return;
            }
            if (irp == null)
            {
                return;
            }

            using (var db = new CSET_Context())
            {
                ASSESSMENT_IRP answer = db.ASSESSMENT_IRP.FirstOrDefault(i => i.IRP_Id == irp.IRP_Id &&
                                                                         i.Assessment_.Assessment_Id == assessmentId);
                if (answer != null)
                {
                    answer.Response = irp.Response;
                    answer.Comment  = irp.Comment;
                }
                else
                {
                    answer = new ASSESSMENT_IRP()
                    {
                        Response = irp.Response,
                        Comment  = irp.Comment,
                    };
                    answer.Assessment_ = db.ASSESSMENTS.FirstOrDefault(a => a.Assessment_Id == assessmentId);
                    db.ASSESSMENT_IRP.Add(answer);
                }
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public IRPResponse GetIRPList(int assessmentId)
        {
            IRPResponse response = new IRPResponse();

            using (var db = new CSET_Context())
            {
                foreach (IRP_HEADER header in db.IRP_HEADER)
                {
                    IRPHeader tempHeader = new IRPHeader()
                    {
                        header = header.Header
                    };

                    foreach (IRP irp in db.IRP.Where(x => x.Header_Id == header.IRP_Header_Id).ToList())
                    {
                        IRPModel tempIRP = new IRPModel()
                        {
                            IRP_Id              = irp.IRP_ID,
                            Item_Number         = irp.Item_Number ?? 0,
                            Description         = irp.Description,
                            DescriptionComment  = irp.DescriptionComment,
                            Risk_1_Description  = irp.Risk_1_Description,
                            Risk_2_Description  = irp.Risk_2_Description,
                            Risk_3_Description  = irp.Risk_3_Description,
                            Risk_4_Description  = irp.Risk_4_Description,
                            Risk_5_Description  = irp.Risk_5_Description,
                            Validation_Approach = irp.Validation_Approach
                        };

                        // Get the existing answer or create a blank
                        ASSESSMENT_IRP answer = db.ASSESSMENT_IRP.FirstOrDefault(ans =>
                                                                                 ans.IRP_Id == irp.IRP_ID &&
                                                                                 ans.Assessment_.Assessment_Id == assessmentId);
                        if (answer == null)
                        {
                            answer = new ASSESSMENT_IRP()
                            {
                                Assessment_Id = assessmentId,
                                IRP_Id        = irp.IRP_ID,
                                Response      = 0,
                                Comment       = ""
                            };

                            db.ASSESSMENT_IRP.Add(answer);
                        }
                        tempIRP.Response = answer.Response.Value;
                        tempIRP.Comment  = answer.Comment;
                        tempHeader.irpList.Add(tempIRP);
                    }

                    response.headerList.Add(tempHeader);
                }
                db.SaveChanges();
            }

            return(response);
        }
Ejemplo n.º 3
0
        public void PersistSelectedIRP(IRPModel reqIRP)
        {
            // In case nothing is sent, bail out gracefully
            if (reqIRP == null)
            {
                return;
            }

            int assessmentId = Auth.AssessmentForUser();

            new IRPManager().PersistSelectedIRP(assessmentId, reqIRP);
        }
Ejemplo n.º 4
0
        public void PersistSelectedIRP(IRPModel reqIRP)
        {
            // In case nothing is sent, bail out gracefully
            if (reqIRP == null)
            {
                return;
            }

            int assessmentId = Auth.AssessmentForUser();

            new IRPManager().PersistSelectedIRP(assessmentId, reqIRP);

            // reset maturity filters because the risk profile has changed
            new ACETFilterController().ResetAllAcetFilters();
        }