private void GenerateAltIdentitiesXml(IDnaDataReader dataReader, XmlNode parentXml)
        {
            int postPassedCount = 0;
            int postFailedCount = 0;
            int postTotalCount = 0;
            int articlePassedCount = 0;
            int articleFailedCount = 0;
            int articleTotalCount = 0;

             // Add Result Data .
            while (dataReader.Read())
            {
                XmlNode memberXml = AddElementTag(parentXml,"MEMBERDETAILS");

                //AddUser XML
                XmlNode userXml = AddElementTag(memberXml, "USER");
                AddIntElement(userXml,"USERID", dataReader.GetInt32NullAsZero("userid"));
                AddTextTag(userXml, "USERNAME", dataReader.GetStringNullAsEmpty("username"));
                AddTextTag(userXml, "LOGINNAME", dataReader.GetStringNullAsEmpty("loginname"));
                AddTextTag(userXml, "EMAIL", dataReader.GetStringNullAsEmpty("email"));
                XmlNode statusXml = AddElementTag(userXml, "STATUS");
                AddAttribute(statusXml, "STATUSID", dataReader.GetInt32NullAsZero("prefstatus"));
                AddIntElement(userXml, "ACTIVE", Convert.ToInt32(dataReader.GetBoolean("active")));

                //Add Site XML.
                int siteId = dataReader.GetInt32NullAsZero("siteid");
                ISite site = InputContext.TheSiteList.GetSite(siteId);
                SiteXmlBuilder siteXmlBuilder = new SiteXmlBuilder(InputContext);
                XmlNode siteXML = siteXmlBuilder.GenerateXml(null, site);
                siteXML = ImportNode(siteXML);
                memberXml.AppendChild(siteXML);

                if (!dataReader.IsDBNull("datejoined"))
                {
                    AddDateXml(dataReader.GetDateTime("datejoined"), memberXml, "DATEJOINED");
                }
                
                //Add Stats XML
                AddIntElement(memberXml, "POSTPASSEDCOUNT", dataReader.GetInt32NullAsZero("postpassedcount"));
                AddIntElement(memberXml, "POSTFAILEDCOUNT", dataReader.GetInt32NullAsZero("postfailedcount"));
                AddIntElement(memberXml, "POSTTOTALCOUNT", dataReader.GetInt32NullAsZero("totalpostcount"));
                AddIntElement(memberXml, "ARTICLEPASSEDCOUNT", dataReader.GetInt32NullAsZero("articlepassedcount"));
                AddIntElement(memberXml, "ARTICLEFAILEDCOUNT", dataReader.GetInt32NullAsZero("articlefailedcount"));
                AddIntElement(memberXml, "ARTICLETOTALCOUNT", dataReader.GetInt32NullAsZero("totalarticlecount"));

                postPassedCount += dataReader.GetInt32NullAsZero("postpassedcount");
                postFailedCount += dataReader.GetInt32NullAsZero("postfailedcount");
                postTotalCount += dataReader.GetInt32NullAsZero("totalpostcount");
                articlePassedCount += dataReader.GetInt32NullAsZero("articlepassedcount");
                articleFailedCount += dataReader.GetInt32NullAsZero("articlefailedcount");
                articleTotalCount += dataReader.GetInt32NullAsZero("totalarticlecount");
            }

            //Add Member Details Summary XML
            XmlNode summaryXml = AddElementTag(parentXml, "SUMMARY");
            AddIntElement(summaryXml, "POSTPASSEDCOUNT", postPassedCount);
            AddIntElement(summaryXml, "POSTFAILEDCOUNT", postFailedCount);
            AddIntElement(summaryXml, "POSTTOTALCOUNT", postTotalCount);
            AddIntElement(summaryXml, "ARTICLEPASSEDCOUNT", articlePassedCount);
            AddIntElement(summaryXml,"ARTICLEFAILEDCOUNT",articleFailedCount);
            AddIntElement(summaryXml, "ARTICLETOTALCOUNT", articleTotalCount);
        }
Exemple #2
0
        /// <summary>
        /// Finalises the page by add required member variable XML to the page
        /// </summary>
        private void FinalisePage()
        {
            SiteXmlBuilder siteXml = new SiteXmlBuilder(this);
            Diagnostics.WriteToLog("FinalisePage", "Adding siteoption list for site " + CurrentSite.SiteID.ToString());

            XmlNode siteOptionList = siteXml.GetSiteOptionListForSiteXml(CurrentSite.SiteID, TheSiteList);
            siteXml.GenerateXml(siteOptionList, CurrentSite);
            InsertPageComponent(siteXml);

            // Add the domain tag to the page
            string domain = "bbc.co.uk";
            if (pageDomain == "com")
            {
                domain = "bbc.com";
            }
            _page.AddTextTag(_page.RootElement.FirstChild, "PAGEDOMAIN", domain);
        }
Exemple #3
0
        /// <summary>
        /// Used to process the current request.
        /// </summary>
        public override void ProcessRequest()
        {
            //Clean any existing XML.
            RootElement.RemoveAll();

            XmlNode summaryXML = AddElementTag(RootElement, "SITESUMMARY");

            if (InputContext.ViewingUser == null || !InputContext.ViewingUser.IsSuperUser)
            {
                AddErrorXml("Invalid Permissions", "Superuser permissions required", RootElement);
                return;
            }

            int siteId = InputContext.GetParamIntOrZero("siteid","SiteId");
            if (siteId > 0)
            {
                //Add XML for selected site.
                ISite site = InputContext.TheSiteList.GetSite(siteId);
                SiteXmlBuilder siteXmlBuilder = new SiteXmlBuilder(InputContext);
                XmlNode siteXML = siteXmlBuilder.GenerateXml(null, site);
                siteXML = ImportNode(siteXML);
                summaryXML.AppendChild(siteXML);
            }

            bool recalculateReport = InputContext.GetParamIntOrZero("recalculate", "Recalculate Report") == 1;

            //Require Dates to produce site summary report.
            if (InputContext.DoesParamExist("startdate", "Start Date") && InputContext.DoesParamExist("enddate", "End Date"))
            {
                DateTime startDate;
                DateTime endDate;
                try
                {
                    startDate = DateTime.Parse(InputContext.GetParamStringOrEmpty("startdate", "StartDate"));
                    endDate = DateTime.Parse(InputContext.GetParamStringOrEmpty("enddate", "EndDate"));
                }
                catch(FormatException fe)
                {
                    this.AddErrorXml("Bad Format",fe.Message,RootElement);
                    return;
                }

                DateRangeValidation dateValidate = new DateRangeValidation();
                DateRangeValidation.ValidationResult result = dateValidate.ValidateDateRange(startDate, endDate, 1, false, true);
                if (result != DateRangeValidation.ValidationResult.VALID)
                {
                    XmlElement errorXML = dateValidate.GetLastValidationResultAsXmlElement(RootElement.OwnerDocument);
                    RootElement.AppendChild(errorXML);
                    return;
                }

                AddDateXml(startDate, summaryXML, "STARTDATE");
                AddDateXml(endDate, summaryXML, "ENDDATE");

                GenerateStatsXML(summaryXML, siteId, startDate, endDate, recalculateReport);
            }
            SiteXmlBuilder siteXml = new SiteXmlBuilder(InputContext);
            siteXml.GenerateAllSitesXml(InputContext.TheSiteList);
            AddInside(RootElement, siteXml);
       
        }