public Questionaire GetQuestionaire(int id) { string query = $"select * from dsto_questionaire where OID = {id}"; var table = DbInfo.ExecuteSelectQuery(query); if (table.Rows.Count > 0 && table.Rows.Count == 1) { DataRow row = table.Rows[0]; Questionaire questionaire = new Questionaire(null); InitQuestionaire(questionaire, row); var sectionProvider = new SectionProvider(DbInfo); return(questionaire); } return(null); }
public Questionaire GetQuestionaire(string guid) { string query = $"select * from dsto_questionaire where [guid] = '{guid}'"; var table = DbInfo.ExecuteSelectQuery(query); if (table.Rows.Count > 0 && table.Rows.Count == 1) { DataRow row = table.Rows[0]; Questionaire questionaire = new Questionaire(null); InitQuestionaire(questionaire, row); var sectionProvider = new SectionProvider(DbInfo); questionaire.Sections = sectionProvider.GetSections(questionaire.Key); return(questionaire); } return(null); }
public override bool Save(DCAnalyticsObject obj) { try { SectionProvider sectionProvider = new SectionProvider(DbInfo); Questionaire questionaire = obj as Questionaire; var saved = SaveQuestionaire(questionaire); if (saved) { if (questionaire.Status.Equals(Statuses.Template)) { foreach (var region in questionaire.Regions) { region.yref_questionaire = questionaire.Key; new RegionProvider(DbInfo).Save(region); } } foreach (Category category in questionaire.Categories) { category.QuestionaireId = questionaire.Key; new CategoryProvider(DbInfo).Save(category); } foreach (var section in questionaire.Sections) { section.QuestionaireKey = questionaire.Key; sectionProvider.Save(section); } return(true); } return(false); } catch { return(false); } }
public override bool Save(DCAnalyticsObject obj) { try { SectionProvider sectionProvider = new SectionProvider(DbInfo); Certification certification = obj as Certification; if (SaveCertification(certification)) { foreach (var section in certification.Sections) { section.CertificationKey = certification.Key; sectionProvider.Save(section); } return(true); } return(false); } catch (Exception ex) { return(false); } }