internal bool Sync(Questionaire questionaire) { try { AnswerProvider answerProvider = new AnswerProvider(DbInfo); bool saved = SaveQuestionaire(questionaire); if (saved) { foreach (Section section in questionaire.Sections) { foreach (Question question in section.Questions) { answerProvider.Sync(questionaire, question); var dependencies = question.Dependencies.Where(d => !string.IsNullOrEmpty(d.Template)).ToList(); foreach (Dependency dependency in dependencies) { foreach (Question qn in dependency.Target.SubSection.Questions) { answerProvider.Sync(questionaire, qn); } } } foreach (SubSection subSection in section.SubSections) { foreach (Question question in subSection.Questions) { answerProvider.Sync(questionaire, question); } } } } return(saved); } catch (Exception ex) { return(false); } }
internal bool Sync(Certification certification) { try { AnswerProvider answerProvider = new AnswerProvider(DbInfo); bool saved = SaveCertification(certification); if (saved) { foreach (Section section in certification.Sections) { foreach (Question question in section.Questions) { answerProvider.Sync(certification, question); foreach (Dependency dependency in question.Dependencies) { foreach (Question qn in dependency.Target.SubSection.Questions) { answerProvider.Sync(certification, qn); } } } foreach (SubSection subSection in section.SubSections) { foreach (Question question in subSection.Questions) { answerProvider.Sync(certification, question); } } } } return(saved); } catch (Exception ex) { throw ex; } }