Ejemplo n.º 1
0
        private void SetValue(RDLParameter param, FilterSets value)
        {
            try
            {
                param.DbType = (DbType)StaticInfo.GetEnumValue(typeof(DbType), value.DataType);
                switch (param.DbType)
                {
                case DbType.DateTime:
                    CultureInfo provider = CultureInfo.InvariantCulture;
                    if (value.ColumnValue == "")
                    {
                        param.Value = String.Empty;
                        break;
                    }
                    param.Value = DateTime.ParseExact(value.ColumnValue, StaticInfo.GridDateFormat, provider).ToString(StaticInfo.DateFormat);
                    break;

                case DbType.Int16:
                    param.Value = Convert.ToInt16(value.ColumnValue);
                    break;

                case DbType.Int32:
                    param.Value = Convert.ToInt32(value.ColumnValue);
                    break;

                case DbType.Int64:
                    param.Value = Convert.ToInt64(value.ColumnValue);
                    break;

                case DbType.Double:
                    param.Value = Convert.ToDouble(value.ColumnValue);
                    break;

                case DbType.Decimal:
                    param.Value = Convert.ToDecimal(value.ColumnValue);
                    break;

                case DbType.Boolean:
                    param.Value = Convert.ToBoolean(value.ColumnValue);
                    break;

                default:
                    param.Value = value.ColumnValue;
                    break;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Ejemplo n.º 2
0
        private void LoadReportParameters()
        {
            try
            {
                parameters.Clear();
                XmlNodeList  xmlParameters = GetCustomNodeList("ReportParameter");
                RDLParameter rpParam       = null;

                foreach (XmlNode xmlParam in xmlParameters)
                {
                    rpParam        = new RDLParameter();
                    rpParam.Name   = xmlParam.Attributes["Name"].InnerText;
                    rpParam.DbType = (DbType)StaticInfo.GetEnumValue(typeof(DbType), xmlParam["DataType"].InnerText);
                    rpParam.Prompt = xmlParam["Prompt"].InnerText;
                    rpParam.Value  = xmlParam["Prompt"].InnerText;
                    parameters.Add(rpParam);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
 private void SetValue(RDLParameter param, FilterSets value)
 {
     try
     {
         param.DbType = (DbType)StaticInfo.GetEnumValue(typeof(DbType), value.DataType);
         switch (param.DbType)
         {
             case DbType.DateTime:
                 CultureInfo provider = CultureInfo.InvariantCulture;
                 if (value.ColumnValue == "")
                 {
                     param.Value = String.Empty;
                     break;
                 }
                 param.Value = DateTime.ParseExact(value.ColumnValue, StaticInfo.GridDateFormat, provider).ToString(StaticInfo.DateFormat);
                 break;
             case DbType.Int16:
                 param.Value = Convert.ToInt16(value.ColumnValue);
                 break;
             case DbType.Int32:
                 param.Value = Convert.ToInt32(value.ColumnValue);
                 break;
             case DbType.Int64:
                 param.Value = Convert.ToInt64(value.ColumnValue);
                 break;
             case DbType.Double:
                 param.Value = Convert.ToDouble(value.ColumnValue);
                 break;
             case DbType.Decimal:
                 param.Value = Convert.ToDecimal(value.ColumnValue);
                 break;
             case DbType.Boolean:
                 param.Value = Convert.ToBoolean(value.ColumnValue);
                 break;
             default:
                 param.Value = value.ColumnValue;
                 break;
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Ejemplo n.º 5
0
        private void LoadReportParameters()
        {
            try
            {
                parameters.Clear();
                XmlNodeList xmlParameters = GetCustomNodeList("ReportParameter");
                RDLParameter rpParam = null;

                foreach (XmlNode xmlParam in xmlParameters)
                {
                    rpParam = new RDLParameter();
                    rpParam.Name = xmlParam.Attributes["Name"].InnerText;
                    rpParam.DbType = (DbType)StaticInfo.GetEnumValue(typeof(DbType), xmlParam["DataType"].InnerText);
                    rpParam.Prompt = xmlParam["Prompt"].InnerText;
                    rpParam.Value = xmlParam["Prompt"].InnerText;
                    parameters.Add(rpParam);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Ejemplo n.º 6
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);
            }
        }