Esempio n. 1
0
        public List <ParameterToken> GetDefaultParametersForAssessment()
        {
            int assessmentId       = Auth.AssessmentForUser();
            RequirementsManager rm = new RequirementsManager(assessmentId);

            return(rm.GetDefaultParametersForAssessment());
        }
Esempio n. 2
0
        public ParameterToken SaveAnswerParameter([FromBody] ParameterToken token)
        {
            int assessmentId       = Auth.AssessmentForUser();
            RequirementsManager rm = new RequirementsManager(assessmentId);

            return(rm.SaveAnswerParameter(token.RequirementId, token.Id, token.AnswerId, token.Substitution));
        }
Esempio n. 3
0
        public int StoreAnswer([FromBody] Answer answer)
        {
            if (answer == null)
            {
                return(0);
            }

            int    assessmentId    = Auth.AssessmentForUser();
            string applicationMode = GetApplicationMode(assessmentId);

            if (answer.Is_Component)
            {
                QuestionsManager qm = new QuestionsManager(assessmentId);
                return(qm.StoreComponentAnswer(answer));
            }

            if (answer.Is_Requirement)
            {
                RequirementsManager rm = new RequirementsManager(assessmentId);
                return(rm.StoreAnswer(answer));
            }
            else
            {
                QuestionsManager qm = new QuestionsManager(assessmentId);
                return(qm.StoreAnswer(answer));
            }
        }
Esempio n. 4
0
        public int StoreAnswer([FromBody] Answer answer)
        {
            if (answer == null)
            {
                return(0);
            }

            if (String.IsNullOrWhiteSpace(answer.QuestionType))
            {
                if (answer.Is_Component)
                {
                    answer.QuestionType = "Component";
                }
                if (answer.Is_Maturity)
                {
                    answer.QuestionType = "Maturity";
                }
                if (answer.Is_Requirement)
                {
                    answer.QuestionType = "Requirement";
                }
                if (!answer.Is_Requirement && !answer.Is_Maturity && !answer.Is_Component)
                {
                    answer.QuestionType = "Question";
                }
            }

            int    assessmentId    = Auth.AssessmentForUser();
            string applicationMode = GetApplicationMode(assessmentId);

            if (answer.Is_Component)
            {
                QuestionsManager qm = new QuestionsManager(assessmentId);
                return(qm.StoreComponentAnswer(answer));
            }

            if (answer.Is_Requirement)
            {
                RequirementsManager rm = new RequirementsManager(assessmentId);
                return(rm.StoreAnswer(answer));
            }

            if (answer.Is_Maturity)
            {
                MaturityManager mm = new MaturityManager();
                return(mm.StoreAnswer(assessmentId, answer));
            }

            QuestionsManager qm2 = new QuestionsManager(assessmentId);

            return(qm2.StoreAnswer(answer));
        }
Esempio n. 5
0
        public List <usp_GetRankedQuestions_Result> GetRankedQuestions()
        {
            int assessmentId = Auth.AssessmentForUser();

            RequirementsManager rm = new RequirementsManager(assessmentId);

            using (CSET_Context context = new CSET_Context())
            {
                var rankedQuestionList = context.usp_GetRankedQuestions(assessmentId).ToList();

                foreach (usp_GetRankedQuestions_Result q in rankedQuestionList)
                {
                    q.QuestionText = rm.ResolveParameters(q.QuestionOrRequirementID, q.AnswerID, q.QuestionText);
                }

                return(rankedQuestionList);
            }
        }
Esempio n. 6
0
        public QuestionResponse GetList([FromBody] string group)
        {
            int    assessmentId    = Auth.AssessmentForUser();
            string applicationMode = GetApplicationMode(assessmentId);


            if (applicationMode.ToLower().StartsWith("questions"))
            {
                QuestionsManager qm   = new QuestionsManager(assessmentId);
                QuestionResponse resp = qm.GetQuestionList(group);
                return(resp);
            }
            else
            {
                RequirementsManager rm   = new RequirementsManager(assessmentId);
                QuestionResponse    resp = rm.GetRequirementsList();
                return(resp);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Returns questions/answers for current selected assessment
        /// </summary>
        /// <returns></returns>
        private List <AnalyticsQuestionAnswer> GetQuestionsAnswers()
        {
            int              assessmentId        = Auth.AssessmentForUser();
            var              questionsController = new QuestionsController();
            string           applicationMode     = questionsController.GetApplicationMode(assessmentId);
            QuestionsManager qm = new QuestionsManager(assessmentId);

            if (applicationMode.ToLower().StartsWith("questions"))
            {
                QuestionResponse resp = qm.GetQuestionListWithSet("*");
                return(qm.GetAnalyticQuestionAnswers(resp).OrderBy(x => x.QuestionId).ToList());
            }
            else
            {
                RequirementsManager rm   = new RequirementsManager(assessmentId);
                QuestionResponse    resp = rm.GetRequirementsList();
                return(qm.GetAnalyticQuestionAnswers(resp).OrderBy(x => x.QuestionId).ToList());
            }
        }
Esempio n. 8
0
        public int StoreAnswer([FromBody] Answer answer)
        {
            if (answer == null)
            {
                return(0);
            }

            int    assessmentId    = Auth.AssessmentForUser();
            string applicationMode = GetApplicationMode(assessmentId);

            if (applicationMode.ToLower().StartsWith("questions"))
            {
                QuestionsManager qm = new QuestionsManager(assessmentId);
                return(qm.StoreAnswer(answer));
            }
            else
            {
                RequirementsManager rm = new RequirementsManager(assessmentId);
                return(rm.StoreAnswer(answer));
            }
        }
Esempio n. 9
0
        private DataAccessHelper()
        {
            // load connection string
            var connectionString = NaoCoopApp.Properties.Settings.Default.NaoCoopDbConnectionString;

            // initialize managers
            RobotsManager               = new RobotsManager(connectionString);
            OperationsManager           = new OperationsManager(connectionString);
            OperationRobotsManager      = new OperationRobotsManager(connectionString);
            OperationRobotStatesManager = new OperationRobotStatesManager(connectionString);
            StatesManager               = new StatesManager(connectionString);
            StateTasksManager           = new StateTasksManager(connectionString);
            TasksManager                 = new TasksManager(connectionString);
            SettingsManager              = new SettingsManager(connectionString);
            RobotVersionsManager         = new RobotVersionsManager(connectionString);
            RequirementsManager          = new RequirementsManager(connectionString);
            OperationRequirementsManager = new OperationRequirementsManager(connectionString);
            ExecutionsManager            = new ExecutionsManager(connectionString);
            ExecutionRobotsManager       = new ExecutionRobotsManager(connectionString);
            UsersManager                 = new UsersManager(connectionString);
        }
Esempio n. 10
0
        public List <RankedQuestions> GetRankedQuestions()
        {
            using (var db = new CSET_Context())
            {
                RequirementsManager rm = new RequirementsManager(_assessmentId);

                List <RankedQuestions> list = new List <RankedQuestions>();
                List <usp_GetRankedQuestions_Result> rankedQuestionList = db.usp_GetRankedQuestions(_assessmentId).ToList();
                foreach (usp_GetRankedQuestions_Result q in rankedQuestionList)
                {
                    q.QuestionText = rm.ResolveParameters(q.QuestionOrRequirementID, q.AnswerID, q.QuestionText);

                    list.Add(new RankedQuestions()
                    {
                        Answer            = q.AnswerText,
                        CategoryAndNumber = q.Category + " #" + q.QuestionRef,
                        Level             = q.Level,
                        Question          = q.QuestionText,
                        Rank = q.Rank ?? 0
                    });
                }
                return(list);
            }
        }
Esempio n. 11
0
        public FeedbackDisplayContainer getFeedback()
        {
            int assessmentId                        = Auth.AssessmentForUser();
            RequirementsManager      rm             = new RequirementsManager(assessmentId);
            FeedbackDisplayContainer FeedbackResult = new FeedbackDisplayContainer();

            string AssessmentMode = GetAssessmentMode(assessmentId);

            try
            {
                using (CSET_Context context = new CSET_Context())
                {
                    List <FeedbackQuestion> feedbackQuestions = new List <FeedbackQuestion>();

                    // standard questions
                    var q1 = from a in context.Answer_Standards_InScope
                             where a.assessment_id == assessmentId &&
                             a.mode == AssessmentMode && a.Feedback != null
                             select new FeedbackQuestion()
                    {
                        AnswerID     = a.answer_id,
                        Feedback     = a.Feedback,
                        Mode         = a.mode,
                        QuestionID   = a.question_or_requirement_id,
                        QuestionText = a.Question_Text
                    };

                    feedbackQuestions.AddRange(q1);

                    // maturity questions
                    var q2 = from a in context.Answer_Maturity
                             where a.Assessment_Id == assessmentId &&
                             a.FeedBack != null
                             select new FeedbackQuestion()
                    {
                        AnswerID     = a.Answer_Id,
                        Feedback     = a.FeedBack,
                        Mode         = null,
                        QuestionID   = a.Question_Or_Requirement_Id,
                        QuestionText = a.Question_Text
                    };

                    feedbackQuestions.AddRange(q2);


                    string FeedbackSalutations = "Dear CSET Standards Administrator:";
                    string FeedbackDescription = "The following comments were provided for each of the questions: ";
                    string FeedbackWarning     = " *** Required *** Keep This Question ID ***";

                    bool FaaMail = context.AVAILABLE_STANDARDS.Where(x => x.Assessment_Id == assessmentId && x.Selected == true &&
                                                                     (x.Set_Name == "FAA_MAINT" || x.Set_Name == "FAA")).FirstOrDefault() != null;
                    FeedbackResult.FeedbackHeader = "Submit Feedback to DHS";
                    if (FaaMail)
                    {
                        FeedbackResult.FeedbackHeader += " and FAA";
                    }

                    string FaaEmail = "*****@*****.**";
                    string DHSEmail = "*****@*****.**";
                    if (FaaMail)
                    {
                        FeedbackResult.FeedbackEmailTo = FaaEmail + ";  ";
                    }
                    FeedbackResult.FeedbackEmailTo += DHSEmail;

                    FeedbackResult.FeedbackBody  = "Please email to: <br/><br/>";
                    FeedbackResult.FeedbackBody += FeedbackResult.FeedbackEmailTo + "<br/><br/><br/>";

                    FeedbackResult.FeedbackBody += FeedbackSalutations + "<br/><br/>";
                    FeedbackResult.FeedbackBody += FeedbackDescription + "<br/><br/>";

                    foreach (FeedbackQuestion q in feedbackQuestions)
                    {
                        q.QuestionText = rm.ResolveParameters(q.QuestionID, q.AnswerID, q.QuestionText);
                        q.Feedback     = rm.ResolveParameters(q.QuestionID, q.AnswerID, q.Feedback);
                        FeedbackResult.FeedbackBody += "Users Feedback: <br/>" + q.Feedback + "<br/><br/>";
                        FeedbackResult.FeedbackBody += q.QuestionText + "<br/><br/>";
                        FeedbackResult.FeedbackBody += FeedbackWarning + "<br/>";
                        FeedbackResult.FeedbackBody += "Question #" + " " + q.Mode + ":" + q.QuestionID + ". <br/><br/><br/>";
                    }

                    FeedbackResult.FeedbackEmailSubject = "CSET Questions Feedback";
                    FeedbackResult.FeedbackEmailBody   += FeedbackSalutations + "%0D%0A%0D%0A";
                    FeedbackResult.FeedbackEmailBody   += FeedbackDescription + "%0D%0A%0D%0A";

                    foreach (FeedbackQuestion q in feedbackQuestions)
                    {
                        q.QuestionText = rm.RichTextParameters(q.QuestionID, q.AnswerID, q.QuestionText);
                        q.Feedback     = rm.RichTextParameters(q.QuestionID, q.AnswerID, q.Feedback);
                        FeedbackResult.FeedbackEmailBody += "Users Feedback: %0D%0A" + q.Feedback + "%0D%0A";
                        FeedbackResult.FeedbackEmailBody += q.QuestionText + "%0D%0A%0D%0A";
                        FeedbackResult.FeedbackEmailBody += FeedbackWarning + "%0D%0A";
                        FeedbackResult.FeedbackEmailBody += "Question #" + " " + q.Mode + ":" + q.QuestionID + ". %0D%0A%0D%0A%0D%0A";
                    }

                    if (feedbackQuestions.Count() == 0)
                    {
                        FeedbackResult.FeedbackBody = "No feedback given for any questions in this assessment";
                    }

                    return(FeedbackResult);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }