Пример #1
0
        private void LoadReportDataSet()
        {
            try
            {
                dsreport.Tables.Clear();
                fields.Clear();
                XmlNodeList  xmlDataSet   = GetCustomNodeList("DataSet");
                XmlNodeList  ndSearchList = null;
                RDLTable     rtTable      = null;
                RDLParameter sqlParam     = null;
                RDLColumn    ReportColumn = null;

                foreach (XmlNode xmlTable in xmlDataSet)
                {
                    rtTable           = new RDLTable();
                    rtTable.TableName = xmlTable.Attributes["Name"].InnerText;
                    try
                    {
                        rtTable.CommandType = (CommandType)StaticInfo.GetEnumValue(typeof(CommandType), xmlTable["Query"]["CommandType"].InnerText);
                    }
                    catch { rtTable.CommandType = CommandType.Text; }
                    //
                    rtTable.CommandText = xmlTable["Query"]["CommandText"].InnerText;
                    //For Parameters
                    try
                    {
                        ndSearchList = xmlTable["Query"]["QueryParameters"].ChildNodes;
                    }
                    catch { ndSearchList = null; }
                    if (ndSearchList.IsNotNull())
                    {
                        foreach (XmlNode xmlParam in ndSearchList)
                        {
                            sqlParam        = new RDLParameter();
                            sqlParam.Name   = xmlParam.Attributes["Name"].InnerText;
                            sqlParam.Prompt = GetSQLParamField(xmlParam["Value"].InnerText).ToString();
                            rtTable.Parameters.Add(sqlParam);
                        }
                    }
                    //
                    //For Fields
                    try
                    {
                        ndSearchList = xmlTable["Fields"].ChildNodes;
                    }
                    catch { ndSearchList = null; }

                    if (ndSearchList.IsNotNull())
                    {
                        foreach (XmlNode xmlColumn in ndSearchList)
                        {
                            ReportColumn           = new RDLColumn();
                            ReportColumn.TableName = rtTable.TableName;
                            ReportColumn.Name      = xmlColumn.Attributes["Name"].Value;
                            try
                            {
                                ReportColumn.DataType = xmlColumn["rd:TypeName"].InnerText;
                            }
                            catch
                            {
                                ReportColumn.DataType = "System.Calculate";
                            }
                            //
                            rtTable.Columns.Add(ReportColumn);
                            if (bodyTablesName.Contains(rtTable.TableName))
                            {
                                fields.Add(ReportColumn);
                            }
                        }
                    }
                    //
                    dsreport.Tables.Add(rtTable);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Пример #2
0
        private void LoadReportDataSet()
        {
            try
            {
                dsreport.Tables.Clear();
                fields.Clear();
                XmlNodeList xmlDataSet = GetCustomNodeList("DataSet");
                XmlNodeList ndSearchList = null;
                RDLTable rtTable = null;
                RDLParameter sqlParam = null;
                RDLColumn ReportColumn = null;

                foreach (XmlNode xmlTable in xmlDataSet)
                {
                    rtTable = new RDLTable();
                    rtTable.TableName = xmlTable.Attributes["Name"].InnerText;
                    try
                    {
                        rtTable.CommandType = (CommandType)StaticInfo.GetEnumValue(typeof(CommandType), xmlTable["Query"]["CommandType"].InnerText);
                    }
                    catch { rtTable.CommandType = CommandType.Text; }
                    //
                    rtTable.CommandText = xmlTable["Query"]["CommandText"].InnerText;
                    //For Parameters
                    try
                    {
                        ndSearchList = xmlTable["Query"]["QueryParameters"].ChildNodes;
                    }
                    catch { ndSearchList = null; }
                    if (ndSearchList.IsNotNull())
                    {
                        foreach (XmlNode xmlParam in ndSearchList)
                        {
                            sqlParam = new RDLParameter();
                            sqlParam.Name = xmlParam.Attributes["Name"].InnerText;
                            sqlParam.Prompt = GetSQLParamField(xmlParam["Value"].InnerText).ToString();
                            rtTable.Parameters.Add(sqlParam);
                        }
                    }
                    //
                    //For Fields
                    try
                    {
                        ndSearchList = xmlTable["Fields"].ChildNodes;
                    }
                    catch { ndSearchList = null; }

                    if (ndSearchList.IsNotNull())
                    {
                        foreach (XmlNode xmlColumn in ndSearchList)
                        {
                            ReportColumn = new RDLColumn();
                            ReportColumn.TableName = rtTable.TableName;
                            ReportColumn.Name = xmlColumn.Attributes["Name"].Value;
                            try
                            {
                                ReportColumn.DataType = xmlColumn["rd:TypeName"].InnerText;
                            }
                            catch
                            {
                                ReportColumn.DataType = "System.Calculate";
                            }
                            //
                            rtTable.Columns.Add(ReportColumn);
                            if (bodyTablesName.Contains(rtTable.TableName))
                                fields.Add(ReportColumn);
                        }
                    }
                    //
                    dsreport.Tables.Add(rtTable);

                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }