Ejemplo n.º 1
0
        /// <summary>
        /// Returns the count of ColumnGroupings with subtotals
        /// </summary>
        /// <returns></returns>
        int CountColumnGroupingSubtotals()
        {
            XmlNode cGroupings = _Draw.GetNamedChildNode(_MatrixNode, "ColumnGroupings");

            if (cGroupings == null)
            {
                return(0);
            }

            // Get the number of column groups with subtotals
            int ci = 0;

            foreach (XmlNode c in cGroupings.ChildNodes)
            {
                if (c.Name != "ColumnGrouping")
                {
                    continue;
                }

                XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicColumns", "Subtotal");
                if (subtotal != null)
                {
                    ci++;
                }
            }
            return(ci);
        }
Ejemplo n.º 2
0
        static internal List <SqlSchemaInfo> GetSchemaInfo(DesignXmlDraw d, string ds)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            if (dsNode == null)
            {
                return(null);
            }

            string  dataProvider;
            string  connection;
            XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");

            if (dp == null)
            {
                return(null);
            }
            dataProvider = dp.InnerText;
            dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
            if (dp == null)
            {
                return(null);
            }
            connection = dp.InnerText;
            return(GetSchemaInfo(dataProvider, connection));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns the count of row grouping subtotals
        /// </summary>
        /// <returns></returns>
        int CountRowGroupingSubtotals()
        {
            XmlNode rGroupings = _Draw.GetNamedChildNode(_MatrixNode, "RowGroupings");

            if (rGroupings == null)
            {
                return(0);                      // 1 row
            }
            // Get the number of row groupings
            int ri = 0;

            foreach (XmlNode c in rGroupings.ChildNodes)
            {
                if (c.Name != "RowGrouping")
                {
                    continue;
                }
                XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicRows", "Subtotal");
                if (subtotal != null)
                {
                    ri++;
                }
            }
            return(ri);                 // row grouping subtotals
        }
        private string GetChartDataValue(int i)
        {
            XmlNode dvs = DesignXmlDraw.FindNextInHierarchy(_pt.Node,
                                                            "ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataValues");
            XmlNode cnode;

            foreach (XmlNode dv in dvs.ChildNodes)
            {
                if (dv.Name != "DataValue")
                {
                    continue;
                }
                i--;
                cnode = DesignXmlDraw.FindNextInHierarchy(dv, "Value");
                if (cnode == null)
                {
                    continue;
                }
                if (i <= 0)
                {
                    return(cnode.InnerText);
                }
            }
            return("");
        }
Ejemplo n.º 5
0
        static internal List <SqlColumn> GetSqlColumns(DesignXmlDraw d, string ds, string sql)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            if (dsNode == null)
            {
                return(null);
            }
            string  dataProvider;
            string  connection;
            XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");

            if (dp == null)
            {
                return(null);
            }
            dataProvider = dp.InnerText;
            dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
            if (dp == null)
            {
                return(null);
            }
            connection = dp.InnerText;
            IList parameters = null;

            return(GetSqlColumns(dataProvider, connection, sql, parameters));
        }
Ejemplo n.º 6
0
        internal string GetReportParameterDefaultValue(string parameterExpression)
        {
            var root = _doc.DocumentElement;

            XmlNode rNode   = _doc.LastChild;
            XmlNode rpsNode = DesignXmlDraw.FindNextInHierarchy(rNode, "ReportParameters");

            if (rpsNode == null)
            {
                return(null);
            }

            var parameterName = DesignerUtility.ExtractParameterNameFromParameterExpression(parameterExpression);

            var parameter = rpsNode.ChildNodes.Cast <XmlNode>()
                            .FirstOrDefault(n => n.Attributes["Name"].Value == parameterName);

            if (parameter == null)
            {
                //ERROR, parameter not found;
                return(null);
            }

            var defaultValue = parameter.ChildNodes.Cast <XmlNode>()
                               .FirstOrDefault(n => n.Name == "DefaultValue");

            if (defaultValue == null)
            {
                // ERROR, no default value;
                return(null);
            }

            // selecting DefaultValue/Values/Value
            return(defaultValue.FirstChild.FirstChild.InnerText);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns the count of static rows or 1
        /// </summary>
        /// <returns></returns>
        int CountMatrixRows()
        {
            XmlNode rGroupings = _Draw.GetNamedChildNode(_MatrixNode, "RowGroupings");

            if (rGroupings == null)
            {
                return(1);                      // 1 row
            }
            // Get the number of static columns
            foreach (XmlNode c in rGroupings.ChildNodes)
            {
                if (c.Name != "RowGrouping")
                {
                    continue;
                }
                XmlNode scol = DesignXmlDraw.FindNextInHierarchy(c, "StaticRows");
                if (scol == null)                       // must be dynamic column
                {
                    continue;
                }
                int ci = 0;
                foreach (XmlNode sc in scol.ChildNodes)
                {
                    if (sc.Name == "StaticRow")
                    {
                        ci++;
                    }
                }
                return(ci);             // only one StaticRows allowed in a row grouping
            }
            return(1);                  // 1 row
        }
Ejemplo n.º 8
0
        public void Apply()
        {
            XmlNode node = _ReportItems[0];
            XmlNode ncds = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");
            XmlNode ncdc = DesignXmlDraw.FindNextInHierarchy(node, "ChartData");
            XmlNode nTyp = DesignXmlDraw.FindNextInHierarchy(node, "Type");

            ncds.InnerText = "";
            ncdc.InnerText = "";

            foreach (SeriesItem si in lbDataSeries.Items)
            {
                //Write the staticMember fields
                ncds.InnerXml += "<StaticMember><Label>" + si.Name + "</Label><Value>" + si.Data.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value></StaticMember>";

                //Write the chartSeries fields
                //if we have a scatter plot we need to do two datavalues!
                if (nTyp.InnerXml.Equals("Scatter"))
                {
                    ncdc.InnerXml += "<ChartSeries><fyi:Color xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.Colour + "</fyi:Color><PlotType>" + si.PlotType + "</PlotType><fyi:NoMarker xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.NoMarker + "</fyi:NoMarker><fyi:LineSize xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.LineSize + "</fyi:LineSize><YAxis>" + si.YAxis +
                                     "</YAxis><DataPoints><DataPoint><DataValues><DataValue><Value>"
                                     + si.Xplot.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value></DataValue><DataValue><Value>" // 20022008 AJM GJL
                                     + si.Data.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value></DataValue></DataValues><DataLabel><Value>" + si.Label.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value><Visible>" + si.ShowLabel.ToString()
                                     + "</Visible></DataLabel></DataPoint></DataPoints></ChartSeries>";
                }
                else
                {
                    ncdc.InnerXml += "<ChartSeries><fyi:Color xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.Colour + "</fyi:Color><PlotType>" + si.PlotType + "</PlotType><fyi:NoMarker xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.NoMarker + "</fyi:NoMarker><fyi:LineSize xmlns:fyi=\"http://www.fyireporting.com/schemas\">" + si.LineSize + "</fyi:LineSize><YAxis>" + si.YAxis + "</YAxis><DataPoints><DataPoint><DataValues><DataValue><Value>" // 20022008 AJM GJL
                                     + si.Data.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value></DataValue></DataValues><DataLabel><Value>" + si.Label.Replace("<", "&lt;").Replace(">", "&gt;") + "</Value><Visible>" + si.ShowLabel.ToString()
                                     + "</Visible></DataLabel></DataPoint></DataPoints></ChartSeries>";
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// EBN 30/03/2014
        /// Get the modules defined in the report if any
        /// </summary>
        /// <param name="asExpression">When true names are returned as expressions.</param>
        /// <returns></returns>
        internal string[] GetReportClasses(bool asExpression)
        {
            XmlNode rNode   = _doc.LastChild;
            XmlNode rpsNode = DesignXmlDraw.FindNextInHierarchy(rNode, "Classes");

            if (rpsNode == null)
            {
                return(null);
            }
            StringCollection st = new StringCollection();

            foreach (XmlNode repNode in rpsNode)
            {
                string ClassName    = "";
                string InstanceName = "";

                if (repNode.Name != "Class")
                {
                    continue;
                }
                if (repNode.InnerText == "")    // shouldn't really happen
                {
                    continue;
                }
                foreach (XmlNode claNode in repNode)
                {
                    if (claNode.Name == "ClassName")
                    {
                        ClassName = claNode.InnerText;
                    }
                    if (claNode.Name == "InstanceName")
                    {
                        InstanceName = claNode.InnerText;
                    }
                }
                if (ClassName != "")
                {
                    if (asExpression)
                    {
                        st.Add(string.Format("=({0}){1}", ClassName, InstanceName));
                    }
                    else
                    {
                        st.Add(string.Format("{0}", ClassName));
                    }
                }
            }

            if (st.Count <= 0)
            {
                return(null);
            }

            string[] result = new string[st.Count];
            st.CopyTo(result, 0);

            return(result);
        }
Ejemplo n.º 10
0
        private void bLoad_Click(object sender, System.EventArgs e)
        {
            // Load the data from the SQL; we append the data to what already exists
            try
            {
                // Obtain the connection information
                XmlNode rNode  = _Draw.GetReportNode();
                XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources");
                if (dsNode == null)
                {
                    return;
                }
                XmlNode datasource = null;
                foreach (XmlNode dNode in dsNode)
                {
                    if (dNode.Name != "DataSource")
                    {
                        continue;
                    }
                    XmlAttribute nAttr = dNode.Attributes["Name"];
                    if (nAttr == null)                          // shouldn't really happen
                    {
                        continue;
                    }
                    if (nAttr.Value != _dsv.DataSourceName)
                    {
                        continue;
                    }
                    datasource = dNode;
                    break;
                }
                if (datasource == null)
                {
                    MessageBox.Show(string.Format("Datasource '{0}' not found.", _dsv.DataSourceName), "Load Failed");
                    return;
                }
                string dataSourceReference = _Draw.GetElementValue(datasource, "DataSourceReference", null);
                if (dataSourceReference != null)
                {                       // todo: should support datasourcereference here as well
                    MessageBox.Show(string.Format("Datasource '{0}' contains a DataSourceReference.   This is not currently supported.", _dsv.DataSourceName), "Load Failed");
                    return;
                }

                XmlNode cpNode     = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "ConnectString");
                string  connection = cpNode == null? "": cpNode.InnerText;

                XmlNode datap        = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "DataProvider");
                string  dataProvider = datap == null? "": datap.InnerText;

                // Populate the data table
                DesignerUtility.GetSqlData(dataProvider, connection, _dsv.CommandText, null, _DataTable);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Load Failed");
            }
        }
        static internal bool GetConnnectionInfo(DesignXmlDraw d, string ds, out string dataProvider, out string connection)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            dataProvider = null;
            connection   = null;
            if (dsNode == null)
            {
                return(false);
            }

            string dataSourceReference = d.GetElementValue(dsNode, "DataSourceReference", null);

            if (dataSourceReference != null)
            {
                //  This is not very pretty code since it is assuming the structure of the windows parenting.
                //    But there isn't any other way to get this information from here.
                Control  p  = d;
                MDIChild mc = null;
                while (p != null && !(p is RdlDesigner))
                {
                    if (p is MDIChild)
                    {
                        mc = (MDIChild)p;
                    }

                    p = p.Parent;
                }
                if (p == null || mc == null || mc.SourceFile == null)
                {
                    MessageBox.Show("Unable to locate DataSource Shared file.  Try saving report first");
                    return(false);
                }
                string filename = Path.GetDirectoryName(mc.SourceFile) + Path.DirectorySeparatorChar + dataSourceReference;
                if (!DesignerUtility.GetSharedConnectionInfo((DesignerForm)p, filename, out dataProvider, out connection))
                {
                    return(false);
                }
            }
            else
            {
                XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");
                if (dp == null)
                {
                    return(false);
                }
                dataProvider = dp.InnerText;
                dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
                if (dp == null)
                {
                    return(false);
                }
                connection = dp.InnerText;
            }
            return(true);
        }
Ejemplo n.º 12
0
        void FillMatrixCorner()
        {
            XmlNode corner = _Draw.GetNamedChildNode(_MatrixNode, "Corner");

            if (corner == null)
            {
                return;
            }

            XmlNode    ris = DesignXmlDraw.FindNextInHierarchy(corner, "ReportItems");
            MatrixItem mi  = new MatrixItem(ris);

            _MatrixView[0, 0] = mi;
        }
Ejemplo n.º 13
0
        float GetMatrixRowHeight(int count)
        {
            XmlNode mcs = DesignXmlDraw.FindNextInHierarchy(_MatrixNode, "MatrixRows");

            foreach (XmlNode c in mcs.ChildNodes)
            {
                if (c.Name != "MatrixRow")
                {
                    continue;
                }
                if (count == 0)
                {
                    return(_Draw.GetSize(c, "Height"));
                }
                count--;
            }
            return(0);
        }
Ejemplo n.º 14
0
        internal string[] GetReportParameters(bool asExpression)
        {
            XmlNode rNode   = _doc.LastChild;
            XmlNode rpsNode = DesignXmlDraw.FindNextInHierarchy(rNode, "ReportParameters");

            if (rpsNode == null)
            {
                return(null);
            }
            StringCollection st = new StringCollection();

            foreach (XmlNode repNode in rpsNode)
            {
                if (repNode.Name != "ReportParameter")
                {
                    continue;
                }
                XmlAttribute nAttr = repNode.Attributes["Name"];
                if (nAttr == null)                      // shouldn't really happen
                {
                    continue;
                }
                if (asExpression)
                {
                    st.Add(string.Format("=Parameters!{0}.Value", nAttr.Value));
                }
                else
                {
                    st.Add(nAttr.Value);
                }
            }

            if (st.Count <= 0)
            {
                return(null);
            }

            string[] result = new string[st.Count];
            st.CopyTo(result, 0);

            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// EBN 30/03/2014
        /// Get the modules defined in the report if any
        /// </summary>
        /// <param name="asExpression">When true names are returned as expressions.</param>
        /// <returns></returns>
        internal string[] GetReportModules(bool asExpression)
        {
            XmlNode rNode   = _doc.LastChild;
            XmlNode rpsNode = DesignXmlDraw.FindNextInHierarchy(rNode, "CodeModules");

            if (rpsNode == null)
            {
                return(null);
            }
            StringCollection st = new StringCollection();

            foreach (XmlNode repNode in rpsNode)
            {
                if (repNode.Name != "CodeModule")
                {
                    continue;
                }
                if (repNode.InnerText == "")    // shouldn't really happen
                {
                    continue;
                }
                if (asExpression)
                {
                    st.Add(string.Format("=Module!{0}", repNode.InnerText));
                }
                else
                {
                    st.Add(repNode.InnerText);
                }
            }

            if (st.Count <= 0)
            {
                return(null);
            }

            string[] result = new string[st.Count];
            st.CopyTo(result, 0);

            return(result);
        }
Ejemplo n.º 16
0
        internal XmlNode DataSourceName(string dsn)
        {
            XmlNode rNode = _doc.LastChild;
            XmlNode node  = DesignXmlDraw.FindNextInHierarchy(rNode, "DataSources");

            if (node == null)
            {
                return(null);
            }
            foreach (XmlNode cNode in node.ChildNodes)
            {
                if (cNode.Name != "DataSource")
                {
                    continue;
                }
                XmlAttribute xAttr = cNode.Attributes["Name"];
                if (xAttr != null && xAttr.Value == dsn)
                {
                    return(cNode);
                }
            }
            return(null);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Gets the fields within the requested dataset.  If dataset is null then the first
        /// dataset is used.
        /// </summary>
        /// <param name="dataSetName"></param>
        /// <param name="asExpression">When true names are returned as expressions.</param>
        /// <returns></returns>
        internal string[] GetFields(string dataSetName, bool asExpression)
        {
            XmlNode nodes = DesignXmlDraw.FindNextInHierarchy(_doc.LastChild, "DataSets");

            if (nodes == null || !nodes.HasChildNodes)
            {
                return(null);
            }

            // Find the right dataset
            XmlNode dataSet = null;

            foreach (XmlNode ds in nodes.ChildNodes)
            {
                if (ds.Name != "DataSet")
                {
                    continue;
                }
                XmlAttribute xAttr = ds.Attributes["Name"];
                if (xAttr == null)
                {
                    continue;
                }
                if (xAttr.Value == dataSetName ||
                    dataSetName == null || dataSetName == "")
                {
                    dataSet = ds;
                    break;
                }
            }
            if (dataSet == null)
            {
                return(null);
            }

            // Find the fields
            XmlNode fields = DesignXmlDraw.FindNextInHierarchy(dataSet, "Fields");

            if (fields == null || !fields.HasChildNodes)
            {
                return(null);
            }
            StringCollection st = new StringCollection();

            foreach (XmlNode f in fields.ChildNodes)
            {
                XmlAttribute xAttr = f.Attributes["Name"];
                if (xAttr == null)
                {
                    continue;
                }
                if (asExpression)
                {
                    st.Add(string.Format("=Fields!{0}.Value", xAttr.Value));
                }
                else
                {
                    st.Add(xAttr.Value);
                }
            }
            if (st.Count <= 0)
            {
                return(null);
            }

            string[] result = new string[st.Count];
            st.CopyTo(result, 0);

            return(result);
        }
Ejemplo n.º 18
0
        private void BuildNamesLoop(XmlNode xNode)
        {
            if (xNode == null)
            {
                return;
            }
            foreach (XmlNode cNode in xNode)
            {
                // this is not a complete list of object names. It doesn't
                //  need to be complete but can be optimized so subobjects aren't
                //  pursued unnecessarily.  However, all reportitems and
                //  grouping must be traversed to get at all the names.
                // List should be built in paint order so
                //  that list of nodes is in correct tab order.
                switch (cNode.Name)
                {
                case "Report":
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "PageHeader", "ReportItems"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Body", "ReportItems"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "PageFooter", "ReportItems"));
                    break;

                // have a name but no subobjects
                case "Textbox":
                case "Image":
                case "Line":
                case "Subreport":
                case "CustomReportItem":
                    this.AddNode(cNode);
                    break;

                case "Chart":
                    this.AddNode(cNode);
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "SeriesGroupings"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "CategoryGroupings"));
                    break;

                // named object having subobjects
                case "Table":
                    this.AddNode(cNode);
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Header", "TableRows"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "TableGroups"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Details"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Footer", "TableRows"));
                    break;

                case "fyi:Grid":
                case "Grid":
                    this.AddNode(cNode);
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Header", "TableRows"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Details"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Footer", "TableRows"));
                    break;

                case "List":
                    this.AddNode(cNode);
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "Grouping"));
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "ReportItems"));
                    break;

                case "Rectangle":
                    this.AddNode(cNode);
                    BuildNamesLoop(DesignXmlDraw.FindNextInHierarchy(cNode, "ReportItems"));
                    break;

                case "Matrix":
                    this.AddNode(cNode);
                    BuildNamesLoop(cNode);
                    break;

                // don't have a name and don't have named subobjects with names
                case "Style":
                case "Filters":
                    break;

                case "Grouping":
                    XmlAttribute xAttr = cNode.Attributes["Name"];
                    if (xAttr == null || _Groupings.ContainsKey(xAttr.Value))
                    {
                        this.GenerateGroupingName(cNode);
                    }
                    else
                    {
                        _Groupings.Add(xAttr.Value, cNode);
                    }
                    break;

                // don't have a name but could have subobjects with names
                default:
                    BuildNamesLoop(cNode);                                      // recursively go thru entire report
                    break;
                }
            }
            return;
        }
Ejemplo n.º 19
0
        private void InitValues()
        {
            //// cbDataSource
            cbDataSource.Items.AddRange(_Draw.DataSourceNames);

            //
            // Obtain the existing DataSet info
            //
            XmlNode      dNode = this._dsNode;
            XmlAttribute nAttr = dNode.Attributes["Name"];

            _dsv      = new DataSetValues(nAttr == null ? "" : nAttr.Value);
            _dsv.Node = dNode;

            XmlNode ctNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "CommandText");

            _dsv.CommandText = ctNode == null ? "" : ctNode.InnerText;

            XmlNode datasource = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "DataSourceName");

            _dsv.DataSourceName = datasource == null ? "" : datasource.InnerText;

            XmlNode timeout = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "Timeout");

            try
            {
                _dsv.Timeout = timeout == null ? 0 : Convert.ToInt32(timeout.InnerText);
            }
            catch               // we don't stop just because timeout isn't convertable
            {
                _dsv.Timeout = 0;
            }

            // Get QueryParameters; they are loaded here but used by the QueryParametersCtl
            _dsv.QueryParameters = new DataTable();
            _dsv.QueryParameters.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.QueryParameters.Columns.Add(new DataColumn("Value", typeof(string)));
            XmlNode qpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "QueryParameters");

            if (qpNode != null)
            {
                string[] rowValues = new string[2];
                foreach (XmlNode qNode in qpNode.ChildNodes)
                {
                    if (qNode.Name != "QueryParameter")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = qNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(qNode, "Value", "");
                    _dsv.QueryParameters.Rows.Add(rowValues);
                }
            }

            // Get Fields
            _dsv.Fields = new DataTable();
            _dsv.Fields.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("QueryName", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("Value", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("TypeName", typeof(string)));

            XmlNode fsNode = _Draw.GetNamedChildNode(dNode, "Fields");

            if (fsNode != null)
            {
                string[] rowValues = new string[4];
                foreach (XmlNode fNode in fsNode.ChildNodes)
                {
                    if (fNode.Name != "Field")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = fNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(fNode, "DataField", "");
                    rowValues[2] = _Draw.GetElementValue(fNode, "Value", "");
                    string typename = null;
                    typename = _Draw.GetElementValue(fNode, "TypeName", null);
                    if (typename == null)
                    {
                        typename = _Draw.GetElementValue(fNode, "rd:TypeName", null);
                        if (typename != null)
                        {
                            _UseTypenameQualified = true;       // we got it qualified so we'll generate qualified
                        }
                    }
                    if (typename != null && !dgtbTypeName.Items.Contains(typename))
                    {
                        dgtbTypeName.Items.Add(typename);
                    }
                    rowValues[3] = typename == null ? "" : typename;

                    _dsv.Fields.Rows.Add(rowValues);
                }
            }
            this.tbDSName.Text     = _dsv.Name;
            this.tbSQL.Text        = _dsv.CommandText.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
            this.cbDataSource.Text = _dsv.DataSourceName;
            dgFields.DataSource    = _dsv.Fields;
        }
Ejemplo n.º 20
0
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];
            XmlNode nTyp = DesignXmlDraw.FindNextInHierarchy(node, "Type");
            XmlNode ncds = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");

            ShowMe = ncds != null;

            txtX.Enabled = btnX.Enabled = nTyp.InnerXml == "Scatter";

            if (ShowMe)
            {
                XmlNode cd;

                XmlNode cdo = DesignXmlDraw.FindNextInHierarchy(node, "ChartData");
                int     i   = 0;

                foreach (XmlNode ncd in ncds.ChildNodes)
                {
                    cd = cdo.ChildNodes[i];
                    XmlNode ndv       = DesignXmlDraw.FindNextInHierarchy(ncd, "Label");
                    String  nameValue = ndv == null? "": ndv.InnerText;

                    XmlNode ndv2            = DesignXmlDraw.FindNextInHierarchy(ncd, "Value");
                    String  nameStaticValue = ndv2 == null ? "" : ndv2.InnerText;

                    //GJL 18092008
                    XmlNode cl = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:Color");
                    if (cl == null)
                    {
                        cl = DesignXmlDraw.FindNextInHierarchy(cd, "Colour");
                    }
                    String Colour;
                    if (cl == null)
                    {
                        Colour = "";
                    }
                    else
                    {
                        Colour = cl.InnerText;
                    }

                    XmlNode pt = DesignXmlDraw.FindNextInHierarchy(cd, "PlotType");
                    String  PlotValue;
                    if (pt == null)
                    {
                        PlotValue = "";
                    }
                    else
                    {
                        PlotValue = pt.InnerText;
                    }
                    //GJL 14082008
                    XmlNode Nm = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:NoMarker");
                    if (Nm == null)
                    {
                        Nm = DesignXmlDraw.FindNextInHierarchy(cd, "NoMarker");
                    }
                    bool NoMarker;
                    if (Nm == null)
                    {
                        NoMarker = false;
                    }
                    else
                    {
                        NoMarker = Boolean.Parse(Nm.InnerText);
                    }

                    XmlNode Ls = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:LineSize");
                    if (Ls == null)
                    {
                        Ls = DesignXmlDraw.FindNextInHierarchy(cd, "LineSize");
                    }
                    String LineSize;
                    if (Ls == null)
                    {
                        LineSize = "Regular";
                    }
                    else
                    {
                        LineSize = Ls.InnerText;
                    }

                    // 20022008 AJM GJL
                    XmlNode ya = DesignXmlDraw.FindNextInHierarchy(cd, "YAxis");
                    String  Yaxis;
                    if (ya == null)
                    {
                        Yaxis = "Left";
                    }
                    else
                    {
                        Yaxis = ya.InnerText;
                    }

                    XmlNode dv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataValues", "DataValue", "Value");
                    String  dataValue = dv.InnerText;

                    XmlNode lv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Visible");
                    bool    showLabel = false;
                    if (lv != null)
                    {
                        showLabel = lv.InnerText.ToUpper().Equals("TRUE");
                    }

                    XmlNode lva        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Value");
                    String  labelValue = "";
                    if (lva != null)
                    {
                        labelValue = lva.InnerText;
                    }

                    SeriesItem si = new SeriesItem();
                    si.Name      = nameValue;
                    si.Label     = labelValue;
                    si.ShowLabel = showLabel;
                    si.Data      = nameStaticValue;
                    si.PlotType  = PlotValue;
                    si.YAxis     = Yaxis;     // 20022008 AJM GJL
                    si.Xplot     = dataValue; //Only for XY plots
                    si.NoMarker  = NoMarker;  //0206208 GJL
                    si.LineSize  = LineSize;
                    si.Colour    = Colour;


                    lbDataSeries.Items.Add(si);

                    i++;
                }
            }
        }
Ejemplo n.º 21
0
        private void InitValues()
        {
            // Populate the DataProviders
            cbDataProvider.Items.Clear();
            string[] items = RdlEngineConfig.GetProviders();
            cbDataProvider.Items.AddRange(items);

            //
            // Obtain the existing DataSets info
            //
            XmlNode rNode  = _Draw.GetReportNode();
            XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources");

            if (dsNode == null)
            {
                return;
            }
            foreach (XmlNode dNode in dsNode)
            {
                if (dNode.Name != "DataSource")
                {
                    continue;
                }
                XmlAttribute nAttr = dNode.Attributes["Name"];
                if (nAttr == null)      // shouldn't really happen
                {
                    continue;
                }

                DataSourceValues dsv = new DataSourceValues(nAttr.Value);
                dsv.Node = dNode;

                dsv.DataSourceReference = _Draw.GetElementValue(dNode, "DataSourceReference", null);
                if (dsv.DataSourceReference == null)
                {       // this is not a data source reference
                    dsv.bDataSourceReference = false;
                    dsv.DataSourceReference  = "";

                    XmlNode cpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "ConnectString");
                    dsv.ConnectionString = cpNode == null ? "" : cpNode.InnerText;

                    XmlNode datap = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "DataProvider");
                    dsv.DataProvider = datap == null ? "" : datap.InnerText;

                    XmlNode p = DesignXmlDraw.FindNextInHierarchy(dNode, "ConnectionProperties", "Prompt");
                    dsv.Prompt = p == null ? "" : p.InnerText;
                }
                else
                {       // we have a data source reference
                    dsv.bDataSourceReference = true;
                    dsv.ConnectionString     = "";
                    dsv.DataProvider         = "";
                    dsv.Prompt = "";
                }

                this.lbDataSources.Items.Add(dsv);
            }
            if (lbDataSources.Items.Count > 0)
            {
                lbDataSources.SelectedIndex = 0;
            }
            else
            {
                this.bOK.Enabled = false;
            }
        }
Ejemplo n.º 22
0
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];

            this.cbChartType.Text     = _Draw.GetElementValue(node, "Type", "Column");
            this.cbSubType.Text       = _Draw.GetElementValue(node, "Subtype", "Plain");
            this.cbPalette.Text       = _Draw.GetElementValue(node, "Palette", "Default");
            this.cbRenderElement.Text = _Draw.GetElementValue(node, "ChartElementOutput", "Output");
            this.tbPercentWidth.Text  = _Draw.GetElementValue(node, "PointWidth", "0");
            this.tbNoRows.Text        = _Draw.GetElementValue(node, "NoRows", "");
            // Handle the dataset for this dataregion
            object[] dsNames = _Draw.DataSetNames;
            string   defName = "";

            if (dsNames != null && dsNames.Length > 0)
            {
                this.cbDataSet.Items.AddRange(_Draw.DataSetNames);
                defName = (string)dsNames[0];
            }
            cbDataSet.Text = _Draw.GetDataSetNameValue(node);
            if (_Draw.GetReportItemDataRegionContainer(node) != null)
            {
                cbDataSet.Enabled = false;
            }
            // page breaks
            this.chkPageBreakStart.Checked = _Draw.GetElementValue(node, "PageBreakAtStart", "false").ToLower() == "true"? true: false;
            this.chkPageBreakEnd.Checked   = _Draw.GetElementValue(node, "PageBreakAtEnd", "false").ToLower() == "true"? true: false;

            // Chart data-- this is a simplification of what is possible (TODO)
            string cdata = "";
//        <ChartData>
//          <ChartSeries>
//            <DataPoints>
//              <DataPoint>
//                <DataValues>
//                  <DataValue>
//                    <Value>=Sum(Fields!Sales.Value)</Value>
//                  </DataValue>
//                </DataValues>
//                <DataLabel>
//                  <Style>
//                    <Format>c</Format>
//                  </Style>
//                </DataLabel>
//                <Marker />
//              </DataPoint>
//            </DataPoints>
//          </ChartSeries>
//        </ChartData>

            XmlNode cnode = DesignXmlDraw.FindNextInHierarchy(node,
                                                              "ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataValues", "DataValue", "Value");

            if (cnode != null)
            {
                cdata = cnode.InnerText;
            }
            this.cbChartData.Text = cdata;

            fChartType  = fSubtype = fPalette = fRenderElement = fPercentWidth =
                fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = false;
        }
Ejemplo n.º 23
0
        void FillMatrixCells()
        {
            // get a collection with the matrix cells
            int staticRows = this.CountMatrixRows();
            int staticCols = this.CountMatrixColumns();

            XmlNode[,] rc = new XmlNode[staticRows, staticCols];

            XmlNode mrows = DesignXmlDraw.FindNextInHierarchy(_MatrixNode, "MatrixRows");
            int     ri    = 0;

            foreach (XmlNode mrow in mrows.ChildNodes)
            {
                int     ci     = 0;
                XmlNode mcells = DesignXmlDraw.FindNextInHierarchy(mrow, "MatrixCells");
                foreach (XmlNode mcell in mcells.ChildNodes)
                {
                    // obtain the matrix cell
                    XmlNode repi = DesignXmlDraw.FindNextInHierarchy(mcell, "ReportItems");
                    rc[ri, ci] = repi;
                    ci++;
                }
                ri++;
            }
            // now fill out the rest of the matrix with empty entries
            MatrixItem mi;

            // Fill the middle (MatrixCells) with the contents of MatrixCells repeated
            for (int row = _HeaderRows; row < this.Rows; row++)
            {
                int rowcell    = staticRows == 0? 0: (row - _HeaderRows) % staticRows;
                int mcellCount = 0;
                for (int col = _HeaderColumns; col < this.Columns; col++)
                {
                    if (_MatrixView[row, col] == null)
                    {
                        float   width  = GetMatrixColumnWidth(mcellCount);
                        float   height = GetMatrixRowHeight(rowcell);
                        XmlNode n      = rc[rowcell, mcellCount++] as XmlNode;
                        if (mcellCount >= staticCols)
                        {
                            mcellCount = 0;
                        }
                        mi                    = new MatrixItem(n);
                        mi.Width              = width;
                        mi.Height             = height;
                        _MatrixView[row, col] = mi;
                    }
                }
            }

            // Make sure we have no null entries
            for (int row = 0; row < this.Rows; row++)
            {
                for (int col = 0; col < this.Columns; col++)
                {
                    if (_MatrixView[row, col] == null)
                    {
                        mi = new MatrixItem(null);
                        _MatrixView[row, col] = mi;
                    }
                }
            }
        }
Ejemplo n.º 24
0
        void FillMatrixColumnGroupings()
        {
            XmlNode cGroupings = _Draw.GetNamedChildNode(_MatrixNode, "ColumnGroupings");

            if (cGroupings == null)
            {
                return;
            }

            int        rows = 0;
            int        cols = this._HeaderColumns;
            MatrixItem mi;

            XmlNode ris;                                // work variable to hold reportitems
            int     staticCols = this.CountMatrixColumns();

            int subTotalCols = DesignXmlDraw.CountChildren(cGroupings, "ColumnGrouping", "DynamicColumns", "Subtotal");

            foreach (XmlNode c in cGroupings.ChildNodes)
            {
                if (c.Name != "ColumnGrouping")
                {
                    continue;
                }
                XmlNode scol = DesignXmlDraw.FindNextInHierarchy(c, "StaticColumns");
                if (scol != null)
                {                       // Static columns
                    int ci = 0;
                    foreach (XmlNode sc in scol.ChildNodes)
                    {
                        if (sc.Name != "StaticColumn")
                        {
                            continue;
                        }
                        ris       = DesignXmlDraw.FindNextInHierarchy(sc, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Height = _Draw.GetSize(c, "Height");
                        mi.Width  = GetMatrixColumnWidth(ci);
                        _MatrixView[rows, _HeaderColumns + ci] = mi;
                        ci++;
                    }
                }
                else
                {                       // Dynamic Columns
                    ris       = DesignXmlDraw.FindNextInHierarchy(c, "DynamicColumns", "ReportItems");
                    mi        = new MatrixItem(ris);
                    mi.Height = _Draw.GetSize(c, "Height");
                    mi.Width  = GetMatrixColumnWidth(0);
                    _MatrixView[rows, _HeaderColumns] = mi;

                    XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicColumns", "Subtotal");
                    if (subtotal != null)
                    {
                        ris       = DesignXmlDraw.FindNextInHierarchy(subtotal, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Height = _Draw.GetSize(c, "Height");
                        mi.Width  = GetMatrixColumnWidth(0);                                    // TODO this is wrong!! should be total of all static widths
                        _MatrixView[rows, _HeaderColumns + (staticCols - 1) + subTotalCols] = mi;
                        subTotalCols--;
                    }
                }
                rows++;                         // add a row per ColumnGrouping
            }
        }
Ejemplo n.º 25
0
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];

            string type = _Draw.GetElementValue(node, "Type", "Column");

            this.cbChartType.Text = type;
            type = type.ToLowerInvariant();

            lData2.Enabled = cbChartData2.Enabled = bDataExpr2.Enabled = (type == "scatter" || type == "bubble");
            lData3.Enabled = cbChartData3.Enabled = bDataExpr3.Enabled = (type == "bubble");
            //AJM GJL 14082008

            this.chkToolTip.Checked = _Draw.GetElementValue(node, "fyi:Tooltip", "false").ToLower() == "true" ? true : false;
            this.checkBox1.Checked  = _Draw.GetElementValue(node, "fyi:TooltipX", "false").ToLower() == "true" ? true : false;

            this.txtXToolFormat.Text = _Draw.GetElementValue(node, "fyi:TooltipXFormat", "");
            this.txtYToolFormat.Text = _Draw.GetElementValue(node, "fyi:TooltipYFormat", "");

            this.cbVector.Text        = _Draw.GetElementValue(node, "fyi:RenderAsVector", "False");
            this.cbSubType.Text       = _Draw.GetElementValue(node, "Subtype", "Plain");
            this.cbPalette.Text       = _Draw.GetElementValue(node, "Palette", "Default");
            this.cbRenderElement.Text = _Draw.GetElementValue(node, "ChartElementOutput", "Output");
            this.tbPercentWidth.Text  = _Draw.GetElementValue(node, "PointWidth", "0");
            this.tbNoRows.Text        = _Draw.GetElementValue(node, "NoRows", "");

            // Handle the dataset for this dataregion
            object[] dsNames = _Draw.DataSetNames;
            string   defName = "";

            if (dsNames != null && dsNames.Length > 0)
            {
                this.cbDataSet.Items.AddRange(_Draw.DataSetNames);
                defName = (string)dsNames[0];
            }
            cbDataSet.Text = _Draw.GetDataSetNameValue(node);
            if (_Draw.GetReportItemDataRegionContainer(node) != null)
            {
                cbDataSet.Enabled = false;
            }
            // page breaks
            this.chkPageBreakStart.Checked = _Draw.GetElementValue(node, "PageBreakAtStart", "false").ToLower() == "true"? true: false;
            this.chkPageBreakEnd.Checked   = _Draw.GetElementValue(node, "PageBreakAtEnd", "false").ToLower() == "true"? true: false;

            // Chart data-- this is a simplification of what is possible (TODO)
            string cdata  = string.Empty;
            string cdata2 = string.Empty;
            string cdata3 = string.Empty;
//        <ChartData>
//          <ChartSeries>
//            <DataPoints>
//              <DataPoint>
            //<DataValues>
            //      <DataValue>
            //        <Value>=Sum(Fields!Sales.Value)</Value>
            //      </DataValue>
            //      <DataValue>
            //        <Value>=Fields!Year.Value</Value>         ----- only scatter and bubble
            //      </DataValue>
            //      <DataValue>
            //        <Value>=Sum(Fields!Sales.Value)</Value>   ----- only bubble
            //      </DataValue>
            //    </DataValues>
//                <DataLabel>
//                  <Style>
//                    <Format>c</Format>
//                  </Style>
//                </DataLabel>
//                <Marker />
//              </DataPoint>
//            </DataPoints>
//          </ChartSeries>
//        </ChartData>


            //Determine if we have a static series or not... We are not allowing this to be changed here. That decision is taken when creating the chart. 05122007GJL
            XmlNode ss           = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");
            bool    StaticSeries = ss != null;

            XmlNode dvs = DesignXmlDraw.FindNextInHierarchy(node,
                                                            "ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataValues");
            int     iter = 0;
            XmlNode cnode;

            foreach (XmlNode dv in dvs.ChildNodes)
            {
                if (dv.Name != "DataValue")
                {
                    continue;
                }
                iter++;
                cnode = DesignXmlDraw.FindNextInHierarchy(dv, "Value");
                if (cnode == null)
                {
                    continue;
                }
                switch (iter)
                {
                case 1:
                    cdata = cnode.InnerText;
                    break;

                case 2:
                    cdata2 = cnode.InnerText;
                    break;

                case 3:
                    cdata3 = cnode.InnerText;
                    break;

                default:
                    break;
                }
            }
            this.cbChartData.Text  = cdata;
            this.cbChartData2.Text = cdata2;
            this.cbChartData3.Text = cdata3;

            //If the chart doesn't have a static series then dont show the datalabel values. 05122007GJL
            if (!StaticSeries)
            {
                //GJL 131107 Added data labels
                XmlNode labelExprNode = DesignXmlDraw.FindNextInHierarchy(node,
                                                                          "ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Value");
                if (labelExprNode != null)
                {
                    this.cbDataLabel.Text = labelExprNode.InnerText;
                }
                XmlNode labelVisNode = DesignXmlDraw.FindNextInHierarchy(node,
                                                                         "ChartData", "ChartSeries", "DataPoints", "DataPoint", "DataLabel", "Visible");
                if (labelVisNode != null)
                {
                    this.chkDataLabel.Checked = labelVisNode.InnerText.ToUpper().Equals("TRUE");
                }
            }

            chkDataLabel.Enabled  = bDataLabelExpr.Enabled = cbDataLabel.Enabled =
                bDataExpr.Enabled = cbChartData.Enabled = !StaticSeries;
            // Don't allow the datalabel OR datavalues to be changed here if we have a static series GJL


            fChartType  = fSubtype = fPalette = fRenderElement = fPercentWidth =
                fNoRows = fDataSet = fPageBreakStart = fPageBreakEnd = fChartData = false;
        }
Ejemplo n.º 26
0
        private void InitValues()
        {
            // Initialize the DataGrid columns
            DataGridTextBoxColumn dgtbName      = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbQueryName = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbValue     = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbTypeName  = new DataGridTextBoxColumn();

            this.dataGridTableStyle1.GridColumnStyles.AddRange(new DataGridColumnStyle[] {
                dgtbName,
                dgtbQueryName,
                dgtbValue,
                dgtbTypeName
            });
            // dgtbName
            dgtbName.Format      = "";
            dgtbName.FormatInfo  = null;
            dgtbName.HeaderText  = "Name";
            dgtbName.MappingName = "Name";
            dgtbName.Width       = 75;

            // dgtbQueryName
            dgtbQueryName.Format      = "";
            dgtbQueryName.FormatInfo  = null;
            dgtbQueryName.HeaderText  = "Query Column Name";
            dgtbQueryName.MappingName = "QueryName";
            dgtbQueryName.Width       = 80;

            // dgtbValue
            //
            dgtbValue.Format      = "";
            dgtbValue.FormatInfo  = null;
            dgtbValue.HeaderText  = "Value";
            dgtbValue.MappingName = "Value";
            dgtbValue.Width       = 175;

            // dgtbTypeName
            dgtbTypeName.Format      = "";
            dgtbTypeName.FormatInfo  = null;
            dgtbTypeName.HeaderText  = "TypeName";
            dgtbTypeName.MappingName = "TypeName";
            dgtbTypeName.Width       = 150;

            // cbDataSource
            cbDataSource.Items.AddRange(_Draw.DataSourceNames);

            //
            // Obtain the existing DataSet info
            //
            XmlNode      dNode = this._dsNode;
            XmlAttribute nAttr = dNode.Attributes["Name"];

            _dsv      = new DataSetValues(nAttr == null? "": nAttr.Value);
            _dsv.Node = dNode;

            XmlNode ctNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "CommandText");

            _dsv.CommandText = ctNode == null? "": ctNode.InnerText;

            XmlNode datasource = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "DataSourceName");

            _dsv.DataSourceName = datasource == null? "": datasource.InnerText;

            XmlNode timeout = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "Timeout");

            try
            {
                _dsv.Timeout = timeout == null? 0: Convert.ToInt32(timeout.InnerText);
            }
            catch                       // we don't stop just because timeout isn't convertable
            {
                _dsv.Timeout = 0;
            }

            // Get QueryParameters; they are loaded here but used by the QueryParametersCtl
            _dsv.QueryParameters = new DataTable();
            _dsv.QueryParameters.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.QueryParameters.Columns.Add(new DataColumn("Value", typeof(string)));
            XmlNode qpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "QueryParameters");

            if (qpNode != null)
            {
                string[] rowValues = new string[2];
                foreach (XmlNode qNode in qpNode.ChildNodes)
                {
                    if (qNode.Name != "QueryParameter")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = qNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(qNode, "Value", "");
                    _dsv.QueryParameters.Rows.Add(rowValues);
                }
            }

            // Get Fields
            _dsv.Fields = new DataTable();
            _dsv.Fields.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("QueryName", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("Value", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("TypeName", typeof(string)));

            XmlNode fsNode = _Draw.GetNamedChildNode(dNode, "Fields");

            if (fsNode != null)
            {
                string[] rowValues = new string[4];
                foreach (XmlNode fNode in fsNode.ChildNodes)
                {
                    if (fNode.Name != "Field")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = fNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(fNode, "DataField", "");
                    rowValues[2] = _Draw.GetElementValue(fNode, "Value", "");
                    string typename = null;
                    typename = _Draw.GetElementValue(fNode, "TypeName", null);
                    if (typename == null)
                    {
                        typename = _Draw.GetElementValue(fNode, "rd:TypeName", null);
                        if (typename != null)
                        {
                            _UseTypenameQualified = true;                               // we got it qualified so we'll generate qualified
                        }
                    }
                    rowValues[3] = typename == null?"":typename;

                    _dsv.Fields.Rows.Add(rowValues);
                }
            }
            this.tbDSName.Text     = _dsv.Name;
            this.tbSQL.Text        = _dsv.CommandText;
            this.cbDataSource.Text = _dsv.DataSourceName;
            dgFields.DataSource    = _dsv.Fields;
        }
Ejemplo n.º 27
0
        private void bLoad_Click(object sender, System.EventArgs e)
        {
            // Load the data from the SQL; we append the data to what already exists
            try
            {
                // Obtain the connection information
                XmlNode rNode  = _Draw.GetReportNode();
                XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources");
                if (dsNode == null)
                {
                    return;
                }
                XmlNode datasource = null;
                foreach (XmlNode dNode in dsNode)
                {
                    if (dNode.Name != "DataSource")
                    {
                        continue;
                    }
                    XmlAttribute nAttr = dNode.Attributes["Name"];
                    if (nAttr == null)                          // shouldn't really happen
                    {
                        continue;
                    }
                    if (nAttr.Value != _dsv.DataSourceName)
                    {
                        continue;
                    }
                    datasource = dNode;
                    break;
                }
                if (datasource == null)
                {
                    MessageBox.Show(string.Format("Datasource '{0}' not found.", _dsv.DataSourceName), "Load Failed");
                    return;
                }
                // get the connection information
                string connection   = "";
                string dataProvider = "";

                string dataSourceReference = _Draw.GetElementValue(datasource, "DataSourceReference", null);
                if (dataSourceReference != null)
                {
                    //  This is not very pretty code since it is assuming the structure of the windows parenting.
                    //    But there isn't any other way to get this information from here.
                    Control  p  = _Draw;
                    MDIChild mc = null;
                    while (p != null && !(p is RdlDesigner))
                    {
                        if (p is MDIChild)
                        {
                            mc = (MDIChild)p;
                        }

                        p = p.Parent;
                    }
                    if (p == null || mc == null || mc.SourceFile == null)
                    {
                        MessageBox.Show("Unable to locate DataSource Shared file.  Try saving report first");
                        return;
                    }
                    string filename = Path.GetDirectoryName(mc.SourceFile) + Path.DirectorySeparatorChar + dataSourceReference;
                    if (!DesignerUtility.GetSharedConnectionInfo((DesignerForm)p, filename, out dataProvider, out connection))
                    {
                        return;
                    }
                }
                else
                {
                    XmlNode cpNode = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "ConnectString");
                    connection = cpNode == null ? "" : cpNode.InnerText;

                    XmlNode datap = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "DataProvider");
                    dataProvider = datap == null ? "" : datap.InnerText;
                }
                // Populate the data table
                DesignerUtility.GetSqlData(dataProvider, connection, _dsv.CommandText, null, _DataTable);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Load Failed");
            }
        }
Ejemplo n.º 28
0
        private void InitValues()
        {
            // Initialize the DataGrid columns
            //			dgtbGE = new DGCBColumn(ComboBoxStyle.DropDown);
            dgtbGE = new DataGridTextBoxColumn();

            this.dgTableStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[] {
                this.dgtbGE
            });
            //
            // dgtbGE
            //
            dgtbGE.HeaderText  = "Expression";
            dgtbGE.MappingName = "Expression";
            dgtbGE.Width       = 175;
            // Get the parent's dataset name
//			string dataSetName = _Draw.GetDataSetNameValue(_GroupingParent);
//
//			string[] fields = _Draw.GetFields(dataSetName, true);
//			if (fields != null)
//				dgtbGE.CB.Items.AddRange(fields);

            // Initialize the DataTable
            _DataTable = new DataTable();
            _DataTable.Columns.Add(new DataColumn("Expression", typeof(string)));

            string[] rowValues = new string[1];
            XmlNode  grouping  = _Draw.GetNamedChildNode(_GroupingParent, "Grouping");

            // Handle the group expressions
            XmlNode groupingExs = _Draw.GetNamedChildNode(grouping, "GroupExpressions");

            if (groupingExs != null)
            {
                foreach (XmlNode gNode in groupingExs.ChildNodes)
                {
                    if (gNode.NodeType != XmlNodeType.Element ||
                        gNode.Name != "GroupExpression")
                    {
                        continue;
                    }
                    rowValues[0] = gNode.InnerText;

                    _DataTable.Rows.Add(rowValues);
                }
            }
            this.dgGroup.DataSource = _DataTable;
            DataGridTableStyle ts = dgGroup.TableStyles[0];

            //	ts.PreferredRowHeight = dgtbGE.CB.Height;
            ts.GridColumnStyles[0].Width = 330;

            //
            if (grouping == null)
            {
                this.tbName.Text       = "";
                this.cbParentExpr.Text = "";
                this.cbLabelExpr.Text  = "";
            }
            else
            {
                this.chkPBE.Checked = _Draw.GetElementValue(grouping, "PageBreakAtEnd", "false").ToLower() == "true";
                this.chkPBS.Checked = _Draw.GetElementValue(grouping, "PageBreakAtStart", "false").ToLower() == "true";

                this.tbName.Text       = _Draw.GetElementAttribute(grouping, "Name", "");
                this.cbParentExpr.Text = _Draw.GetElementValue(grouping, "Parent", "");
                this.cbLabelExpr.Text  = _Draw.GetElementValue(grouping, "Label", "");
            }

            if (_GroupingParent.Name == "TableGroup")
            {
                XmlNode repeat;
                repeat = DesignXmlDraw.FindNextInHierarchy(_GroupingParent, "Header", "RepeatOnNewPage");
                if (repeat != null)
                {
                    this.chkRepeatHeader.Checked = repeat.InnerText.ToLower() == "true";
                }
                repeat = DesignXmlDraw.FindNextInHierarchy(_GroupingParent, "Footer", "RepeatOnNewPage");
                if (repeat != null)
                {
                    this.chkRepeatFooter.Checked = repeat.InnerText.ToLower() == "true";
                }
                this.chkGrpHeader.Checked = _Draw.GetNamedChildNode(_GroupingParent, "Header") != null;
                this.chkGrpFooter.Checked = _Draw.GetNamedChildNode(_GroupingParent, "Footer") != null;
            }
            else
            {
                this.chkRepeatFooter.Visible = false;
                this.chkRepeatHeader.Visible = false;
                this.chkGrpFooter.Visible    = false;
                this.chkGrpHeader.Visible    = false;
            }
            if (_GroupingParent.Name == "DynamicColumns" ||
                _GroupingParent.Name == "DynamicRows")
            {
                this.chkPBE.Visible = this.chkPBS.Visible = false;
            }
            else if (_GroupingParent.Name == "DynamicSeries" ||
                     _GroupingParent.Name == "DynamicCategories")
            {
                this.chkPBE.Visible       = this.chkPBS.Visible = false;
                this.cbParentExpr.Visible = this.lParent.Visible = false;
                this.cbLabelExpr.Text     = _Draw.GetElementValue(_GroupingParent, "Label", "");
            }

            // load label and parent controls with fields
            string dsn = _Draw.GetDataSetNameValue(_GroupingParent);

            if (dsn != null)                    // found it
            {
                string[] f = _Draw.GetFields(dsn, true);
                if (f != null)
                {
                    this.cbParentExpr.Items.AddRange(f);
                    this.cbLabelExpr.Items.AddRange(f);
                }
            }
        }
Ejemplo n.º 29
0
        private void InitValues()
        {
            XmlNode riNode = _ReportItems[0];
            XmlNode tcell  = null;

            if (_ReportItems.Count > 1)
            {
                tbName.Text        = "Group Selected";
                tbName.Enabled     = false;
                lblColSpan.Visible = tbColSpan.Visible = false;
            }
            else
            {
                XmlAttribute xa = riNode.Attributes["Name"];
                tbName.Text = xa == null? "": xa.Value;
                XmlNode ris = riNode.ParentNode;
                tcell = ris.ParentNode;
                if (tcell.Name != "TableCell")
                {
                    tcell = null;
                }
            }

            this.tbZIndex.Value = Convert.ToInt32(_Draw.GetElementValue(riNode, "ZIndex", "0"));

            if (tcell != null)
            {
                gbPosition.Visible   = false;
                this.gbText.Location = gbPosition.Location;
                string colspan = _Draw.GetElementValue(tcell, "ColSpan", "1");
                tbColSpan.Value = Convert.ToDecimal(colspan);
            }
            else
            {
                lblColSpan.Visible = tbColSpan.Visible = false;
                tbLeft.Text        = _Draw.GetElementValue(riNode, "Left", "0pt");
                tbTop.Text         = _Draw.GetElementValue(riNode, "Top", "0pt");
                tbWidth.Text       = _Draw.GetElementValue(riNode, "Width", "");
                tbHeight.Text      = _Draw.GetElementValue(riNode, "Height", "");
            }

            if (riNode.Name == "Textbox")
            {
                this.cbDataElementStyle.Text = _Draw.GetElementValue(riNode, "DataElementStyle", "Auto");
                cbHideDuplicates.Items.Add("");
                object[] dsn = _Draw.DataSetNames;
                if (dsn != null)
                {
                    cbHideDuplicates.Items.AddRange(dsn);
                }
                object[] grps = _Draw.GroupingNames;
                if (grps != null)
                {
                    cbHideDuplicates.Items.AddRange(grps);
                }
                this.cbHideDuplicates.Text = _Draw.GetElementValue(riNode, "HideDuplicates", "");
                this.chkCanGrow.Checked    = _Draw.GetElementValue(riNode, "CanGrow", "false").ToLower() == "true";
                this.chkCanShrink.Checked  = _Draw.GetElementValue(riNode, "CanShrink", "false").ToLower() == "true";
                XmlNode initstate = DesignXmlDraw.FindNextInHierarchy(riNode, "ToggleImage", "InitialState");
                this.cbToggleImage.Text = initstate == null? "": initstate.InnerText;
            }
            else
            {
                this.gbText.Visible = false;
            }

            fName        = fLeft = fTop = fWidth = fHeight = fZIndex = fColSpan =
                fCanGrow = fCanShrink = fHideDuplicates = fToggleImage = fDataElementStyle = false;
        }
Ejemplo n.º 30
0
        void FillMatrixRowGroupings()
        {
            XmlNode rGroupings = _Draw.GetNamedChildNode(_MatrixNode, "RowGroupings");

            if (rGroupings == null)
            {
                return;
            }
            float height = _Draw.GetSize(
                DesignXmlDraw.FindNextInHierarchy(_MatrixNode, "MatrixRows", "MatrixRow"),
                "Height");
            int        cols         = 0;
            int        staticRows   = this.CountMatrixRows();
            int        subtotalrows = DesignXmlDraw.CountChildren(rGroupings, "RowGrouping", "DynamicRows", "Subtotal");
            MatrixItem mi;

            foreach (XmlNode c in rGroupings.ChildNodes)
            {
                if (c.Name != "RowGrouping")
                {
                    continue;
                }

                XmlNode srow = DesignXmlDraw.FindNextInHierarchy(c, "StaticRows");
                if (srow != null)
                {                       // Static rows
                    int ri = 0;
                    foreach (XmlNode sr in srow.ChildNodes)
                    {
                        if (sr.Name != "StaticRow")
                        {
                            continue;
                        }
                        XmlNode ris = DesignXmlDraw.FindNextInHierarchy(sr, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Width  = _Draw.GetSize(c, "Width");
                        mi.Height = GetMatrixRowHeight(ri);
                        _MatrixView[_HeaderRows + ri, cols] = mi;
                        ri++;
                    }
                }
                else
                {
                    XmlNode ris = DesignXmlDraw.FindNextInHierarchy(c, "DynamicRows", "ReportItems");
                    mi        = new MatrixItem(ris);
                    mi.Width  = _Draw.GetSize(c, "Width");
                    mi.Height = height;
                    _MatrixView[_HeaderRows, cols] = mi;

                    XmlNode subtotal = DesignXmlDraw.FindNextInHierarchy(c, "DynamicRows", "Subtotal");
                    if (subtotal != null)
                    {
                        ris       = DesignXmlDraw.FindNextInHierarchy(subtotal, "ReportItems");
                        mi        = new MatrixItem(ris);
                        mi.Width  = _Draw.GetSize(c, "Width");
                        mi.Height = height;
                        _MatrixView[_HeaderRows + (staticRows - 1) + subtotalrows, cols] = mi;
                        subtotalrows--;                         // these go backwards
                    }
                }
                cols++;                         // add a column per RowGrouping
            }
        }