protected override void PopulateData()
 {
     using (var session = Domain.OpenSession())
         using (var tx = session.OpenTransaction()) {
             var m1 = new Master1();
             var m2 = new Master2();
             new Master1.Slave1 {
                 Owner = m1
             };
             new Master2.Slave2 {
                 Owner = m2
             };
             tx.Complete();
         }
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _ElectionDescription = PageCache.Elections.GetElectionDesc(_ElectionKey);
            _OfficeDescription   = Offices.GetLocalizedOfficeName(_OfficeKey);

            if (Elections.GetElectionTypeFromKey(_ElectionKey) ==
                Elections.ElectionTypeUSPresidentialPrimary ||
                Elections.GetStateCodeFromKey(_ElectionKey) == "US" &&
                Elections.GetElectionTypeFromKey(_ElectionKey) == "G")
            {
                _ElectionAndOfficeDescription = _ElectionDescription;
                ElectionTitle.InnerText       = _ElectionDescription;
                OfficeTitle.Visible           = false;
            }
            else
            {
                _ElectionAndOfficeDescription = $"{_ElectionDescription}, {_OfficeDescription}";
                // Link removed per Mantis 840
                //new HtmlAnchor
                //{
                //  HRef = UrlManager.GetElectionPageUri(_ElectionKey).ToString(),
                //  InnerText = _ElectionDescription
                //}.AddTo(ElectionTitle);
                ElectionTitle.InnerText = _ElectionDescription;
                OfficeTitle.InnerText   =
                    $"Candidates for {Offices.GetLocalizedOfficeNameWithElectoralClass(PageCache, _OfficeKey)}";
            }

            PopulateMetaTags();
            if (Master2.FindControl("Body") is HtmlGenericControl body)
            {
                body.Attributes.Add("data-election",
                                    Elections.GetStateElectionKeyFromKey(QueryElection).ToUpperInvariant());
                body.Attributes.Add("data-adelection", _ElectionKey);
                body.Attributes.Add("data-adoffice", _OfficeKey);
            }

            CompareCandidatesReportResponsive.GetReport(_ElectionKey, _OfficeKey)
            .AddTo(ReportPlaceHolder);
        }