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); } }
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); } }
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; } }