Esempio n. 1
0
        private void WriteRunningTotals(XmlTextWriter xml, ReportWriter.DataSource dataSource)
        {
            if (!string.IsNullOrWhiteSpace(dataSource.RunningTotalTextColumnIndex))
            {
                int index = Conversion.TryCastInteger(dataSource.RunningTotalTextColumnIndex);
                xml.WriteElementString("RunningTotalTextColumnIndex", index.ToString());
            }

            if (!string.IsNullOrWhiteSpace(dataSource.RunningTotalFieldIndices))
            {
                xml.WriteElementString("RunningTotalFieldIndices", dataSource.RunningTotalFieldIndices);
            }
        }
Esempio n. 2
0
        private void WriteDataSource(XmlTextWriter xml, ReportWriter.DataSource dataSource)
        {
            xml.WriteStartElement("DataSource");
            xml.WriteElementString("Query", dataSource.Query);

            if (dataSource.Parameters.Any())
            {
                xml.WriteStartElement("Parameters");

                foreach (ReportWriter.ReportParameter parameter in dataSource.Parameters)
                {
                    this.WriteParameter(xml, parameter);
                }
                xml.WriteEndElement();
            }

            this.WriteRunningTotals(xml, dataSource);


            xml.WriteEndElement();
        }
Esempio n. 3
0
        private void ParseDataSources(XmlDocument xml)
        {
            Collection <ReportWriter.DataSource> dataSources = new Collection <ReportWriter.DataSource>();

            XmlNodeList dataSourceNodes = xml.SelectNodes("//DataSource");

            if (dataSourceNodes != null)
            {
                foreach (XmlNode dataSourceNode in dataSourceNodes)
                {
                    ReportWriter.DataSource dataSource = new ReportWriter.DataSource();

                    foreach (XmlNode node in dataSourceNode.ChildNodes)
                    {
                        if (node.Name.Equals("Query"))
                        {
                            dataSource.Query = node.InnerText;
                        }

                        if (node.Name.Equals("RunningTotalFieldIndices"))
                        {
                            dataSource.RunningTotalFieldIndices = node.InnerText;
                        }

                        if (node.Name.Equals("RunningTotalTextColumnIndex"))
                        {
                            dataSource.RunningTotalTextColumnIndex = node.InnerText;
                        }

                        if (node.Name.Equals("Parameters"))
                        {
                            Collection <ReportWriter.ReportParameter> parameters =
                                new Collection <ReportWriter.ReportParameter>();

                            foreach (XmlNode parameterNode in node.ChildNodes)
                            {
                                if (parameterNode.Name.Equals("Parameter"))
                                {
                                    ReportWriter.ReportParameter parameter = new ReportWriter.ReportParameter();

                                    if (parameterNode.Attributes != null)
                                    {
                                        if (parameterNode.Attributes["Name"] != null)
                                        {
                                            parameter.Name = parameterNode.Attributes["Name"].Value;
                                        }

                                        if (parameterNode.Attributes["Type"] != null)
                                        {
                                            parameter.Type = parameterNode.Attributes["Type"].Value;
                                        }

                                        if (parameterNode.Attributes["TestValue"] != null)
                                        {
                                            parameter.TestValue = parameterNode.Attributes["TestValue"].Value;
                                        }
                                    }

                                    parameters.Add(parameter);
                                }
                            }

                            dataSource.Parameters = parameters;
                        }
                    }
                    dataSources.Add(dataSource);
                }
            }

            this.Definition.DataSources = dataSources;
        }