Example #1
0
        public SiteModel GetSite(
            bool siteOnly           = false,
            bool initSiteSettings   = false,
            bool setSiteIntegration = false)
        {
            SiteModel siteModel;

            if (ReferenceType == "Sites" && Forms.Exists("Ver"))
            {
                siteModel = new SiteModel();
                siteModel.Get(
                    where : Rds.SitesWhere()
                    .SiteId(ReferenceId)
                    .Ver(Forms.Int("Ver")),
                    tableType: Sqls.TableTypes.NormalAndHistory);
                siteModel.VerType = Forms.Bool("Latest")
                    ? Versions.VerTypes.Latest
                    : Versions.VerTypes.History;
            }
            else
            {
                siteModel = siteOnly
                    ? new SiteModel(ReferenceId)
                    : new SiteModel(ReferenceType == "Sites" ? ReferenceId : SiteId);
            }
            if (initSiteSettings)
            {
                siteModel.SiteSettings = SiteSettingsUtilities.Get(
                    siteModel, ReferenceId, setSiteIntegration: setSiteIntegration);
            }
            return(siteModel);
        }