private void ValidateOlapReport(ReportsValidation.OlapReportsRow row)
        {
            if (row == null || row.IsReportXmlNull() || row.ReportXml == "")
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(row.ReportXml);

            // clear stats
            row.ObjectsInvalid    = 0;
            row.ObjectsInvalidNew = 0;
            row.InvalidDiff       = 0;

            // dimensions
            foreach (XmlElement el in doc.GetElementsByTagName("D"))
            {
                string un = el.GetAttribute("UN");
                un = ValidateOlapObject(SchemaObjectType.ObjectTypeDimension, un, row);
                el.SetAttribute("UN", un);
            }

            // hierarchies
            foreach (XmlElement el in doc.GetElementsByTagName("H"))
            {
                string un = el.GetAttribute("UN");
                un = ValidateOlapObject(SchemaObjectType.ObjectTypeHierarchy, un, row);
                el.SetAttribute("UN", un);
            }

            // levels
            foreach (XmlElement el in doc.GetElementsByTagName("L"))
            {
                string un = el.GetAttribute("UN");
                un = ValidateOlapObject(SchemaObjectType.ObjectTypeLevel, un, row);
                el.SetAttribute("UN", un);
            }

            // members
            foreach (XmlElement el in doc.GetElementsByTagName("M"))
            {
                string un   = el.GetAttribute("UN");
                string calc = el.GetAttribute("C");

                if (calc != "1")
                {
                    un = ValidateOlapObject(SchemaObjectType.ObjectTypeMember, un, row);
                    el.SetAttribute("UN", un);
                }
            }

            // save back
            row.ReportXml = doc.OuterXml;
        }
Esempio n. 2
0
        private void ConvertOlapReport(ReportsValidation.OlapReportsRow row)
        {
            if (row == null || row.IsReportXmlNull() || row.ReportXml == "")
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(row.ReportXml);

            // clear stats
            row.ObjectsInvalid    = 0;
            row.ObjectsInvalidNew = 0;
            row.InvalidDiff       = 0;

            // axes
            foreach (XmlElement axisEl in doc.GetElementsByTagName("A"))
            {
                int axisOrdinal = int.Parse(axisEl.GetAttribute("ORD"));

                // dimensions
                foreach (XmlElement el in axisEl.GetElementsByTagName("D"))
                {
                    string un = el.GetAttribute("UN");
                    un = ValidateOlapObject(SchemaObjectType.ObjectTypeDimension, un, row);
                    el.SetAttribute("UN", un);
                    row.ObjectsTotal++;
                }

                // hierarchies
                foreach (XmlElement el in axisEl.GetElementsByTagName("H"))
                {
                    string un = el.GetAttribute("UN");
                    un = ValidateOlapObject(SchemaObjectType.ObjectTypeHierarchy, un, row);
                    el.SetAttribute("UN", un);
                    row.ObjectsTotal++;
                }

                // levels
                foreach (XmlElement el in axisEl.GetElementsByTagName("L"))
                {
                    string un = el.GetAttribute("UN");
                    un = ValidateOlapObject(SchemaObjectType.ObjectTypeLevel, un, row);
                    el.SetAttribute("UN", un);
                    row.ObjectsTotal++;
                }

                // members
                foreach (XmlElement el in axisEl.GetElementsByTagName("M"))
                {
                    string un   = el.GetAttribute("UN");
                    string calc = el.GetAttribute("C");

                    if (calc != "1")
                    {
                        un = ValidateOlapObject(SchemaObjectType.ObjectTypeMember, un, row);
                        el.SetAttribute("UN", un);
                        row.ObjectsTotal++;
                    }
                }

                // calc members, cannot use enumerator because list of nodes is being changed inside
                XmlNodeList list = axisEl.GetElementsByTagName("M");
                for (int i = 0; i < list.Count; i++)
                {
                    XmlElement el = list[i] as XmlElement;
                    if (el == null)
                    {
                        continue;
                    }

                    // special conversion of [Time].[Monthly].[Year].&[XXXX].Children calculated member
                    bool converted = ConvertYearChildrenCalculatedMember(el);
                    if (converted)
                    {
                        row.ObjectsTotal++;
                    }
                }

                // order tuple members
                foreach (XmlElement el in axisEl.GetElementsByTagName("OTM"))
                {
                    string un = el.GetAttribute("UN");

                    un = ValidateOlapObject(SchemaObjectType.ObjectTypeMember, un, row);
                    el.SetAttribute("UN", un);
                    row.ObjectsTotal++;
                }
            }

            // save back
            row.ReportXml = doc.OuterXml;
        }