internal Tuple <bool, ProfileQuestion> AddImportQuestion(ProfileImportQuestion importQuestion) { ProfileCategory category; if (!dictionaryCategoriesBySubLabel.TryGetValue(importQuestion.CategorySubLabel, out category)) { category = new ProfileCategory(this); category.SubLabel = importQuestion.CategorySubLabel; category.Heading = importQuestion.Category; category.IsSelect = true; AddCategory(category); } if (!category.ContainsImportQuestion(importQuestion)) { ProfileQuestion question = new ProfileQuestion(category, RankingManger, importQuestion); category.AddQuestion(question); return(Tuple.Create(true, question)); } else { return(Tuple.Create <bool, ProfileQuestion>(false, null)); } }
internal bool ContainsImportQuestion(ProfileImportQuestion importQuestion) { if (ProfileQuestions.Where(x => x.Question == importQuestion.Question).FirstOrDefault() == null) { return(false); } else { return(true); } }
public ProfileQuestion(ProfileCategory category, RankingManager rankingManger, ProfileImportQuestion importQuestion) : this(category, rankingManger) { IsCustomQuestion = true; Weight = 10; CustomQuestionID = importQuestion.ID; CanEdit = true; CanDelete = true; CanSelect = true; IsReadOnly = false; Question = importQuestion.QuestionObj.Question; Comments = importQuestion.QuestionObj.Comments; References = importQuestion.QuestionObj.References; SupplementalInfo = importQuestion.QuestionObj.SupplementalInfo; IsSelect = true; if (category.DoesSubLabelNumberAlreadyExist(this, importQuestion.QuestionObj.SubLabelNumber)) { SubLabelNumber = category.GetNextSubLabelNumber(); } else { SubLabelNumber = importQuestion.QuestionObj.SubLabelNumber; } }