public QuestionsSelectionModel(string Subject) { subjects = SubjectModel.GetSubject(null, new List <string> { " name = '" + Subject + "'" }); outcomesList = OutcomeModel.GetOutcome(null, new List <string> { "SubjectID = " + subjects[0].SubjectId }); outcomeDetailsList = OutcomeDetailsModel.GetOutcomeDetails(null, null); foreach (OutcomeModel item in outcomesList) { foreach (OutcomeDetailsModel item2 in outcomeDetailsList) { if (item.OutcomeId == item2.OutcomeId) { outcomeDetailsListRelavent.Add(item2); } } } questionTypesList = QuestionTypeModel.GetQuestionType(null, null); questionsList = question.GetQuestion(null, null); foreach (QuestionModel item in questionsList) { foreach (OutcomeDetailsModel item2 in outcomeDetailsListRelavent) { if (item.OutcomeDetailsId == item2.OutcomeDetailsId) { questionListRelavent.Add(item); } } } }
private List <string> ConvertToColumnValues(OutcomeModel o) { List <string> colValues = new List <string>(); try { colValues.Add(o.SubjectId.ToString()); colValues.Add("'" + o.OutcomeName + "'"); } catch (Exception) { throw; } return(colValues); }
private static OutcomeModel ConvertToOutcome(Dictionary <string, string> fieldValues) { OutcomeModel o = new OutcomeModel(); foreach (KeyValuePair <string, string> row in fieldValues) { switch (row.Key) { case "id": try { o.OutcomeId = int.Parse(row.Value); } catch (Exception) { throw; } break; case "SubjectID": try { o.SubjectId = int.Parse(row.Value); } catch (Exception) { throw; } break; case "name": o.OutcomeName = row.Value; break; default: break; } } return(o); }