Esempio n. 1
0
        protected void NagControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string msg;
                if (NagControl.SelectedValue == "T")
                {
                    DonationNagsControl.UpdateIsNaggingEnabled(true);
                    msg = "The Donation Nag Dialog has been ENABLED.";
                }
                else
                {
                    DonationNagsControl.UpdateIsNaggingEnabled(false);
                    msg = "The Donation Nag Dialog has been DISABLED.";
                }

                CommonCacheInvalidation.ScheduleInvalidateNagsAll();
                NagControlFeedback.AddInfo(msg);
                NagControlFeedback.AddInfo("It will take effect in 5 to 10 minutes.");
            }
            catch (Exception ex)
            {
                NagControlFeedback.AddError(
                    "The operation failed due to an unexpected error.");
                NagControlFeedback.HandleException(ex);
            }
        }
        //private static void InvalidateBallotAll()
        //{
        //  CacheBallotPages.TruncateTable();
        //}

        //private static void InvalidateBallotByDomainDesignCodeElectionKey(
        //  string domainDesignCode, string electionKey)
        //{
        //  CacheBallotPages.DeleteByDomainDesignCodeElectionKey(
        //    domainDesignCode, electionKey);
        //}

        //private static void InvalidateBallotByElectionKey(string electionKey)
        //{
        //  CacheBallotPages.DeleteByElectionKey(electionKey);
        //}

        //private static void InvalidateElectedAll()
        //{
        //  CacheElectedPages.TruncateTable();
        //}

        //private static void InvalidateElectedByStateCode(string stateCode)
        //{
        //  CacheElectedPages.DeleteByStateCode(stateCode);
        //}

        //private static void InvalidateElectionAll()
        //{
        //  CacheElectionPages.TruncateTable();
        //}

        //private static void InvalidateElectionByElectionKey(string electionKey)
        //{
        //  CacheElectionPages.DeleteByElectionKey(electionKey);
        //}

        //private static void InvalidateIntroAll()
        //{
        //  CacheIntroPages.TruncateTable();
        //}

        //private static void InvalidateIntroByPoliticianKey(string politicianKey)
        //{
        //  CacheIntroPages.DeleteByPoliticianKey(politicianKey);
        //}

        //private static void InvalidateIssueAll()
        //{
        //  CacheIssuePages.TruncateTable();
        //}

        //private static void InvalidateIssueByIssueKey(string issueKey)
        //{
        //  CacheIssuePages.DeleteByIssueKey(issueKey);
        //}

        //private static void InvalidateIssueByOfficeKey(string officeKey)
        //{
        //  CacheIssuePages.DeleteByOfficeKey(officeKey);
        //}

        //private static void InvalidateIssueByElectionKeyOfficeKey(
        //  string electionKey, string officeKey)
        //{
        //  CacheIssuePages.DeleteByElectionKeyOfficeKey(electionKey, officeKey);
        //}

        //private static void InvalidateIssueByOfficeKeyIssueKey(
        //  string officeKey, string issueKey)
        //{
        //  CacheIssuePages.DeleteByOfficeKeyIssueKey(officeKey, issueKey);
        //}

        //private static void InvalidateIssueByElectionKeyOfficeKeyIssueKey(
        //  string electionKey, string officeKey, string issueKey)
        //{
        //  CacheIssuePages.DeleteByElectionKeyOfficeKeyIssueKey(
        //    electionKey, officeKey, issueKey);
        //}

        //private static void InvalidateOfficialsAll()
        //{
        //  CacheOfficialsPages.TruncateTable();
        //}

        //private static void InvalidateOfficialsByStateCode(string stateCode)
        //{
        //  CacheOfficialsPages.DeleteByStateCode(stateCode);
        //}

        //private static void InvalidateOfficialsByStateCodeCountyCode(
        //  string stateCode, string countyCode)
        //{
        //  CacheOfficialsPages.DeleteByStateCodeCountyCode(stateCode, countyCode);
        //}

        //private static void InvalidateOfficialsByStateCodeCountyCodeLocalCode(
        //  string stateCode, string countyCode, string localCode)
        //{
        //  CacheOfficialsPages.DeleteByStateCodeCountyCodeLocalCode(
        //    stateCode, countyCode, localCode);
        //}

        private static void InvalidateNagsAll()
        {
            // copy the DonationNagsControl singleton from common to local
            DonationNagsControl.UpdateIsNaggingEnabled(
                DB.VoteCache.DonationNagsControl.GetIsNaggingEnabled(true));

            // copy the DonationNags table from common to local
            var table = DonationNags.GetAllData();

            DB.VoteCacheLocal.DonationNags.TruncateTable();
            foreach (var row in table)
            {
                DB.VoteCacheLocal.DonationNags.Insert(
                    messageNumber: row.MessageNumber, messageHeading: row.MessageHeading,
                    messageText: row.MessageText, nextMessageNumber: row.NextMessageNumber);
            }
        }