public ReportDefinition[] GetReports(string Directory)
        {
            ArrayList     tmpReports = new ArrayList();
            DirectoryInfo dir        = new DirectoryInfo(Directory);

            FileInfo[] files = dir.GetFiles();
            foreach (FileInfo file in files)
            {
                string FileName = Path.GetFileName(file.FullName);
                if (Path.GetExtension(FileName) == ".xml")
                {
                    tmpReports.Add(GetReportDefinition(Directory + "/" + FileName));
                }
            }

            ReportDefinition[] theDefinitions = new ReportDefinition[tmpReports.Count];
            tmpReports.CopyTo(theDefinitions);
            return(theDefinitions);
        }
        // TODO: Abstract this away so we can use System.Data.IDb* thingies

        public HtmlTableRow[] GetReportRows(ReportDefinition reportDef)
        {
            ArrayList theRows = new ArrayList();

            SqlConnection prismconn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["DSN"]);

            prismconn.Open();

            SqlCommand theQuery = new SqlCommand(reportDef.Query, prismconn);

            theQuery.CommandTimeout = 600;

            Item[] fields = reportDef.Interface;

            if (fields != null && fields.Length > 0)
            {
                if (theQuery.Parameters.Contains(fields[0].Name.Replace(" ", "_")))
                {
                    theQuery.Parameters.Clear();
                }

                foreach (Item field in fields)
                {
                    string fieldname = field.Name.Replace(" ", "_");
                    string param     = "@" + fieldname;

                    switch (field.Type)
                    {
                    case "string":
                        theQuery.Parameters.Add(param, SqlDbType.VarChar, 2000).Value = this.Request.Form[fieldname].ToString();
                        break;

                    case "date":
                        theQuery.Parameters.Add(param, SqlDbType.VarChar, 10).Value = this.Request.Form[fieldname].ToString();
                        break;

                    case "int":
                        theQuery.Parameters.Add(param, SqlDbType.Int, 4).Value = System.Convert.ToInt32(this.Request.Form[fieldname].ToString());
                        break;

                    case "decimal":
                        theQuery.Parameters.Add(param, SqlDbType.Decimal).Value = System.Convert.ToDecimal(this.Request.Form[fieldname].ToString());
                        break;

                    case "list":
                        string[] strList = this.Request.Form[fieldname].ToString().Split(Environment.NewLine.ToCharArray());
                        CreateTmpTable(fieldname, field.DBType, strList, prismconn);
                        break;

                    default:

                        break;
                    }
                }
            }
            IDataReader theReader = theQuery.ExecuteReader();

            while (theReader.Read())
            {
                theRows.Add(GetHtmlRow(theReader, reportDef.Columns));
            }

            HtmlTableRow[] tmpRow = new HtmlTableRow[theRows.Count];
            theRows.CopyTo(tmpRow, 0);



            theQuery.Dispose();
            prismconn.Close();

            return(tmpRow);
        }