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);
            }
        }
Beispiel #2
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);
            }
        }