예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }