Paul Lisewski 4 lat temu
commit
8252d114aa
40 zmienionych plików z 4882 dodań i 0 usunięć
  1. 35 0
      Properties/AssemblyInfo.cs
  2. 26 0
      Properties/Settings.Designer.cs
  3. 5 0
      Properties/Settings.settings
  4. BIN
      Properties/vssver2.scc
  5. 1291 0
      Utils/DBHelper.cs
  6. 228 0
      Utils/DBParams.cs
  7. 398 0
      Utils/ErrHelper.cs
  8. 1294 0
      Utils/UIHelper.cs
  9. 1403 0
      Utils/XMLHelper.cs
  10. BIN
      bin/Debug/com.cloudsoft.utils.dll
  11. BIN
      bin/Debug/com.cloudsoft.utils.pdb
  12. BIN
      bin/Release/com.cloudsoft.utils.dll
  13. BIN
      bin/Release/com.cloudsoft.utils.pdb
  14. BIN
      bin/x64/Debug/com.cloudsoft.utils.dll
  15. BIN
      bin/x64/Debug/com.cloudsoft.utils.pdb
  16. 140 0
      com.cloudsoft.utils.csproj
  17. 20 0
      com.cloudsoft.utils.sln
  18. BIN
      com.cloudsoft.utils.v11.suo
  19. BIN
      com.cloudsoft.utils.v12.suo
  20. BIN
      obj/Debug/DesignTimeResolveAssemblyReferences.cache
  21. BIN
      obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  22. 4 0
      obj/Debug/GSK.UKPH.csproj.FileListAbsolute.txt
  23. BIN
      obj/Debug/Refactor/GSK.UKPH.dll
  24. 15 0
      obj/Debug/com.cloudsoft.utils.csproj.FileListAbsolute.txt
  25. BIN
      obj/Debug/com.cloudsoft.utils.csprojResolveAssemblyReference.cache
  26. BIN
      obj/Debug/com.cloudsoft.utils.dll
  27. BIN
      obj/Debug/com.cloudsoft.utils.pdb
  28. BIN
      obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
  29. 13 0
      obj/Release/GSK.UKPH.csproj.FileListAbsolute.txt
  30. BIN
      obj/Release/GSK.UKPH.dll
  31. BIN
      obj/Release/GSK.UKPH.pdb
  32. 5 0
      obj/Release/com.cloudsoft.utils.csproj.FileListAbsolute.txt
  33. BIN
      obj/Release/com.cloudsoft.utils.csprojResolveAssemblyReference.cache
  34. BIN
      obj/Release/com.cloudsoft.utils.dll
  35. BIN
      obj/Release/com.cloudsoft.utils.pdb
  36. BIN
      obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  37. 5 0
      obj/x64/Debug/com.cloudsoft.utils.csproj.FileListAbsolute.txt
  38. BIN
      obj/x64/Debug/com.cloudsoft.utils.csprojResolveAssemblyReference.cache
  39. BIN
      obj/x64/Debug/com.cloudsoft.utils.dll
  40. BIN
      obj/x64/Debug/com.cloudsoft.utils.pdb

+ 35 - 0
Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GSK.UKPH")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("GSK")]
+[assembly: AssemblyProduct("GSK.UKPH")]
+[assembly: AssemblyCopyright("Copyright © GSK 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("406ade3b-1bb3-43e8-b162-029aad82054d")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 26 - 0
Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.18046
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace com.cloudsoft.utils.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+        
+        public static Settings Default {
+            get {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 5 - 0
Properties/Settings.settings

@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles />
+  <Settings />
+</SettingsFile>

BIN
Properties/vssver2.scc


+ 1291 - 0
Utils/DBHelper.cs

@@ -0,0 +1,1291 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using Microsoft.Win32;
+
+//Including multiple providers...
+using System.Data.OleDb;
+
+using System.Xml;
+using System.IO;
+//using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;
+
+namespace com.cloudsoft.utils
+{
+
+    /// <summary>
+    ///  Class contains methods for performing database queries
+    /// </summary>
+    public class DBHelper
+    {
+
+        private Boolean _pbUppercaseNodes = false;
+        private String _pzDateFormat = "dd-MMM-yyyy HH:mm:ss";
+
+        private String pzSystem = "";
+        private String pzSchema = "";
+        private XMLHelper _request = null;
+        private Boolean lbAutoCommit = true;
+        private OleDbConnection oConnection = null;
+        private ArrayList _aParser = null;
+        private DBParams _Command = null;
+
+        public DBHelper(XMLHelper oRequest)
+        {
+            lbAutoCommit = (oRequest._con == null);
+            _request = oRequest;
+            pzSystem = oRequest.getString("system");
+            oConnection = oRequest._con;
+
+        }
+        /// <summary>
+        /// Creates, opens, and returns a connection to the database using details specified in the registry
+        /// with the name stored in the local pzSystem variable.
+        /// </summary>
+        /// <param name="bIsRecordSet">If true then PLSQLRSet=1 is added to the connection string.</param>
+        /// <param name="bOleDbConnection">Whether to create an OleDbConnection or a standard OleDbConnection.</param>
+        /// <returns>An OleDbConnection.</returns>
+        private OleDbConnection getConnection()
+        {
+            //RegistryKey kLM = Registry.LocalMachine;
+            //String zUser;
+            //String zPassword;
+            //String zDBSource;
+            
+            ////Lock the registry while accessing connection values...
+            //lock (kLM)
+            //{
+                
+            //    //Open the key for your connection string...
+            //    RegistryKey kSystem = kLM.OpenSubKey("Software\\Cloudsoft\\" + pzSystem);
+
+            //    //zPassword = (String)kSystem.GetValue("DBPassword", "notfound");
+            //    //zUser = (String)kSystem.GetValue("DBUser", "notfound");
+            //    zDBSource = (String)kSystem.GetValue("DBURL", "notfound");
+            //    //pzSchema = (String)kSystem.GetValue("DBSchema", "notfound");
+
+            //}
+
+            OleDbConnection cn;
+
+            //String zConnString = zDBSource; 
+            String zConnString = ConfigurationManager.ConnectionStrings[pzSystem].ConnectionString;
+                        cn = new OleDbConnection(zConnString);
+
+            try
+            {
+                cn.Open();
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+            return cn;
+
+        }
+
+
+        //For File Loader ends here
+
+        #region Public Methods
+
+        /// <summary>Creates a new instance of DBHelper for a given system, 
+        /// defaulting to the default data provider</summary>
+        /// <param name="zSystem">The system to connect to</param>
+        /// <remarks>
+        /// A registry entry should be set up for the given system under Hkey/LocalMachine/Software/GlaxoWellcome/system
+        /// The system should have a minimum of the following:
+        /// <list type="bullet">
+        /// <item><description>DBUser</description></item>
+        /// <item><description>DBPassword</description></item>
+        /// <item><description>DBSource</description></item>
+        /// </list>
+        ///</remarks>
+        public DBHelper(String zSystem)
+        {
+            pzSystem = zSystem.ToUpper();
+        }
+        public DBHelper(String zSystem, Boolean bUppercaseNodes) : this(zSystem)
+        {
+            _pbUppercaseNodes = bUppercaseNodes;
+        }
+        public DBHelper(String zSystem, Boolean bUppercaseNodes, String zDateFormat) : this(zSystem, bUppercaseNodes)
+        {
+            _pzDateFormat = zDateFormat;
+        }
+
+        
+    /// <summary>
+    /// Creates Parameters to pass to the passed in Command type
+    /// </summary>
+    /// <param name="zCommandText">Can be either a SQL Command or a stored procedure depending on the type</param>
+    /// <param name="tCommandType">The type of Command to create parameters for</param>
+    /// <returns>The Parameters Object</returns>
+    public DBParams createSPParams(String zSQL)
+    {
+        return createSPParams(zSQL, "");
+    }
+    public DBParams createSPParams(String zSQL, XMLHelper oNode)
+    {
+        _request = oNode;
+        zSQL = parseSQL(zSQL);
+        if (_Command != null && _Command.Command != null)
+            _Command.Command.Connection.Close();
+
+        OleDbCommand oCommand = getConnection().CreateCommand();
+        oCommand.CommandText = zSQL;
+        _Command = new DBParams(oCommand);
+        addParserParams(oNode);
+
+        return _Command;
+    }
+    public DBParams createSPParams(String zSQL, String zXPath)
+    {
+        if (_request != null)
+            zSQL = parseSQL(zSQL);
+        if (_Command != null && _Command.Command != null)
+            _Command.Command.Connection.Close();
+
+        OleDbCommand oCommand = getConnection().CreateCommand();
+        oCommand.CommandText = zSQL; 
+        _Command = new DBParams(oCommand);
+        if (zXPath.Equals(""))
+            addParserParams();
+        else
+            addParserParams(zXPath);
+        return _Command;
+    }
+        
+    public String parseSQL(String zSQL)
+    {
+        _aParser = new ArrayList();
+        return parseSQL(zSQL, false);
+    }
+
+        public String parseSQL(String zSQL, Boolean bConditional)
+    {
+        try
+        {
+        //Make sure square brackets are even
+        int iEven = 0;
+        for(int i = 0, n = zSQL.Length ; i < n ; i++)
+        {
+            char c = zSQL[i];
+            if (c == '[') iEven++;
+            if (c == ']') iEven--;
+        }
+        if (iEven != 0)
+        {
+            throw new Exception("Square brackets must be matched");
+        }
+
+        // Find optional clauses
+        Regex regex = new Regex("\\[([^\\[\\]]+|\\[([^\\[\\]]+|\\[([^\\[\\]]+)*\\])*\\])*\\]");
+        Match matcher = regex.Match(zSQL);
+        int iCurr = 0;
+        StringBuilder sb = new StringBuilder();
+        while (matcher.Success)
+        {
+            sb.Append(replaceSQLVars(zSQL.Substring(iCurr, matcher.Index - iCurr), bConditional));
+            //iCurr = matcher.start() + matcher.end();
+            iCurr = matcher.Index + matcher.Length;
+            String match = matcher.Groups[0].Value;
+            match = match.Substring(1, match.Length - 2);
+            if (matcher.Groups[2].Value != null)
+                sb.Append(parseSQL(match,true));
+            else
+                sb.Append(replaceSQLVars(match, true));
+            matcher = matcher.NextMatch();
+        }
+
+            sb.Append(replaceSQLVars(zSQL.Substring(iCurr), bConditional));
+            return sb.ToString();
+        }
+        catch (Exception ex)
+        {
+            return "";
+        }
+    }
+
+    private String replaceSQLVars(String zSQL, Boolean bConditional)
+    {
+        try
+        {
+            // Find variables to replace
+            Regex regex = new Regex("[vilcbotdf]?:[@a-z_0-9./]*");
+            Match matcher = regex.Match(zSQL);
+            StringBuilder sb = new StringBuilder();
+            int iCurr = 0;
+            while (matcher.Success)
+            {
+                // Get the replace value
+                String match = matcher.Groups[0].Value;
+                String zMatch = match.Substring(match.IndexOf(':')+1);
+                char zMatchType = match[0];
+
+                // If this is a conditional replace return nothing as soon as a variable is empty
+                //if (bConditional && _request.getString(zMatch) == "" && zMatchType != 'o')
+                if (bConditional && _request.getString(zMatch).Equals(""))
+                    return "";
+                String zTextBefore = zSQL.Substring(iCurr, matcher.Index - iCurr);
+                String zReplace = "";
+                switch (zMatchType)
+                {
+                    case ':':
+                    case 'o': zReplace = _request.getString(zMatch);
+                        //if (zReplace == "") zReplace = "=";
+                        if (zReplace.Equals("soundex"))
+                        {
+                            String[] arrWords = zTextBefore.Split(' ');
+                            zReplace += "(" + arrWords[arrWords.Length-1] + ") = ";
+                            zTextBefore = "";
+                            for (int i = 0; i < arrWords.Length - 1; i++)
+                                zTextBefore += arrWords[i] + " ";
+                        }
+                        break;
+                    case 'i':
+                    case 'f':
+                    case 't':
+                    case 'd':
+                    case 'b':
+                        zReplace = "?";
+                        _aParser.Add(match);
+                        break;
+                    default: zReplace = "?";
+                        String zOp = _request.getString("op_" + zMatch);
+                        if (zOp.Equals("soundex"))
+                            zReplace = "soundex('" + zReplace + "')";
+                        else if (zOp.Equals("like"))
+                            match = "l:" + zMatch;
+                        _aParser.Add(match);
+                        break;
+                }
+                sb.Append(zTextBefore);
+                iCurr = matcher.Index +  matcher.Length;
+                sb.Append(zReplace);
+                matcher = matcher.NextMatch();
+            }
+            sb.Append(zSQL.Substring(iCurr));
+            return sb.ToString();
+        }
+        catch (Exception ex)
+        {
+            return "";
+        }
+    }
+    private void addParserParams()
+    {
+        addParserParams(_request);
+    }
+    private void addParserParams(String zXPath)
+    {
+        foreach (XMLHelper oNode in _request.getNodes(zXPath))
+        {
+            addParserParams(oNode);
+            //_Command.addBatch();
+        }
+    }
+    private void addParserParams(XMLHelper oNode)
+    {
+
+        for (int i=0; i < _aParser.Count; i++)
+        {
+            // Get the replace value
+            String match = _aParser[i] as string;
+            String zMatch = match.Substring(match.IndexOf(':')+1);
+            char zMatchType = match[0];
+            Object oParam = null;
+            String zValue = (zMatch.Equals("xml_data")) ? oNode.getNode(zMatch).getFirstChild().getXML() : oNode.getString(zMatch);
+            OleDbType iType = OleDbType.VarChar;
+            switch (zMatchType)
+            {
+                case 'f': oParam = oNode.getDouble(zMatch);
+                    iType = OleDbType.Double;
+                    break;
+                case 'i': oParam = oNode.getInt(zMatch);
+                    iType = OleDbType.Integer;
+                    break;
+                case 't': oParam = oNode.getSQLDateTime(zMatch);
+                    iType = OleDbType.DBTimeStamp;
+                    break;
+                case 'd': oParam = oNode.getSQLDate(zMatch);
+                    iType = OleDbType.DBDate;
+                    break;
+                case 'b': oParam = (oNode.getBoolean(zMatch)) ? "Y" : "N";
+                    zValue = (String) oParam;
+                    iType = OleDbType.Char;
+                    break;
+                case 'c': oParam = zValue;
+                    iType = OleDbType.LongVarChar;
+                    break;
+                case 'l': oParam = "%" + zValue + "%";
+                    zValue = (String) oParam;
+                    break;
+                default: oParam = zValue;
+                    break;
+            }
+            if (zValue.Length == 0)
+                oParam = null;
+
+            _Command.set(i+1, oParam, iType);
+        }
+
+    }
+        
+        /// <summary>
+        /// Legacy method - now superseded by createDBSPParams
+        /// </summary>
+        public DBParams createSPParams(String zCommandText, CommandType tCommandType)
+        {
+            OleDbCommand oCommand = getConnection().CreateCommand();
+            oCommand.CommandType = tCommandType;
+            oCommand.CommandText = zCommandText;
+            return new DBParams(oCommand);
+        }
+
+
+        /// <summary>
+        /// Executes a store procedure optionally returning output parameters
+        /// This is not used for returning recordsets as XML, but for transactional stored procedures
+        /// </summary>
+        /// <param name="oParams">DBParams Parameters</param>
+        /// <returns>An XMLHelper with any output parameters</returns>
+        public XMLHelper execute(DBParams oParams)
+        {
+            //return execute(oParams, false);
+            return execute(oParams, false);
+        }
+
+        /// <summary>
+        /// Executes a SQL Query
+        /// This is not used for returning recordsets as XML, but for transactional stored procedures
+        /// </summary>
+        /// <param name="zSQL">DBParams Parameters</param>
+        /// <returns>An XMLHelper with any output parameters</returns>
+        public XMLHelper execute(String zSQL)
+        {
+            DBParams oParams = createSPParams(zSQL, CommandType.Text);
+            return execute(oParams, false);
+        }
+
+
+        /// <summary>
+        /// Executes a store procedure optionally returning output parameters
+        /// This is not used for returning recordsets as XML, but for transactional stored procedures
+        /// </summary>
+        /// <param name="oParams">DBParams Parameters</param>
+        /// <returns>An XMLHelper with any output parameters</returns>
+        public XMLHelper execute(DBParams oParams, Boolean bKeepOpen)
+        {
+            return executeODAC(oParams, bKeepOpen);
+        }
+
+        #endregion 
+
+        #region ODAC Specific Private Methods
+
+        /// <summary>
+        /// Executes a store procedure optionally returning output parameters
+        /// This is not used for returning recordsets as XML, but for transactional stored procedures
+        /// </summary>
+        /// <param name="oParams">DBParams Parameters</param>
+        /// <param name="bKeepOpen">Flag to determine if the connection is kept open or not</param>
+        /// <returns>An XMLHelper with any output parameters</returns>
+        private XMLHelper executeODAC(DBParams oParams, Boolean bKeepOpen)
+        {
+            DateTime dStart = DateTime.Now;
+            XMLHelper oResponse = new XMLHelper("response");
+            oResponse.appendNode("rows", Convert.ToString(oParams.ExecuteNonQuery()));
+            foreach (OleDbParameter oParam in oParams.ODACParameters())
+            {
+                if (oParam.Direction == System.Data.ParameterDirection.Output)
+                {
+                    switch (oParam.OleDbType.ToString())
+                    {
+                        case "Clob":
+                            {
+                                //XMLHelper oReturn = new XMLHelper(((Oracle.DataAccess.Types.OracleClob)(oParam.Value)).Value);
+                                //XMLHelper oParamNode = oResponse.appendNode(oParam.ParameterName);
+                                //oParamNode.appendNode(oReturn);
+                                break;
+                            }
+                        default:
+                            {
+                                oResponse.appendNode(oParam.ParameterName.Replace(":", ""), oParam.Value.ToString());
+                                break;
+                            }
+                    }
+                }   
+            }
+            TimeSpan tDiff = DateTime.Now.Subtract(dStart);
+            oResponse.appendAttribute("duration", tDiff.TotalMilliseconds.ToString());
+            if (!bKeepOpen)
+            {
+                oParams.CloseConnection();
+                oParams.CloseCommand();
+            }
+            return oResponse;
+        }
+
+
+
+        /// <summary>
+        /// Creates Parameters to pass to a Stored Procedure. Also calls getConnection to get an
+        /// OleDbConnection, and appends the required RefCursor.
+        /// </summary>
+        /// <param name="zCommandText">The stored procedure to be called</param>
+        /// <returns>The Parameters Object</returns>
+        /// <example>
+        /// DBHelper oDB = new DBHelper("uki");
+        /// DBParams oCommand = oDB.createOracleSPParams("pkg_orgcusts.RetrieveTargetOrgsByBrand");
+        /// </example>
+        private DBParams createODACSPParams(String zCommandText, CommandType tCommandType, Boolean bindByName)
+        {
+            OleDbCommand oCommand = getConnection().CreateCommand();
+            oCommand.CommandType = tCommandType;
+            
+            switch (tCommandType)
+            {
+                case CommandType.Text:
+                    {
+                        oCommand.CommandText = zCommandText;
+                        break;
+                    }
+                case CommandType.StoredProcedure:
+                case CommandType.TableDirect:
+                    {
+                        oCommand.CommandText = pzSchema + "." + zCommandText;
+                        break;
+                    }
+            }
+
+            return new DBParams(oCommand);
+        }
+
+
+        #endregion
+
+        public void closeConnection(DBParams oCommand)
+        {
+            oCommand.CloseConnection();
+        }
+
+        #region Overrides for Get Dom
+
+        public XMLHelper getDOM(IDataReader oRS)
+        {
+            return getDOM(oRS, 0, 2000);
+        }
+        /// <summary>
+        /// Gets a DOM of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <returns>An XMLHelper representation of the recordset in the format response/rows/row</returns>
+        public XMLHelper getDOM(IDataReader oRS, int iStartRow, int iMaxRows)
+        {
+            return appendToDOM(null, null, null, null, oRS, "rows", "row", iStartRow, iMaxRows, true, RefCurPosition.First, false, true, false);
+        }
+        /// <summary>
+        /// Gets a DOM of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <returns>An XMLHelper representation of the recordset in the format response/rows/row</returns>
+        public XMLHelper getDOM(String zSQL)
+        {
+            _Command = createSPParams(zSQL);
+            return getDOM(_Command, "rows", "row");
+        }
+        /// <summary>
+        /// Gets a DOM of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <returns>An XMLHelper representation of the recordset in the format response/rows/row</returns>
+        public XMLHelper getDOM(DBParams oCommand, String zRowsetName, String zRowName)
+        {
+            return getDOM(oCommand, 0, 0, false, RefCurPosition.First, zRowsetName, zRowName, false, true, null, null, null, null, false);
+        }
+        /// <summary>
+        /// Gets a DOM of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <returns>An XMLHelper representation of the recordset in the format response/rows/row</returns>
+        public XMLHelper getDOM(DBParams oCommand, Boolean withRefCur)
+        {
+            
+            RefCurPosition refCurPosition = RefCurPosition.None;
+            if (withRefCur)
+                refCurPosition = RefCurPosition.First;
+
+            return getDOM(oCommand, 0, 0, false, refCurPosition, "rows", "row", false, true, null, null, null, null, false);
+
+        }
+
+        /// <summary>
+        /// Gets a XML DOM of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <param name="iStartRow">The start row number to retrieve</param>
+        /// <param name="iMaxRows">The maximum number of rows</param>
+        /// <param name="bShowTotal">Determines whether the total Rowcount is shown.</param>
+        /// <param name="zRowsetName">The Rowset node name.</param>
+        /// <param name="zRowName">The Row node name</param>
+        /// <param name="bShowMetadata">Determines whether to create meta data info</param>
+        /// <returns>An XMLHelper representation of the recordset</returns>
+        public XMLHelper getDOM(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, DBHelper.RefCurPosition refCurPosition,
+            String zRowsetName, String zRowName, Boolean bShowMetadata, Boolean bCloseConnection, 
+            XMLHelper oInputDOM, String zNode, String zKey, String zGrouping, Boolean CheckRowName)
+        {
+
+            //Time the processing...
+            DateTime dStart = DateTime.Now;
+
+            //Execute the database Command...
+            XMLHelper oResponse = appendToDOM(oInputDOM, zNode, zKey, zGrouping, oCommand, zRowsetName, zRowName, iStartRow, iMaxRows, bShowTotal, refCurPosition, bShowMetadata, false, CheckRowName);
+            
+            //Add the execution time to the ouptut...
+            TimeSpan tDiff = DateTime.Now.Subtract(dStart);
+            oResponse.appendAttribute("duration", tDiff.TotalMilliseconds.ToString());
+            
+            //Close the connection if required...
+            if (bCloseConnection)
+            {
+                oCommand.CloseConnection();
+            }
+
+            return oResponse;
+
+        }
+
+        #endregion
+
+        #region Overrides for Append To DOM
+
+        /// <summary>
+        /// Executes a Command and adds the recordset to an existing DOM
+        /// </summary>
+        /// <param name="oInputDom">Dom to append to</param>
+        /// <param name="zNode">Xpath to the node to append information to</param>
+        /// <param name="zKey">Key to match</param>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <param name="zRowsetName">The Rowset node name</param>
+        /// <param name="zRowName">The row Node Name</param>
+        public void appendToDOM(XMLHelper oInputDom, String zNode, String zKey, DBParams oCommand, String zRowsetName, String zRowName)
+        {
+            appendToDOM(oInputDom, zNode, zKey, null, oCommand, zRowsetName, zRowName, 0, 9999999,
+                false, (oCommand.Command.CommandType == CommandType.Text ? RefCurPosition.None : RefCurPosition.First), false, false, false); 
+            //appendToDOM(oInputDom, zNode, zKey, oCommand, zRowsetName, zRowName, 0, 9999999, false, false);
+        }
+
+        /// <summary>
+        ///  Executes a Command and adds the recordset to an existing DOM
+        /// </summary>
+        /// <param name="oInputDom">Dom to append to</param>
+        /// <param name="zNode">Xpath to the node to append information to</param>
+        /// <param name="zKey">Key to match</param>
+        /// <param name="oParams">Parameters to pass to the stored procedure</param>
+        /// <param name="zRowsetName">The Rowset node name</param>
+        /// <param name="zRowName">The row Node Name</param>
+        /// <param name="iStartRow">The start row number</param>
+        /// <param name="iMaxRows">The maximun number of rows to fetch</param>
+        /// <param name="bShowTotal">Determines whether totals are shown</param>
+        /// <param name="bShowMetadata">Determines whether metadata is to be shown</param>
+        /// 
+        public void appendToDOM(XMLHelper oInputDom, String zNode, String zKey, DBParams oParams, String zRowsetName, String zRowName, int iStartRow, int iMaxRows, Boolean bShowTotal, Boolean bShowMetadata)
+        {
+            appendToDOM(oInputDom, zNode, zKey, null, oParams, zRowsetName, zRowName, iStartRow, iMaxRows, 
+                        bShowTotal, RefCurPosition.None, false, false, false);
+        }
+        
+        /// <summary>
+        /// Executes a Command and adds the recordset to an existing DOM
+        /// JF 12/2007 - Generalised to take an IDbCommand, allowing it to be used with either an
+        ///              OleDbCommand or OleDbCommand
+        /// </summary>
+        /// <param name="oInputDom">Dom to append to</param>
+        /// <param name="zNode">Xpath to the node to append information to</param>
+        /// <param name="zKey">Key to match</param>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <param name="zRowsetName">The Rowset node name</param>
+        /// <param name="zRowName">The row Node Name</param>
+        /// <param name="iStartRow">The start row number</param>
+        /// <param name="iMaxRows">The maximun number of rows to fetch</param>
+        /// <param name="bShowTotal">Determines whether totals are shown</param>
+        /// <param name="bShowMetadata">Determines whether metadata is to be shown</param>
+        /// <param name="bCloseConnection">Whether to close the Commands connection when finished exection</param>
+        /// <param name="CheckRowName">This is an override to force a check of the row name against any xpath which 
+        /// may have been defined in the column name from the procedure/package. It's function is to avoid the creation
+        /// of a dom structure such as rows/row/row if the xpath in the procedure reads row/@value. If the first component
+        /// of the xpath in the procedure matches the rowname specified in the call to this method, then it will assume
+        /// that you don't want to append a new child with the same name. It will still allow the creation of 
+        /// rows/row/childrow if the procedure reads childrow/@value.</param>
+        public XMLHelper appendToDOM(XMLHelper oInputDom, String zNode, String zKey, String zGrouping, DBParams oParams, 
+            String zRowsetName, String zRowName, int iStartRow, int iMaxRows, 
+            Boolean bShowTotal, DBHelper.RefCurPosition refCurPosition, Boolean bShowMetadata, Boolean bCloseConnection,
+            Boolean CheckRowName)
+        {
+
+
+            #region Execute the database Command
+
+            //Execute the Command and obtain the output recordset...
+            OleDbCommand oCommand = oParams.AsOleDbCommand();
+
+            //oCommand.Prepare();
+
+            CommandBehavior cb = CommandBehavior.Default;
+            if (bCloseConnection)
+            {
+                cb = CommandBehavior.CloseConnection;
+            }
+            IDataReader oRS = oCommand.ExecuteReader(cb);
+            
+            #endregion
+
+            //Return the response (the input dom may also have been appended to inline)...
+            return appendToDOM(oInputDom, zNode, zKey, zGrouping, oRS, zRowsetName, zRowName, iStartRow, iMaxRows, bShowTotal, refCurPosition, bShowMetadata, bCloseConnection, CheckRowName);
+            
+        }
+
+        public XMLHelper appendToDOM(XMLHelper oInputDom, String zNode, String zKey, String zGrouping, IDataReader oRS,
+            String zRowsetName, String zRowName, int iStartRow, int iMaxRows,
+            Boolean bShowTotal, DBHelper.RefCurPosition refCurPosition, Boolean bShowMetadata, Boolean bCloseConnection,
+            Boolean CheckRowName)
+        {
+
+            //Establish output vars...
+            XMLHelper oResponse = new XMLHelper("response");
+            //XMLHelper oResponse = (oInputDom == null || oInputDom.getName() == "request") ? new XMLHelper("response") : oInputDom;
+
+            XMLHelper oInRowGroup = null;
+            XMLHelper oOutRowGroup = null;
+
+            XMLHelper oRow = null;
+
+            String zNodeValue;
+
+            Int32 lFields = oRS.FieldCount;
+
+            String[] vValue = null;
+            Int32 lGroupCols = 0;
+            String zGroupNode = null;
+            if (zGrouping != "" && zGrouping != null)
+            {
+                vValue = zGrouping.Split(":".ToCharArray());
+                lGroupCols = Convert.ToInt32(vValue[0]);
+                zGroupNode = vValue[1];
+            }
+
+            //Determine whether to create a grouping node...
+            if (zRowsetName != "" && zRowsetName != null)
+            {
+                //Append a grouping node to the response to hold child nodes...
+                oOutRowGroup = oResponse.appendNode(zRowsetName);
+            }
+            else
+            {
+                //Appending child nodes directly to the response root, rather than a grouping node...
+                oOutRowGroup = oResponse;
+            }
+
+            // Create a collection of keys in the DOM
+            Dictionary<String, XMLHelper> oColKeys = new Dictionary<String, XMLHelper>();
+            if (zNode != "" && zNode != null)
+            {
+
+                XMLHelper[] oNodes = oInputDom.getNodes(zNode);
+                for (int i = 0; i < oNodes.Length; i++)
+                {
+
+                    XMLHelper oNode = oNodes[i];
+                    if (zRowsetName != "" && zRowsetName != null)
+                    {
+                        oInRowGroup = oNode.appendNode(zRowsetName);
+                    }
+                    else
+                    {
+                        oInRowGroup = oNode;
+                    }
+
+                    if (zKey != "" && zKey != null)
+                        oColKeys.Add(oNodes[i].getValue(zKey), oInRowGroup);
+
+                }
+
+            }
+
+            //If you are required to append "Metadata", then 
+            //append column names and types...
+            if (bShowMetadata)
+            {
+                XMLHelper oMeta = oResponse.appendNode("meta_data");
+                XMLHelper oCols = oMeta.appendNode("columns");
+                for (int i = 0; i < oRS.FieldCount; i++)
+                {
+                    XMLHelper oNode = oCols.appendNode("column");
+                    oNode.appendAttribute("name", oRS.GetName(i).ToLower());
+                    oNode.appendAttribute("type", oRS.GetDataTypeName(i));
+                }
+            }
+
+            #region Deal with paging
+
+            // Set the start row and max rows. Unless maxrows has been explicitly 
+            //defined then default to a safe value (2000 in this case)...
+            int iRow = iStartRow;
+            if (iMaxRows == 0)
+                iMaxRows = Int32.MaxValue;
+            //iMaxRows = 2000;
+
+            //If you are "paging", then a startrow will be provided, so 
+            //advance to the startrow of this page...
+            if (iStartRow > 0)
+            {
+                for (int i = 0; i < iStartRow; i++)
+                    oRS.Read();
+            }
+
+            #endregion
+
+            String zCurrRowKey = null;
+            String zPrevRowKey = null;
+            Boolean bFirst = true;
+            XMLHelper oTempNode = null;
+            Int32 lField = 0;
+
+            //  Loop through the recordset and construct the XML DOM
+            while (oRS.Read() && iRow < (iMaxRows + iStartRow))
+            {
+
+                if (iRow >= iStartRow)
+                {
+
+                    bFirst = true;
+
+                    // Get the "Key" for this row. Used to determine whether this should be a new grouping.
+                    zCurrRowKey = null;
+                    for (lField = 0; lField <= lGroupCols - 1; lField++)
+                    {
+                        zCurrRowKey += (string)oRS[lField].ToString() + "-";
+                    }
+
+                    if (!string.IsNullOrEmpty(zKey))
+                    {
+                        oInRowGroup = oColKeys[oRS[0].ToString()];
+                    }
+
+                    //If you aren't grouping, or if this key is new...
+                    if (lGroupCols == 0 || zCurrRowKey != zPrevRowKey)
+                    {
+                        //Create a new node...
+                        oRow = new XMLHelper(zRowName);
+                        if (oInRowGroup != null)
+                        {
+                            oRow = oInRowGroup.appendNode(oRow);
+                        }
+                        oTempNode = oRow;
+                    }
+
+                    lField = 0;
+                    for (int i = 0; i < oRS.FieldCount; i++)
+                    {
+                        //DataRow oField = oRS.[i];
+                        if (lField >= lGroupCols || zCurrRowKey != zPrevRowKey)
+                        {
+                            //vValue = oField.Value;
+                            zNodeValue = "";
+
+                            //  Get the data from the field
+                            if (oRS.GetFieldType(i).Name =="DateTime")
+                            {
+                                if (oRS.IsDBNull(i))
+                                    zNodeValue = "";
+                                else
+                                    zNodeValue = oRS.GetDateTime(i).ToString(_pzDateFormat);
+                            }
+                            else
+                            {
+                                if (oRS.IsDBNull(i))
+                                    zNodeValue = "";
+                                else
+                                    zNodeValue = oRS[i].ToString();
+                            }
+
+                            String zNodeName = oRS.GetName(i).ToLower().Replace("\"", "");
+                            if (_pbUppercaseNodes)
+                                zNodeName = zNodeName.ToUpper();
+                            //This is an override to check the row name during an append.
+                            //See procedure definition comment for an explanation...
+                            if (CheckRowName && zNodeName.Split("/".ToCharArray()).Length > 1)
+                            {
+                                if (zRowName == zNodeName.Split("/".ToCharArray())[0])
+                                    zNodeName = zNodeName.Replace(zRowName + "/", "");
+                            }
+
+                            //  Add the field to the current row
+                            if (bFirst & !string.IsNullOrEmpty(zKey))
+                            {
+                                //Do Nothing...
+                            }
+                            else if (lGroupCols == lField & lGroupCols > 0)
+                            {
+                                oRow = oRow.appendNode(zGroupNode);
+                                oRow.appendXPathNode(zNodeName, zNodeValue, false);
+                            }
+                            else
+                            {
+                                //if this is a value node rather than an attribute, 
+                                //and if it is a match to the node name...
+                                if (CheckRowName &&
+                                    (zNodeName == zRowName) &&
+                                    !zNodeName.Contains("@")
+                                    )
+                                {
+                                    //Just set the node value...
+                                    oRow.setValue(zNodeValue);
+                                }
+                                else
+                                {
+                                    if (zNodeName == "xml-data" || zNodeName.EndsWith("_xml"))
+                                        oRow.appendNode(new XMLHelper("<" + zNodeName + ">" + zNodeValue + "</" + zNodeName + ">"));
+                                    else
+                                        oRow.appendXPathNode(zNodeName, zNodeValue, false);
+                                }
+                            }
+
+                        }
+                        bFirst = false;
+                        lField = lField + 1;
+                    }
+
+                    oRow = oTempNode;
+
+                    //If you are dom merging, append to the inrowgroup...
+                    //if (oInRowGroup != null)
+                    //    oInRowGroup.appendNode(oRow);
+
+                    //Always append to the outrowgroup...
+                    oOutRowGroup.appendNode(oRow);
+
+                    zPrevRowKey = zCurrRowKey;
+
+                }
+
+                iRow++;
+
+            }
+
+            //  If total is to be shown move to the end of the recordset
+            if (bShowTotal)
+            {
+
+                //Need to read the remaining rows in the recordset to count rows...
+                bool additionalRowsCounted = false;
+                while (oRS.Read() && iRow < 2000)
+                {
+                    additionalRowsCounted = true;
+                    iRow++;
+                }
+
+                //if ((iStartRow == 0) && (additionalRowsCounted))
+                //    iRow++;
+
+                //if (iStartRow > 0)
+                //    iRow--;
+                if (additionalRowsCounted)
+                    iRow++;
+
+                //Append the rowcount to the returned results...
+                oResponse.appendAttribute("total_rows", Convert.ToString(iRow));
+                //oResponse.appendNode("total_rows", Convert.ToString(iRow));
+
+            }
+
+            //Always close the recordset...
+            oRS.Close();
+
+            //Return the response (the input dom may also have been appended to inline)...
+            return oResponse;
+
+        }
+        
+        public XMLHelper getTables(String zSchema)
+        {
+            XMLHelper oResponse = null;
+            try
+            {
+                DataTable dt = getConnection().GetSchema("Tables", new String[] {zSchema});
+                oResponse = getDOM(dt);
+            }
+            catch (Exception ex)
+            {
+            }
+            return oResponse;
+        }
+        public XMLHelper getColumns(String zTable)
+        {
+            XMLHelper oResponse = null;
+            try
+            {
+                OleDbCommand cmd = new OleDbCommand("select * from " + zTable, getConnection());   
+                IDataReader rs = cmd.ExecuteReader();
+                oResponse = getDOM(rs.GetSchemaTable());
+            }
+            catch (Exception ex)
+            {
+            }
+            return oResponse;
+        }
+        public XMLHelper getDOM(DataTable dt)
+        {
+            XMLHelper oResponse = new XMLHelper("response");
+            XMLHelper oRows = oResponse.appendNode("rows");
+            foreach (DataRow dr in dt.Rows)
+            {
+                XMLHelper oRow = oRows.appendNode("row");
+                foreach (DataColumn dc in dt.Columns)
+                {
+                    oRow.appendNode(dc.ColumnName.ToLower(), dr[dc].ToString());
+                }
+            }
+            return oResponse;
+        }
+        #endregion
+
+        #region Overrides for Get XML
+        
+        public enum RefCurPosition
+        {
+            First,
+            Last,
+            None
+        }
+
+        /// <summary>
+        /// Gets an XML String of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <returns>An XML string representation of the recordset in the format response/rows/row</returns>
+        public String getXML(DBParams oCommand)
+        {
+            return getDOM(oCommand, true).getXML();
+        }
+
+        public String getXML(DBParams oCommand, Boolean withRefCur)
+        {
+            return getDOM(oCommand, withRefCur).getXML();
+        }
+
+        /// <summary>
+        /// Gets an XML String of a recordset
+        /// </summary>
+        /// <param name="oCommand">Parameters to pass to the stored procedure</param>
+        /// <param name="iStartRow">The start row number to retrieve</param>
+        /// <param name="iMaxRows">The maximum number of rows</param>
+        /// <param name="bShowTotal">Determines whether the total Rowcount is shown.</param>
+        /// <param name="zRowsetName">The Rowset node name.</param>
+        /// <param name="zRowName">The Row node name</param>
+        /// <param name="bShowMetadata">Determines whether to create meta data info</param>
+        /// <returns>An XML string representation of the recordset</returns>
+        public String getXML(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, String zRowsetName, String zRowName, Boolean bShowMetadata)
+        {
+            return getXML(oCommand, iStartRow, iMaxRows, bShowTotal, zRowsetName, zRowName, bShowMetadata, true);
+        }
+        public XMLHelper getXMLHelper(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, String zRowsetName, String zRowName, Boolean bShowMetadata)
+        {
+            return getXMLHelper(oCommand, iStartRow, iMaxRows, bShowTotal, zRowsetName, zRowName, bShowMetadata, true);
+        }
+
+        public String getXML(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, String zRowsetName, String zRowName, Boolean bShowMetadata, Boolean bCloseConnection)
+        {
+            return getXML(oCommand, iStartRow, iMaxRows, bShowTotal, RefCurPosition.First, zRowsetName, zRowName, bShowMetadata, bCloseConnection, null, null, null, null, false).getXML();
+        }
+        public XMLHelper getXMLHelper(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, String zRowsetName, String zRowName, Boolean bShowMetadata, Boolean bCloseConnection)
+        {
+            return getXML(oCommand, iStartRow, iMaxRows, bShowTotal, RefCurPosition.First, zRowsetName, zRowName, bShowMetadata, bCloseConnection, null, null, null, null, false);
+        }
+
+        public XMLHelper getXML(DBParams oCommand, int iStartRow, int iMaxRows, Boolean bShowTotal, DBHelper.RefCurPosition refCurPosition, String zRowsetName, String zRowName, Boolean bShowMetadata, Boolean bCloseConnection, XMLHelper oInputDOM, String zNode, String zKey, String zGrouping, Boolean CheckRowName)
+        {
+            return getDOM(oCommand, iStartRow, iMaxRows, bShowTotal, refCurPosition, zRowsetName, zRowName, bShowMetadata, bCloseConnection, oInputDOM, zNode, zKey, zGrouping, CheckRowName);
+        }
+
+        /// <summary>
+        /// High performance version of append to dom.
+        /// Will always add columns as attributes.
+        /// </summary>
+        public String getXML(DBParams oParams, String zRowsetName, String zRowName, Boolean bCloseConnection)
+        {
+            return getXML(oParams, zRowsetName, zRowName, bCloseConnection, null, null, null, RefCurPosition.First);
+        }
+
+        public String getXML(DBParams oParams, String zRowsetName, String zRowName, Boolean bCloseConnection, Int32? StartRow, Int32? MaxRows, Boolean? ShowTotal, RefCurPosition refCurPosition)
+        {
+            return getXMLStringBuilder(oParams, zRowsetName, zRowName, bCloseConnection, StartRow, MaxRows, ShowTotal, refCurPosition).ToString();
+        }
+
+        public XMLHelper getXMLHelper(DBParams oParams, String zRowsetName, String zRowName, Boolean bCloseConnection, Int32? StartRow, Int32? MaxRows, Boolean? ShowTotal, RefCurPosition refCurPosition)
+        {
+            return new XMLHelper(getXMLStringBuilder(oParams, zRowsetName, zRowName, bCloseConnection, StartRow, MaxRows, ShowTotal, refCurPosition));
+        }
+
+        /// <summary>
+        /// High performance version of append to dom.
+        /// Will always add columns as attributes.
+        /// </summary>
+        private StringBuilder getXMLStringBuilder(DBParams oParams, String zRowsetName, String zRowName, Boolean bCloseConnection, Int32? StartRow, Int32? MaxRows, Boolean? ShowTotal, RefCurPosition refCurPosition)
+        {
+
+            //oParams.Command.BindByName = true;
+            addRefCur(refCurPosition, oParams);
+
+            //Execute the procedure...
+            //System.Data.IDbCommand oCommand = oParams.AsIDbCommand();
+            OleDbCommand oCommand = oParams.Command;
+            IDataReader oRS = null;
+            if (bCloseConnection)
+            {
+                oRS = oCommand.ExecuteReader(CommandBehavior.CloseConnection);
+            }
+            else
+            {
+                oRS = oCommand.ExecuteReader();
+            }
+            
+            //Get the number of columns...
+            Int32 FieldCount = oRS.FieldCount;
+
+            //Get the column names (in advance of the loop, so it doesn't 
+            //need to read the rowset every time through...
+            Dictionary<Int32, String> oColumnNames = new Dictionary<Int32, String>();
+            String ColName = null;
+            for (int i = 0; i < FieldCount; i++)
+            {
+                ColName = oRS.GetName(i).ToLower();
+                if (ColName.StartsWith("@"))
+                {
+                    ColName = ColName.Substring(1);
+                }
+                oColumnNames.Add(i, ColName);
+            }
+
+            StringWriter sw = new StringWriter();
+            XmlTextWriter xtw = new XmlTextWriter(sw);
+
+            //Append a placeholder for the rows...
+            xtw.WriteStartElement("response");
+
+            if (zRowsetName != null)
+                xtw.WriteStartElement(zRowsetName);
+
+            //Paging setup...
+            if (StartRow == null) StartRow = 0;
+            if (MaxRows == null) MaxRows = 0;
+            if (MaxRows == 0) MaxRows = int.MaxValue;
+            
+            //Loop through every row in the rs, adding rows and cols appropriately...
+            Int32 rowCount = 0;
+            Boolean WriteRow = true;
+            while (oRS.Read())
+            {
+
+                //If you are at the start row...
+                if (rowCount >= StartRow && WriteRow)
+                {
+
+                    //Add a new row...
+                    xtw.WriteStartElement(zRowName);
+                    
+                    for (int i = 0; i < FieldCount; i++)
+                    {
+                        //  Add the field to the current row
+                        xtw.WriteAttributeString(oColumnNames[i].ToString(), oRS[i].ToString());
+                    }
+
+                    xtw.WriteEndElement();
+
+                    //If you have reached the max number of rows you want to paint, then stop painting...
+                    if ((rowCount - StartRow) >= (MaxRows-1))
+                        WriteRow = false;
+
+                }
+
+                rowCount++;
+
+            }
+
+            if (zRowsetName != null)
+            {
+                xtw.WriteElementString("total_rows", rowCount.ToString());
+                xtw.WriteEndElement();
+            }
+
+            xtw.WriteElementString("total_rows", rowCount.ToString());
+            xtw.WriteEndElement();
+
+            //Close the rs...
+            oRS.Close();
+            
+            //Return the built dom...
+            return sw.GetStringBuilder();
+
+        }
+
+        public StringBuilder getCSV(DBParams oParams, String zRowsetName, String zRowName, 
+            Boolean bCloseConnection, Int32? StartRow, Int32? MaxRows, Boolean? ShowTotal, RefCurPosition refCurPosition,
+            out long rowCount)
+        {
+
+            //oParams.Command.BindByName = true;
+            addRefCur(refCurPosition, oParams);
+
+            //Execute the procedure...
+            //System.Data.IDbCommand oCommand = oParams.AsIDbCommand();
+            OleDbCommand oCommand = oParams.Command;
+            OleDbDataReader oRS = null;
+            if (bCloseConnection)
+            {
+                oRS = oCommand.ExecuteReader(CommandBehavior.CloseConnection);
+            }
+            else
+            {
+                oRS = oCommand.ExecuteReader();
+            }
+
+            //Get the number of columns...
+            Int32 FieldCount = oRS.FieldCount;
+
+            StringWriter sw = new StringWriter();
+
+            //Get the column names (in advance of the loop, so it doesn't 
+            //need to read the rowset every time through...
+            Dictionary<Int32, String> oColumnNames = new Dictionary<Int32, String>();
+            String ColName = null;
+            for (int i = 0; i < FieldCount; i++)
+            {
+                ColName = oRS.GetName(i).ToLower();
+                if (ColName.StartsWith("@"))
+                {
+                    ColName = ColName.Substring(1);
+                }
+                oColumnNames.Add(i, ColName);
+
+                sw.Write(ColName);
+                if (i < (FieldCount - 1))
+                    sw.Write(",");
+
+            }
+
+            sw.Write(Environment.NewLine);
+
+
+            //Paging setup...
+            if (StartRow == null) StartRow = 0;
+            if (MaxRows == null) MaxRows = 0;
+            if (MaxRows == 0) MaxRows = int.MaxValue;
+
+            Type type;
+
+            //Loop through every row in the rs, adding rows and cols appropriately...
+            rowCount = 0;
+            Boolean WriteRow = true;
+            while (oRS.Read())
+            {
+
+                //If you are at the start row...
+                if (rowCount >= StartRow && WriteRow)
+                {
+
+                    for (int i = 0; i < FieldCount; i++)
+                    {
+                        
+                        type = oRS[i].GetType();
+                        if ((type == typeof(String)))
+                            sw.Write("\"");
+                        else if (oColumnNames[i] == "ean_code")  //always output ean codes as text to avoid conversion by excel to exponents
+                            sw.Write("=\"");
+
+                        sw.Write(oRS[i].ToString());
+
+                        if (type == typeof(String))
+                            sw.Write("\"");
+                        else if (oColumnNames[i] == "ean_code")  //always output ean codes as text to avoid conversion by excel to exponents
+                            sw.Write("\"");
+
+                        if (i < (FieldCount-1))
+                            sw.Write(",");
+
+                    }
+
+                    sw.Write(Environment.NewLine);
+
+                    //If you have reached the max number of rows you want to paint, then stop painting...
+                    if ((rowCount - StartRow) >= (MaxRows - 1))
+                        WriteRow = false;
+
+                }
+
+                rowCount++;
+
+            }
+
+            //Close the rs...
+            oRS.Close();
+
+            //Return the built csv...
+            return sw.GetStringBuilder();
+
+        }
+
+
+        /// <summary>
+        /// Adds a param for a returnable refcursor based on the set refCurPosition
+        /// </summary>
+        /// <param name="refCurPosition">The position to add the refcur in</param>
+        /// <param name="oParams">The object to add the refcur to</param>
+        private void addRefCur(RefCurPosition refCurPosition, DBParams oParams)
+        {
+
+            //Add a refcursor output param if there isn't already one added...
+            if ( (refCurPosition != RefCurPosition.None) && (oParams.Command == null || !oParams.Command.Parameters.Contains("poRefCur")) )
+            {
+                
+                Int32? refCurIndex = null;
+                switch (refCurPosition)
+                {
+                    case RefCurPosition.First:
+                        {
+                            refCurIndex = 0;
+                            break;
+                        }
+                    case RefCurPosition.Last:
+                        {
+                            refCurIndex = oParams.Command.Parameters.Count;
+                            break;
+                        }
+                }
+
+                //Append the output refcursor param...
+                OleDbParameter oRefCursor = new OleDbParameter("poRefCur", OleDbType.IDispatch);
+                if (pzSystem == "SECURITY")
+                {
+                    oRefCursor.Direction = ParameterDirection.ReturnValue;
+                }
+                else
+                {
+                    oRefCursor.Direction = ParameterDirection.Output;
+                }
+                oParams.Command.Parameters.Insert(refCurIndex.Value, oRefCursor);
+           
+            }
+
+        }
+
+        #endregion
+
+    }
+}

+ 228 - 0
Utils/DBParams.cs

@@ -0,0 +1,228 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data.OleDb;
+
+using System.IO;
+
+namespace com.cloudsoft.utils
+{
+    /// <summary>
+    /// Database Parameters class.
+    /// Allows parameters to be added to a DBHelper.
+    /// Can only be instatiated from a DBHelper.
+    /// JF 12/2007 - DBParams can now represent either an OleDbCommand or an OleDbCommand. Which one 
+    /// is decided when it is created by DBHelper. Once it is created though the client doesn't need to 
+    /// know which one it is dealing with.
+    /// </summary>
+    public class DBParams
+    {
+        /// <summary>
+        /// DataType enumerator. 
+        /// </summary>
+        /// <remarks>
+        /// <list type="bullet">
+        /// <item><term>VarChar</term><description> - Varchar (string)</description></item>
+        /// <item><term>Long</term><description> - Long integer</description></item>
+        /// <item><term>Double</term><description> - Double (float)</description></item>
+        /// <item><term>DateTime</term><description> - Date</description></item>
+        /// <item><term>LongVarChar</term><description> - Clob</description></item>
+        /// </list>
+        /// </remarks>
+        public enum DataType {
+            /// <summary>Varchar</summary>
+            VarChar,
+            /// <summary>Long</summary>
+            Long,
+            /// <summary>Double</summary>
+            Double,
+            /// <summary>DateTime</summary>
+            DateTime,
+            /// <summary>LongVarChar</summary>
+            LongVarChar,
+            /// <summary>BLOB</summary>
+            BLOB,
+            /// <summary>Clob</summary>
+            Clob,
+            /// <summary>Xml</summary>
+            Xml
+        };
+
+        internal OleDbCommand Command;
+        /// <summary>
+        /// Oracle type equivalent of the oleType function. Returns the OleDbType from the general
+        /// DBParams.DataType.
+        /// </summary>
+        /// <param name="eDT">A non-provider specific datatype.</param>
+        /// <returns>An OleDbType.</returns>
+        private OleDbType _ODACType(DataType eDT)
+        {
+            switch (eDT)
+            {
+                case DataType.DateTime: return OleDbType.Date;
+                case DataType.Long: return OleDbType.Integer;
+                case DataType.Double: return OleDbType.Double;
+                case DataType.LongVarChar: return OleDbType.LongVarChar;
+                case DataType.BLOB: return OleDbType.LongVarBinary;
+                case DataType.Clob: return OleDbType.LongVarChar;
+                default: return OleDbType.VarChar;
+            }
+        }
+
+        /// <summary>
+        /// OleDbCommand based DBParams constructor.
+        /// </summary>
+        /// <param name="oCommand">The OleDbCommand to wrap.</param>
+        internal DBParams(OleDbCommand oCommand)
+        {
+            Command = oCommand;
+        }
+
+        /// <summary>
+        /// Add Parameter method for the OleDbCommand
+        /// </summary>
+        /// <param name="zParamName"></param>
+        /// <param name="eDT"></param>
+        public void add(String zParamName, DataType eDT, object value)
+        {
+            //Command.Parameters.Add(new OleDbParameter(zParamName, _ODACType(eDT), value, System.Data.ParameterDirection.Input));
+        }
+
+        /// <summary>
+        /// Adds a Input Parameter to the DBHelper
+        /// </summary>
+        /// <param name="zParamName">Parameter Name</param>
+        /// <param name="eDT">DataType</param>
+        /// <param name="iSize">Size of the parameter</param>
+        /// <param name="oValue">Value of the Parameter</param>
+        public void add(String zParamName, DataType eDT, int iSize, Object oValue)
+        {
+            
+            //Set the size to 1 for longvarchars...
+            if ((eDT == DataType.LongVarChar) && (oValue == null))
+                iSize = 1;
+        
+            //Ass the parameter...
+            Command.Parameters.Add(zParamName, _ODACType(eDT), iSize).Value = oValue;
+
+        }
+
+        /// <summary>
+        /// Adds a Input Parameter to the DBHelper without a value
+        /// </summary>
+        /// <param name="zParamName">Parameter Name</param>
+        /// <param name="eDT">DataType</param>
+        /// <param name="iSize">Size of the parameter</param>
+        public void add(String zParamName, DataType eDT, int iSize)
+        {
+            //Add the parameter...
+            Command.Parameters.Add(zParamName, _ODACType(eDT), iSize);
+        }
+
+        /// <summary>
+        /// Adds a Input Parameter to the DBHelper without a value or size
+        /// </summary>
+        /// <param name="zParamName">Parameter Name</param>
+        /// <param name="eDT">DataType</param>
+        /// <param name="iSize">Size of the parameter</param>
+        public void add(String zParamName, DataType eDT)
+        {
+            //Add the parameter...
+            Command.Parameters.Add(zParamName, _ODACType(eDT));
+        }
+
+
+        /// <summary>
+        /// Sets the input parameter value for a given parameter name
+        /// </summary>
+        /// <param name="zParamName">Parameter Name</param>
+        /// <param name="oValue">Value to set the input parameter to</param>
+        public void set(String zParamName, Object oValue)
+        {
+            //Set the parameter value...
+            Command.Parameters[zParamName].Value = oValue;
+        }
+
+        /// <summary>
+        /// Sets the input parameter value for a given parameter index
+        /// </summary>
+        /// <param name="index">Parameter Index</param>
+        /// <param name="oValue">Value to set the input parameter to</param>
+        public void set(int index, Object oValue)
+        {
+            //Set the parameter value...
+            Command.Parameters[index].Value = oValue;
+        }
+
+        public void set(int iParam, Object oValue, OleDbType iType)
+        {
+            OleDbParameter oParam = null;
+            if (Command.Parameters.Contains(iParam.ToString())) {
+                oParam = Command.Parameters[iParam.ToString()];
+                oParam.Value = oValue;
+            }
+            else
+            {
+                oParam = new OleDbParameter(iParam.ToString(), oValue);
+                if (iType != null)
+                    oParam.OleDbType = iType;
+                Command.Parameters.Add(oParam);
+            }
+            
+        }
+
+        /// <summary>
+        /// Adds an Output Parameter
+        /// </summary>
+        /// <param name="zParamName">Parameter Name</param>
+        /// <param name="eDT">Data Type</param>
+        /// <param name="iSize">Size of the parameter</param>
+        public void addOutput(String zParamName, DataType eDT, int iSize)
+        {
+            //Add the output parameter...
+            Command.Parameters.Add(zParamName, _ODACType(eDT), iSize).Direction = System.Data.ParameterDirection.Output;
+        }
+
+        /// <summary>
+        /// Exposes the Parameters for the OleDbCommand.
+        /// </summary>
+        /// <returns>OleDbParameterCollection</returns>
+        public OleDbParameterCollection ODACParameters()
+        {
+            return Command.Parameters;
+        }
+
+        /// <summary>
+        /// Closes the appropriate underlying connection.
+        /// </summary>
+        public void CloseConnection()
+        {
+            Command.Connection.Close();
+        }
+
+        /// <summary>
+        /// Closes the appropriate underlying command.
+        /// </summary>
+        public void CloseCommand()
+        {
+            Command.Connection.Dispose();
+            Command.Dispose();
+        }
+
+        /// <summary>
+        /// Executes the appropriate underlying command.
+        /// </summary>
+        /// <returns>int</returns>
+        public int ExecuteNonQuery()
+        {
+            return Command.ExecuteNonQuery();
+        }
+
+
+        public OleDbCommand AsOleDbCommand()
+        {    
+            return Command;
+        }
+
+    }
+}

+ 398 - 0
Utils/ErrHelper.cs

@@ -0,0 +1,398 @@
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.Win32;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Linq;
+
+namespace com.cloudsoft.utils
+{
+    /// <summary>
+    /// Base class for Business and data access options
+    /// </summary>
+    /// <remarks>
+    /// <example> Example code
+    /// <code>
+    /// public class Security_nTX : com.cloudsoft.utils.ErrHelper
+    /// {
+    ///    public Security_nTX() 
+    ///    {
+    ///        zgSystem = "GSK_SECURITY";
+    ///    }
+    ///    public String AuthoriseUserAction(String zPayload)
+    ///    {
+    ///        try
+    ///        {
+    ///            Security_DA oDA = new Security_DA();
+    ///            return oDA.AuthoriseUserAction(zPayload);
+    ///        }
+    ///       catch (Exception ex)
+    ///        {
+    ///            return handleError(ex);
+    ///        }
+    ///    }
+    /// </code>
+    /// </example>
+    /// </remarks>
+    public class ErrHelper
+    {
+
+        /// <summary>
+        /// Takes the params and builds a WI Error
+        /// </summary>
+        /// <param name="ex">The .Net Exception</param>
+        /// <param name="user">The context user</param>
+        /// <param name="request">The HTTP Request (values are extracted from this and added to the response)</param>
+        /// <returns>An xml helper with the WI Error</returns>
+        public XMLHelper toXMLHelper(Exception ex, string user, System.Web.HttpRequest request)
+        {
+
+            string path = request.Path;
+            NameValueCollection formParams = request.Form;
+            NameValueCollection querystringParams = request.QueryString;
+
+            XMLHelper oError = new XMLHelper("error");
+            oError.appendNode("user", user);
+            oError.appendNode("message", ex.Message);
+            oError.appendNode("path", path);
+            XMLHelper oValues = oError.appendNode("values");
+            XMLHelper oFormValues = oValues.appendNode("formvalues");
+            foreach (string key in formParams.AllKeys)
+            {
+                if (key != "__VIEWSTATE")
+                    oFormValues.appendNode("value", formParams[key].ToString()).appendAttribute("id", key);
+            }
+            XMLHelper oQuerystringValues = oValues.appendNode("querystringvalues");
+            foreach (string key in querystringParams.AllKeys)
+            {
+                oQuerystringValues.appendNode("value", querystringParams[key].ToString()).appendAttribute("id", key);
+            }
+            return oError;
+        }
+
+        /// <summary>
+        /// Returns HTML for a WI Error
+        /// </summary>
+        /// <param name="oError">WI compliant error</param>
+        /// <returns>HTML for a WI Error</returns>
+        public string getParamsHTML(XMLHelper oError)
+        {
+            StringBuilder sbParams = new StringBuilder("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
+            sbParams.Append("<tr><th colspan=\"2\" align=\"left\">Form values</th></tr>");
+            if (oError.nodeCount("values/formvalues/value") <= 0)
+            {
+                sbParams.Append("<tr><td colspan=\"2\" align=\"left\">None</td></tr>");
+            }
+            else
+            {
+                foreach (XMLHelper value in oError.getNodes("values/formvalues/value"))
+                {
+                    if (value.getString("@id") != "__VIEWSTATE")
+                        sbParams.Append("<tr><td>" + value.getString("@id") + "</td><td>" + value.getValue() + "</td></tr>");
+                }
+            }
+            sbParams.Append("<tr><th colspan=\"2\" align=\"left\"><hr/></th></tr>");
+            sbParams.Append("<tr><th colspan=\"2\" align=\"left\">Querystring values</th></tr>");
+            if (oError.nodeCount("values/querystringvalues/value") <= 0)
+            {
+                sbParams.Append("<tr><td colspan=\"2\" align=\"left\">None</td></tr>");
+            }
+            else
+            {
+                foreach (XMLHelper value in oError.getNodes("values/querystringvalues/value"))
+                {
+                    if (value.getString("@id") != "__VIEWSTATE")
+                        sbParams.Append("<tr><td>" + value.getString("@id") + "</td><td>" + value.getValue() + "</td></tr>");
+                }
+            }
+            sbParams.Append("</table>");
+            return sbParams.ToString();
+        }
+
+        /// <summary>
+        /// Logs an error using WI mechanisms, emailing if configured to do so
+        /// </summary>
+        /// <param name="oError">WI compliant error</param>
+        public void logError(XMLHelper oError)
+        {
+
+            short category = 4;
+            int id = 1;
+            
+            //Log the entry to the event log...
+            byte[] ba = System.Text.Encoding.UTF8.GetBytes(oError.getNode("values").getXML());
+            EventLog.WriteEntry(zgSystem, oError.getString("message") + " \rPath: " + oError.getString("path") + " \rUser: " + oError.getString("user"), EventLogEntryType.Error, id, category, ba);
+
+            //Send an email error notification if configured to do so...
+            if (ConfigurationManager.AppSettings.AllKeys.Contains("send_errors_by_email") && Convert.ToBoolean(ConfigurationManager.AppSettings["send_errors_by_email"]))
+            {
+                SendEmail(ConfigurationManager.AppSettings["errors_email"], Environment.MachineName + " WI Handled Error in: " + zgSystem, "<code>" + oError.getXML() + "</code>");
+            }
+
+        }
+
+        public void SendEmail(string to, string subject, string Message)
+        {
+            //UN_Mailer_EN ws = new UN_Mailer_EN();
+            //foreach (string t in to.Split(";".ToCharArray()))
+            //{
+            //    ws.SendEmail(t, subject, DateTime.Now.ToShortTimeString() + " - " + Message);
+            //}
+        }
+
+        /// <summary>
+        /// Enum for Error Types
+        /// </summary>
+        /// <remarks>
+        /// <list type="bullet">
+        /// <item><term>System</term><description> - System Error</description></item>
+        /// <item><term>Business</term><description> - Business Error</description></item>
+        /// <item><term>Information</term><description> - Information (not an error)</description></item>
+        /// </list>
+        /// </remarks>
+        public enum ErrorType {
+            /// <summary>System</summary> 
+            System,
+            /// <summary>Business</summary>
+            Business,
+            /// <summary>Information</summary>
+            Information
+        };
+
+        /// <summary>
+        /// The System. Used to log events
+        /// </summary>
+        private String _zgSystem;
+
+        public String zgSystem
+        {
+            get
+            {
+                return _zgSystem;
+            }
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ErrHelper"/> class.
+        /// </summary>
+        public ErrHelper()
+            : this("GSK")
+        { }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ErrHelper"/> class with a system.
+        /// </summary>
+        public ErrHelper(String zSystem)
+        {
+            _zgSystem = zSystem;
+        }
+
+        /// <summary>
+        /// Handles the error.
+        /// </summary>
+        /// <param name="ex">The Exception</param>
+        /// <returns>Nothing , but rethrows the error with formatted xml as the error message</returns>
+        public String handleError(Exception ex)
+        {
+            ErrorType et = ErrorType.System;
+            if (ex.Source == "Oledb")
+                et = ErrorType.Business;
+            return handleError(ex, et);
+        }
+
+        /// <summary>
+        /// Handles the error.
+        /// </summary>
+        /// <param name="ex">The Exception</param>
+        /// <param name="et">The error type. <see cref="ErrorType"/></param>
+        /// <returns>Nothing , but rethrows the error with formatted xml as the error message</returns>
+        public String handleError(Exception ex, ErrorType et)
+        {
+
+            //WADS: Detailed exception info no longer given to the user...
+            throw new Exception(et + " error : " + ex.Message);
+
+            //XMLHelper oError = new XMLHelper();
+            //if (oError.load(ex.Message) == false)
+            //{
+            //    String zType = "SYSTEMERROR";
+            //    switch (et)
+            //    {
+            //        case ErrorType.Business:
+            //            zType = "BUSINESSEXCEPTION";
+            //            break;
+            //        case ErrorType.Information:
+            //            zType = "INFORMATION";
+            //            break;
+            //    }
+            //    StackTrace oST = new StackTrace();
+            //    int iFrame = 1;
+            //    String zMethod = oST.GetFrame(iFrame).GetMethod().Name;
+            //    while (zMethod == "throwError" || zMethod == "handleError" || zMethod == "validatePayload")
+            //        zMethod = oST.GetFrame(iFrame++).GetMethod().Name;
+            //    oError.createRoot("gskutils");
+            //    oError = oError.appendNode("error");
+            //    oError.appendAttribute("time", DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss"));
+            //    oError.appendAttribute("type", zType);
+            //    oError.appendAttribute("class", this.GetType().ToString());
+            //    oError.appendAttribute("method", zMethod);
+            //    oError.appendNode("source", (ex.Source == null ? this.GetType().ToString() : ex.Source));
+            //    oError.appendNode("description", ex.Message);
+            //    oError.appendNode("stack_trace", ex.StackTrace);
+            //    if (zType == "SYSTEMERROR")
+            //        writeEvent(zgSystem, oError.getRootXML(), et);
+            //}
+            ////WADS: Error detail...
+            //logError(oError);
+            //throw new Exception("WI Handled error has occured. Please report to the helpdesk.");
+        }
+
+        /// <summary>
+        /// Throws a Business error.
+        /// </summary>
+        /// <param name="zMessage">The Business Error message.</param>
+        public void throwError(String zMessage)
+        {
+            throwError(zMessage, ErrorType.Business);
+        }
+        
+        /// <summary>
+        /// Throws an error.
+        /// </summary>
+        /// <param name="zMessage">The error message.</param>
+        /// <param name="et">The error type. <see cref="ErrorType"/></param>
+        public void throwError(String zMessage, ErrorType et)
+        {
+            handleError(new Exception(zMessage), et);
+        }
+        /// <summary>
+        /// Writes a debug message using the win32 api
+        /// </summary>
+        /// <param name="zMessage">The  message.</param>
+        public void debugMsg(Object zMessage)
+        {
+            String zMethod = new StackTrace().GetFrame(1).GetMethod().Name;
+            Debug.Write(this.GetType().Name + "." +  zMethod + " : " + zMessage);
+        }
+
+        public XMLHelper validatePayload(String zPayload)
+        {
+
+            XMLHelper domToLoad = new XMLHelper();
+
+            if (domToLoad.load(zPayload) == false)
+                throwError("Invalid Payload. XML is invalid");
+
+            // Get the calling Method
+            String zMethod = new StackTrace().GetFrame(1).GetMethod().Name;
+
+            return validatePayload(domToLoad, zMethod);
+
+        }
+
+        public XMLHelper validatePayload(XMLHelper oPayload)
+        {
+            // Get the calling Method
+            String zMethod = new StackTrace().GetFrame(1).GetMethod().Name;
+            return validatePayload(oPayload, zMethod);
+        }
+
+        /// <summary>
+        /// Validates the payload.
+        /// </summary>
+        /// <param name="zPayload">The payload.</param>
+        /// <returns>Returns an XML Helper DOM of the Payload</returns>
+        private XMLHelper validatePayload(XMLHelper oPayload, String zMethod)
+        {
+
+            XMLHelper domToLoad = oPayload;
+
+            String zRequestType = domToLoad.getString("/request/@type");
+            
+            // Check to see that payload is right for method
+            if (zRequestType == "")
+                throwError("The request does not have a type attribute");
+
+            // Check to see that payload is right for method
+            if (zMethod.ToUpper() != zRequestType.ToUpper() && (zRequestType.ToUpper() != "SYSTEM"))
+                throwError("The payload sent to the method " + zMethod + " is invalid. Not equal to " + zRequestType);
+        
+            // Build security payload xml
+            String zUsername = domToLoad.getString("mud_id");
+
+            if (domToLoad.getString("@sec") != "off")
+            {
+                XMLHelper oRequest = new XMLHelper().createStandardRequest("ValidatePayload", zUsername, domToLoad.getString("system"));
+                oRequest.appendNode("resource", zMethod.ToUpper());
+                oRequest.appendNode("action", "true");
+
+                // Create instance of security object
+                //Security_nTX oSecurity = new Security_nTX();
+
+                //// Check user rights
+                //XMLHelper oResponse = new XMLHelper();
+                //oResponse.load(oSecurity.AuthoriseUserAction(oRequest.getRootXML()));
+
+                //if (oResponse.getString("poReturnValue").StartsWith("TRUE") == false)
+                //    throwError("User '" + zUsername + "' does not have rights to perform the action '" + zMethod + "'.");
+                ////throwError("Request : " + oRequest.getXML() + " Response : " + oResponse.getXML());
+            }
+        
+            //Create System Audit
+            if (zRequestType != "SYSTEM")
+            {
+                //Set oAudit = CreateObject("GSKUtils.Auditor")
+                //If Len(zpPayload) < 2000 Then
+                    //oAudit.SystemAudit "CIMS", "Unknown", zpMethod, zUsername, zpPayload
+                //Else
+                  //  oAudit.SystemAudit "CIMS", "Unknown", zpMethod, zUsername
+                //End If
+            }
+            
+            return domToLoad;
+
+        }
+
+        /// <summary>
+        /// Writes to the event log.
+        /// </summary>
+        /// <param name="zSource">The source.</param>
+        /// <param name="zMessage">The message.</param>
+        /// <param name="et">The Error type</param>
+        private void writeEvent(String zSource, String zMessage, ErrorType et)
+        {
+            RegistryKey kLM = Registry.LocalMachine;
+            String zLogDir;
+            lock (kLM)
+            {
+                RegistryKey kSystem = kLM.OpenSubKey("Software\\GlaxoWellcome\\" + zSource);
+                zLogDir = (String)kSystem.GetValue("ErrorLog");
+                if (zLogDir == null)
+                {
+                    kSystem = kLM.OpenSubKey("Software\\GlaxoWellcome\\UN");
+                    zLogDir = (String)kSystem.GetValue("ErrorLog");
+                }
+            }
+
+            if (zLogDir != null)
+            {
+                try
+                {
+                    StreamWriter osw;
+                    FileInfo ofi = new FileInfo(zLogDir + "\\error.log");
+                    if (!ofi.Exists)
+                        osw = ofi.CreateText();
+                    else
+                        osw = ofi.AppendText();
+
+                    osw.WriteLine(zMessage);
+                    osw.Close();
+                }
+                catch { }
+            }
+        }
+    }
+}

+ 1294 - 0
Utils/UIHelper.cs

@@ -0,0 +1,1294 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using com.cloudsoft.utils;
+using System.Text;
+using System.Collections.Generic;
+
+/// <summary>
+/// Delegate defining the interface for BizRule
+/// </summary>
+public delegate String BizRule(string zRequest);
+
+/// <summary>
+/// Delegate defining the interface for BizRule
+/// </summary>
+public delegate XMLHelper XMLBizRule(XMLHelper oRequest);
+
+/// <summary>
+/// Delegate defining the interface for BizRule
+/// </summary>
+public delegate StringBuilder CSVBizRule(XMLHelper oRequest);
+
+namespace com.cloudsoft.utils
+{
+    /// <summary>
+    /// UI Helper class. Extends System.Web.UI.Page
+    /// Should be used as the extention class in a aspx cs class.
+    /// </summary>
+    public class UIHelper : System.Web.UI.Page
+    {
+        /// <summary>
+        /// Gets or sets the gprev page Global variable.
+        /// </summary>
+        /// <value>The gprev page.</value>
+        public String gPrevPage 
+        { 
+            get { return getSyncKey("gPrevPage"); } 
+            set { setSyncKey("gPrevPage", value); } 
+        }
+        /// <summary>
+        /// Gets or sets the Global method variable.
+        /// </summary>
+        /// <value>The method.</value>
+        public String zgMethod 
+        { 
+            get { return getSyncKey("gMethod"); } 
+            set { setSyncKey("gMethod", value); } 
+        }
+        /// <summary>
+        /// Gets or sets the Global current tab variable.
+        /// </summary>
+        /// <value>The current tab.</value>
+        public String gCurrentTab 
+        { 
+            get { return getSyncKey("gCurrentTab"); } 
+            set { setSyncKey("gCurrentTab", value); } 
+        }
+        /// <summary>
+        /// Gets or sets the type of the Global page variable usied for paging.
+        /// </summary>
+        /// <value>The Page number for paging</value>
+        public String zgPageType 
+        { 
+            get { return getSyncKey("zgPageType"); } 
+            set { setSyncKey("zgPageType", value); } 
+        }
+        /// <summary>
+        /// Gets or sets the Global user id (MUD ID).
+        /// </summary>
+        /// <value>The MUD ID.</value>
+        public virtual String zgUser 
+        { 
+            get { return getSyncKey("gUserID"); } 
+            set { setSyncKey("gUserID", value); } 
+        }
+        /// <summary>
+        /// The Root Directory for the web
+        /// </summary>
+        public String zgRootDirectory = "";
+        /// <summary>
+        /// The page title
+        /// </summary>
+        public String zgPageTitle = "";
+        /// <summary>
+        /// The Full root web directory (eg. http://bresawn0123/cims)
+        /// </summary>
+        public String zgFullRootWeb = "";
+        /// <summary>
+        /// The Root of the web (eg. /cims)
+        /// </summary>
+        public String zgRootWeb = "";
+        /// <summary>
+        /// Array of Months
+        /// </summary>
+        public String[] arygMonths = new String[] {"January","February","March","April","May","June","July","August","September","October","November","December"};
+        /// <summary>
+        /// An Array of slow business rules to be executed
+        /// </summary>
+        public String[] aSlowRules = new String[] {};
+        /// <summary>
+        /// Array of returned XML from slow business rules
+        /// </summary>
+        public String[] aSlowXML = new String[] {};
+        /// <summary>
+        /// The Global system (eg. cims). Should be overridden
+        /// </summary>
+        public String zgSystem = "cims";
+        /// <summary>
+        /// Branding XML
+        /// </summary>
+        public XMLHelper oBranding = null;
+        /// <summary>
+        /// Current page
+        /// </summary>
+        public String gCurrentPage = "";
+        /// <summary>
+        /// The Name displayed in the title for branding
+        /// </summary>
+        public String zgGlobalName = "";
+        /// <summary>
+        /// The Object which raised an error
+        /// </summary>
+        public String zgErr_Object = "";
+        /// <summary>
+        /// The Method which raised an error
+        /// </summary>
+        public String zgErr_Method = "";
+        /// <summary>
+        /// Determins whether the user is a superuser
+        /// </summary>
+        public Boolean gbSuperUser = false;
+        /// <summary>
+        /// Determines whether menu security should be used
+        /// </summary>
+        public String zgSecurity = "ON";
+        /// <summary>
+        /// Determines whether tasks should be shown
+        /// </summary>
+        public Boolean zbShowTasks = false;
+        /// <summary>
+        /// Default rows per page
+        /// </summary>
+        public int zgRowsPerPage = 20;
+
+        /// <summary>
+        /// Location of the Framework web
+        /// </summary>
+        public String zgFrameworkWeb = "/WI3/";
+        /// <summary>
+        /// Full location of the framework web (eg. http://bresawnv0123/wi3)
+        /// </summary>
+        public String zgFullFrameworkWeb = "";
+
+
+        private DateTime gdStart;
+        public Boolean bTopCalled = false;
+        private Hashtable oSyncKeys = new Hashtable();
+        private Boolean bInLoad = false;
+
+        /// <summary>
+        /// Raises the System.Web.UI.Control.Init event to initialize the page.
+        /// </summary>
+        /// <param name="e">An System.EventArgs that contains the event data.</param>
+        override protected void OnInit(EventArgs e)
+        {
+            // Load SyncKeys from the Application Definition
+            loadSyncKeys();
+
+            zgRootDirectory = Request.MapPath("~");
+            zgRootWeb = Request.ApplicationPath + "/";
+            zgUser = RequestP("zgUser");
+
+            //WADS: Secure connections...
+            string protocolPrepend = "http://";
+            if (HttpContext.Current.Request.IsSecureConnection)
+                protocolPrepend = "https://";
+
+            zgFullRootWeb = protocolPrepend + Request.ServerVariables["HTTP_HOST"].ToString() + zgRootWeb;
+            zgFullFrameworkWeb = protocolPrepend + Request.ServerVariables["SERVER_NAME"].ToString() + zgFrameworkWeb;
+
+            if (Session["MudID"] != null)
+	        {
+		        if (zgUser == "")
+                    zgUser = (String) Session["MudID"];
+	        }
+	        else
+	        {
+		        if (zgUser == "")
+                {
+                    zgUser = Request.ServerVariables["LOGON_USER"];
+                    zgUser = zgUser.Substring(zgUser.IndexOf('\\')+1).ToUpper();
+                }
+	        }
+	        Session["MudID"] = zgUser;
+
+            gdStart = DateTime.Now;
+            //zgFrameworkDirectory = Request.MapPath(zgFrameworkWeb) + "\\";
+            gPrevPage = RequestP("gPrevPage");
+            gCurrentPage = Request.ServerVariables["PATH_INFO"].ToUpper();
+            if (gCurrentPage == gPrevPage)
+	            gCurrentTab = RequestP("gCurrentTab");
+
+            zgMethod =  RequestP("gMethod");
+
+            // ----------------------------
+            // Page Type Setting
+            // ----------------------------
+            //	MENU:		Menu Navigation Page
+            //				Full branding, Top Menu & Side Menu
+            //	TABSET:		Tab Control Set Navigation Page
+            //				Full branding, Top Menu, Side Menu or Side TabControl
+            //	CONTENT:	Content only (tab)
+            //				No Branding, no top menu, no side menu or side tab control
+            //
+            if (zgPageType == "")
+            {
+                zgPageType = RequestF("zgPageType");
+                switch (zgPageType)
+                {
+	                case "MENU":
+	                case "CONTENT":
+	                case "TABSET":
+		                break;
+	                default:
+		                zgPageType = "MENU";
+		                break;
+                } 
+            }
+
+            base.OnInit(e);
+            
+        }
+
+
+        /// <summary>
+        /// Determines whether an error is a UI error
+        /// </summary>
+        /// <param name="err">The Exception</param>
+        /// <returns>
+        /// 	<c>true</c> if is UI error; otherwise, <c>false</c>.
+        /// </returns>
+        public Boolean isUIError(Exception err) 
+        {
+            Boolean boolIsError = false;
+            //switch (err.number) 
+            //{
+            //    case -2147221005:
+        		
+            //        boolIsError = true;
+            //        break;
+            //    default:
+            //        boolIsError = false;
+            //        break;
+            //}
+	        return boolIsError;
+        }
+
+
+// ============================================================================
+// Business Rule Execution (Logic Functions)
+// ============================================================================
+
+        /// <summary>
+        /// Bubbles an event up to the loadorder if required 
+        /// </summary>
+        public void LoadOrderBubble()
+        { 
+
+	        String zLoadOrder = RequestQS("loadorder");
+        	
+	        if (!(zLoadOrder == "None" || zLoadOrder == null) && (zgPageType == "CONTENT"))
+	        {
+		        Response.Write("<script language=\"JavaScript\">");
+                //WADS: Cross site scripting...
+		        Response.Write("parent.fnLoad" + zLoadOrder + "(frameElement.id);");
+		        Response.Write("</script>");
+	        }
+
+        }
+
+// ============================================================================
+// TabControl Functions
+// ============================================================================
+
+
+        /// <summary>
+        /// Writes the html for the chosen tabcontrol
+        /// </summary>
+        /// <param name="zMenu">Name of the Menu (in this case, a page of tabcontrols) to write (will filter on security if set on)</param>
+        /// <param name="zTabControl">Name of the TabControl to write</param>
+        public void writeTabControl(String zMenu, String zTabControl)
+        {
+            XMLHelper oXML = getMenuDOM(zMenu);
+	        if (oXML != null) 
+	        {
+                oXML.getNode("/toplevel/navigation/menu[@id='" + zTabControl + "']").transform(zgFullFrameworkWeb +  "xsl/UN_TabControl_SC.xsl", Response.Output);
+	        }
+        }
+
+
+
+        // ============================================================================
+        // Sync Key Functions
+        // ============================================================================
+
+
+        /// <summary>
+        /// write SyncKeys to Hidden Fields Should be overriden to include another systems sync keys
+        /// </summary>
+        public virtual void loadSyncKeys()
+        {
+            // Add your SyncKeys Here
+            SyncKey("gPrevPage");
+            SyncKey("gMethod");
+            SyncKey("gCurrentTab");
+            SyncKey("zgPageType");
+            SyncKey("gUserID");
+            SyncKey("gdeleteID");
+        }
+
+        /// <summary>
+        /// Sets a Sync key.
+        /// </summary>
+        /// <param name="zName">Name of the Sync Key</param>
+        public void SyncKey(String zName) 
+        {
+            String zValue = Server.HtmlEncode(Request.Params[zName]);
+            if (zValue == null)
+                zValue = "";
+
+            if (!oSyncKeys.ContainsKey(zName))
+                oSyncKeys.Add(zName, zValue);
+            else
+	            oSyncKeys[zName] = zValue;
+        }	
+
+
+        /// <summary>
+        /// Gets a sync key.
+        /// </summary>
+        /// <param name="zName">Name of Sync Key</param>
+        /// <returns>The value of the Sync Key</returns>
+        public String getSyncKey(String zName)
+        {
+	        return (String) oSyncKeys[zName];
+        }
+
+        /// <summary>
+        /// Sets the sync key.
+        /// </summary>
+        /// <param name="zName">Name of the Sync Key</param>
+        /// <param name="zValue">The value to set the Sync Key to.</param>
+        public void setSyncKey(String zName, String zValue)
+        {
+            oSyncKeys[zName] = zValue;
+        }
+
+        /// <summary>
+        /// Write / update syncKeys on the client
+        /// </summary>
+        public void writeSyncKeys() 
+        {
+	        foreach (String zSyncKey in oSyncKeys.Keys)
+	        {
+		        Response.Write("\t setSyncKey(\"" + zSyncKey + "\", \"" + oSyncKeys[zSyncKey] + "\");\n");
+	        }
+        }
+
+        /// <summary>
+        /// Write syncKeys as hidden fields on the client.
+        /// </summary>
+        /// <param name="zPageType">The Page Type</param>
+        public void writeSyncKeysToInput(String zPageType) 
+        {
+            setSyncKey("zgPageType", zPageType);
+	        foreach (String zSyncKey in oSyncKeys.Keys)
+	        {
+		        Response.Write("<input type=\"hidden\" name=\"" + zSyncKey + "\" value=\"" + oSyncKeys[zSyncKey] + "\" />\n");
+	        }
+        }	
+
+
+// ============================================================================
+// Paging
+// ============================================================================
+
+
+// --------------------------------------------------------------
+// Function:	createPaging
+// Purpose:		Create a DB paged response (list)
+// Outputs:		
+//				
+// --------------------------------------------------------------	
+        /// <summary>
+        /// Creates paging HTML.
+        /// </summary>
+        /// <param name="lCurrentPage">The current page.</param>
+        /// <param name="lRows">The total number of rows.</param>
+        /// <param name="lRowsPerPage">The rows per page.</param>
+        public string createPaging(int lCurrentPage, int lRows, int lRowsPerPage)
+        {
+
+            StringBuilder sb = new StringBuilder();
+
+	        int i;
+	        int lPageSet;
+	        int lFirst;
+	        int lLast;
+	        int lPages = 0;
+        	
+	        if (lRows > 0)
+		        lPages = ((lRows-1) / lRowsPerPage)+1;
+
+	        if ((lCurrentPage == 0) || (lPages == 0))
+		        return "";
+
+            lPageSet = ((lCurrentPage-1) / 10) + 1;
+	        lFirst = ((lPageSet-1) * 10) + 1;
+	        lLast = lPageSet * 10;
+	        if (lLast > lPages)
+		        lLast = lPages;
+
+            sb.Append("<table width='100%'>\r\n");
+            sb.Append("<tr>\r\n");
+            sb.Append("<td align=\"left\"><font face=\"Verdana,Arial\" size=\"1\">Currently viewing page ");
+            sb.Append(lCurrentPage + " out of ");
+            sb.Append((lPages == 200) ? "at least 200" : lPages + " pages.</font></td>\r\n");
+            sb.Append("<td alight=\"right\">Total found : " + lRows);
+            if (lPages==200)
+                sb.Append("+");
+            sb.Append("</td></tr>\r\n");
+            sb.Append("<tr><td colspan=\"2\">\r\n");
+            sb.Append("<table><tr>\r\n");
+	        if (lPageSet > 1)
+	        {
+                sb.Append("<td class=\"nextprev\"><a HREF=\"Javascript: document.forms[0].Page.value=" + (lFirst - 10) + ";document.forms[0].Button_clicked.value=true;document.forms[0].submit()\"><font face=\"marlett\">33</font>prev 10</a> </td>\r\n");
+	        }
+            for (i=lFirst; i < lLast+1; i++)
+            {
+		        if (i > 0 && i <= lPages)
+		        {
+			        if (i == lCurrentPage)
+			        {
+                        sb.Append("<td class=\"pageno\">[" + i + "]</td>\r\n");
+			        }
+			        else
+			        {
+                        sb.Append("<td class=\"pageno\"><a HREF=\"Javascript: document.forms[0].Page.value=" + i + ";document.forms[0].Button_clicked.value=true;document.forms[0].submit()\">" + i + "</a></td>\r\n");
+			        }
+		        }
+	        }
+
+	        if (lLast < lPages)
+	        {
+                sb.Append("<td class=\"nextprev\"><a HREF=\"Javascript: document.forms[0].Page.value=" + (lLast + 1) + ";document.forms[0].Button_clicked.value=true;document.forms[0].submit()\">next 10<font face=\"marlett\">44</font></a></td>\r\n");
+	        }
+            sb.Append("</tr></table>\r\n");
+            sb.Append("</td></tr>\r\n");
+            sb.Append("</table>\r\n");
+
+            return sb.ToString();
+
+        }
+
+
+// ============================================================================
+// Select Dropdown Utilities
+// ============================================================================
+
+        public String generateSelectionMonth(String name)
+        {
+            return generateSelectionMonth(name, null);
+        }
+
+        /// <summary>
+        /// Build a month select dropdown
+        /// </summary>
+        /// <param name="name">Name of the Select Tag</param>
+        /// <param name="selected">Month to be preselected </param>
+        /// <returns>HTML for select Month</returns>
+        public String generateSelectionMonth(String name, String selected)
+        {
+
+            DateTime now = DateTime.Now;
+            String arg = selected;
+
+            String output = "";
+            int pos = 0;
+            int current = 0;
+
+            // Need to determine the current month - number ie Oct is 9 in the array
+            if (arg != "" && arg != null)
+            {
+                String aArg1 = arg.Split(new Char[] { ' ' })[0];
+                String[] aArg = aArg1.Split(new Char[] { '-' });
+                if (arg.Length == 2)
+                    current = Convert.ToInt32(arg) - 1;
+                else
+                {
+                    for (pos = 0; pos < arygMonths.Length; pos++)
+                    {
+                        if (aArg[1].Substring(0, 3).ToUpper() == arygMonths[pos].Substring(0, 3).ToUpper())
+                            break;
+                    }
+                    current = pos;
+                }
+            }
+            else
+                current = now.Month - 1;
+
+            // Write the Select tag
+            output = "<select name=\'" + name + "\'>";
+
+            // Now add the options for each month
+            for (int i = 0; i < arygMonths.Length; i++)
+            {
+                output += "<option value=\'";
+                output += i < 9 ? "0" + Convert.ToString(i + 1) : Convert.ToString(i + 1);
+                output += "\'";
+                output += (current == i) ? " selected='true'" : "";
+                output += ">" + arygMonths[i] + "</option>";
+            }
+
+            //Now close the select
+            output += "</select>";
+            return output;
+
+        }
+
+        public String generateSelectionYear(String name, int yearsForward, int yearsBack)
+        {
+            return generateSelectionYear(name, yearsForward, yearsBack, null);
+        }
+
+        /// <summary>
+        /// Build a year select dropdown
+        /// </summary>
+        /// <param name="name">Name of the Select Tag</param>
+        /// <param name="yearsForward">Number of years in the future to include</param>
+        /// <param name="yearsBack">Number of years in the past to include</param>
+        /// <param name="selected">Year to be preselected</param>
+        /// <returns>HTML for select Month</returns>
+        public String generateSelectionYear(String name, int yearsForward, int yearsBack, String selected)
+        {
+
+            DateTime now = DateTime.Now;
+            String arg = selected;
+            int current = now.Year;
+            int start = current - yearsBack;
+            int end = current + yearsForward;
+            String output = "";
+
+            //Check to see if a year is already selected, also check if the selected year is 
+            //greater than the end if if so make the end the selected year
+            if (arg != null)
+            {
+                String aArg1 = arg.Split(new Char[] { ' ' })[0];
+                String[] aArg = aArg1.Split(new Char[] { '-' });
+                if (aArg.Length > 0 && aArg[0] != "")
+                {
+                    if (arg.Length == 4)
+                    {
+                        current = Convert.ToInt32(arg);
+                    }
+                    else
+                    {
+                        current = Convert.ToInt32(aArg[2]);
+                    }
+                }
+            }
+
+            if (current > end)
+                end = current;
+
+            // Write the Select tag
+            output = "<select name=\'" + name + "\'>";
+
+            // Now add the options for each month
+            for (start = start + 0; start <= end; start++)
+            {
+                output += "<option value=\'" + start + "\'";
+                output += current == start ? " selected='true'" : "";
+                output += ">" + start + "</option>";
+            }
+            //Now close the select
+            output += "</select>";
+            return output;
+
+        }
+
+
+        /// <summary>
+        /// Generates the select value= tag for a select box setting selected=true if the value = previous
+        /// </summary>
+        /// <param name="zValue">The value of the select option.</param>
+        /// <param name="zPrevious">The value to compare.</param>
+        /// <returns>Option attributes</returns>
+        public String getOption(String zValue, String zPrevious)
+        {
+	        String sReturn = "value=\"" + zValue + "\"";
+	        if (zValue == zPrevious)
+		        sReturn += " selected=\"true\"";
+	        return sReturn;
+        }
+
+
+
+        /// <summary>
+        /// Standard look and field header.
+        /// Should be called between a head html section of a web page
+        /// </summary>
+        /// <param name="zpPageTitle">The Page Title.</param>
+        /// <param name="zDep1">Dummy parameter for backward compatibility</param>
+        /// <param name="zDep2">Dummy parameter for backward compatibility</param>
+        public void Brand_Head(String zpPageTitle, String zDep1, String zDep2)
+        {
+            Brand_Head(zpPageTitle);
+        }
+
+        /// <summary>
+        /// Standard look and field header.
+        /// Should be called between a head html section of a web page
+        /// </summary>
+        /// <param name="zpPageTitle">The Page Title.</param>
+        /// <param name="zDep1">Dummy parameter for backward compatibility</param>
+        public virtual void Brand_Head(String zpPageTitle, String zDep1)
+        {
+            Brand_Head(zpPageTitle);
+        }
+
+        /// <summary>
+        /// Standard look and field header.
+        /// Should be called between a head html section of a web page
+        /// </summary>
+        /// <param name="zpPageTitle">The Page Title.</param>
+        public void Brand_Head(String zpPageTitle)
+        {
+            Response.Write(Brand_Head(zpPageTitle, true));
+        }
+
+        /// <summary>
+        /// Standard look and field header.
+        /// Should be inserted between a head html section of a web page
+        /// </summary>
+        /// <param name="zpPageTitle">The Page Title.</param>
+        public string Brand_Head(String zpPageTitle, Boolean ReturnMode)
+        {
+            
+            try
+            {
+
+                zgPageTitle = zpPageTitle;
+
+                StringBuilder sb = new StringBuilder();
+                
+                //WADS REQUIREMENT: 5.1.1
+                sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
+                
+                sb.Append("<link href=\"" + zgFullFrameworkWeb + "Styles/style.css\" rel=\"stylesheet\" type=\"text/css\" />");
+                sb.Append("<title>" + zgSystem + "_" + zpPageTitle + "</title>");
+                sb.Append("<script>");
+                sb.Append("   zgRootWeb = \"" + zgRootWeb + "\";");
+                sb.Append("</script>");
+                sb.Append("<script language=\"Javascript\" src=\"" + zgFullFrameworkWeb + "Javascript/CommonUtils.js\"></script>");
+                
+                return sb.ToString();
+
+            }
+            catch 
+            {
+                return "";
+            }
+
+        }
+
+        /// <summary>
+        /// Standard Look and field body
+        /// Should be called between a body html section of a web page
+        /// </summary>
+        /// <param name="zMenu">The side menu to display</param>
+        /// <param name="zDep">Dummy parameter for backward compatibility</param>
+        public void Brand_BodyTop(String zMenu, String zDep)
+        {
+            Brand_BodyTop(zMenu);
+        }
+
+        /// <summary>
+        /// Standard Look and field body
+        /// Should be called between a body html section of a web page
+        /// </summary>
+        /// <param name="zMenu">The side menu to display</param>
+        /// <param name="zSearch">Dummy parameter for backward compatibility</param>
+        /// <param name="bRenderTabCtrl">Dummy parameter for backward compatibility</param>
+        public void Brand_BodyTop(String zMenu, String zSearch, Boolean bRenderTabCtrl)
+        {
+            Brand_BodyTop(zMenu);
+        }
+
+        /// <summary>
+        /// Gets the menu DOM.
+        /// </summary>
+        /// <param name="zMenu">The menu name to obrain the DOM for</param>
+        /// <returns>An XMLHelper DOM with the menu in it</returns>
+        public XMLHelper getMenuDOM(String zMenu)
+        {
+            XMLHelper oMenu = null;
+            if (Session["MenuXML"] == null)
+            {
+                String zFile = Request.MapPath("~/" + "menu/" + zgSystem + "Menu.xml");
+                oMenu = new XMLHelper();
+                oMenu.load(zFile);
+
+                if (zgSecurity == "ON")
+                {
+                    XMLHelper oRequest = newRequest("BuildUIMenu");
+                    //Security_nTX oSec = new Security_nTX();
+                    //String zResponse = oSec.GetUserResources(oRequest.getRootXML());
+                    //XMLHelper oResponse = new XMLHelper();
+                    //oResponse.load(zResponse);
+                    //Session.Add("UserResources", oResponse);
+                    //oResponse.appendNode(oMenu.getNode("/toplevel"));
+                    ////oMenu = oResponse.transform(zgFullFrameworkWeb + "xsl/FilterSideMenu.xsl");
+                    ////WADS: Secure connections (can't establish secure connection from app)...
+                    //oMenu = oResponse.transform("http://localhost/wi3/xsl/FilterSideMenu.xsl");
+                }   
+
+                Session.Add("MenuXML", oMenu);
+
+            }
+            else
+            {
+                oMenu = (XMLHelper)Session["MenuXML"];
+            }
+            return oMenu;
+        }
+
+        /// <summary>
+        /// Standard Look and field body
+        /// Should be called between a body html section of a web page
+        /// </summary>
+        /// <param name="zMenu">The side menu to display</param>
+        public virtual void Brand_BodyTop(String zMenu)
+        {
+            try
+            {
+                bTopCalled = true;
+                XMLHelper oMenu = getMenuDOM(zMenu);                
+                String zXSL = Request.MapPath("~/" + "menu/" + zgSystem + "Branding.xsl");
+                Dictionary<string, string> aParams = new Dictionary<string, string>();
+                aParams.Add("param1", zgSystem);
+                aParams.Add("param2", zMenu);
+                aParams.Add("param3", zgRootWeb);
+                aParams.Add("param4", zgFullFrameworkWeb);
+                aParams.Add("param5", zgPageTitle);
+                oBranding = oMenu.transform(zXSL, aParams);
+                 
+                XMLHelper oHead = oBranding.getNode("head");
+                Response.Write(oHead.getInnerXML());
+
+                Response.Write("<table width=\"100%\" xxbgcolor=\"#FFFFFF\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-top: 1px\">");
+	            Response.Write("<tr>");
+        	    
+                // Get the left menu XML
+                if (!zMenu.Equals(""))
+                {
+                    XMLHelper oSide = oBranding.getNode("side");
+                    Response.Write(oSide.getInnerXML());
+                }
+
+                Response.Write("<td width=\"100%\" align=\"left\" valign=\"top\">");
+		        Response.Write("<table width=\"100%\" align=\"left\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">");
+                XMLHelper oTitle = oBranding.getNode("title");
+                Response.Write(oTitle.getInnerXML());
+                Response.Write("<tr>\r\n");
+                Response.Write("<td colspan=\"" + oTitle.nodeCount("tr/td") + "\" valign=\"Top\">\r\n");
+                Response.Write("<div style=\"padding-bottom: 8px; padding-top: 10px; padding-left:8px; padding-right:8px; width:100%; \">\r\n");
+            }
+            catch {}
+        }
+
+        /// <summary>
+        /// Standard Look and field Footer
+        /// Should be called between at just before the closing body html section of a web page
+        /// </summary>
+        public virtual void Brand_BodyBottom()
+        {
+            try
+            {
+                // ------------------------
+                // Write Sync Keys to 
+                // hidden input fields
+                // ------------------------
+                gPrevPage = gCurrentPage;
+                writeSyncKeysToInput(zgPageType);
+                // ------------------------
+                // Bubble to load order 
+                // if required
+                // ------------------------
+                LoadOrderBubble();
+
+                if (bTopCalled)
+                {
+                    Response.Write("            </div>\r\n");
+                    Response.Write("        </td>\r\n");
+                    Response.Write("    </tr>\r\n");
+                    Response.Write("</table>\r\n");
+                    Response.Write("</td>\r\n");
+                    Response.Write("</tr>\r\n");
+                    Response.Write("</table>\r\n");
+                    XMLHelper oBottom = oBranding.getNode("bottom");
+                    Response.Write(oBottom.getInnerXML());
+                }
+                Response.Write("<script language = \"javascript\">");
+                if (bTopCalled)
+                {
+                    Response.Write("try { divGlobalName.innerHTML = \"" + zgGlobalName + "\"; } catch (ex) {} \r\n");
+
+                    DateTime dEnd = DateTime.Now;
+                    TimeSpan tDiff = dEnd.Subtract(gdStart);
+                    String zDiff = "";
+                    if (tDiff.Seconds < 1)
+                        zDiff = tDiff.Milliseconds + " milliseconds";
+                    else
+                        zDiff = tDiff.TotalSeconds + " seconds";
+
+                    Response.Write("try { document.getElementById(\"idCopyright\").title = \"Render Time : " + zDiff + "\"; } catch (ex) {} ");
+
+                }
+
+                //write sync key information to page
+                writeSyncKeys();
+
+                Response.Write("</script>");
+
+            }
+            catch {}
+        }
+
+        /// <summary>
+        /// Transforms the XML with the given XSL file.
+        /// </summary>
+        /// <param name="xmlFile">The XML file or XML String.</param>
+        /// <param name="xslFile">The XSL file.</param>
+        /// <returns>The Transformed XML String</returns>
+        public String transformXML(String xmlFile, String xslFile)
+        {
+            return transformXML(xmlFile, xslFile, new Dictionary<string, string>());
+        }
+
+        /// <summary>
+        /// Transforms the XML with the given XSL file.
+        /// </summary>
+        /// <param name="xmlFile">The XML file or XML String.</param>
+        /// <param name="xslFile">The XSL file.</param>
+        /// <param name="aParams">An array of Parameters to pass to the XSL stylesheet.</param>
+        /// <returns>The Transformed XML String</returns>
+        public String transformXML(String xmlFile, String xslFile, Dictionary<string, string> aParams)
+        {
+            StringWriter oString = new StringWriter();
+            XMLHelper oDOM = new XMLHelper();
+            if (xmlFile.StartsWith("<"))
+                oDOM.load(xmlFile);
+            else
+                oDOM.load(Request.MapPath("~/" + xmlFile));
+            if (xslFile.Substring(0,5).Contains(":"))
+                oDOM.transform(xslFile, aParams, oString);
+            else
+                oDOM.transform(Request.MapPath("~/" + xslFile), aParams, oString);
+            return oString.ToString();
+        }
+
+        /// <summary>
+        /// Transforms the DOM with the given XSL file.
+        /// </summary>
+        /// <param name="oDOM">An XMLHelper document</param>
+        /// <param name="xslFile">The XSL file.</param>
+        public void transformXML(XMLHelper oDOM, String xslFile)
+        {
+            oDOM.transform(Request.MapPath("~/" + xslFile), Response.Output);
+        }
+
+        /// <summary>
+        /// Transforms the DOM with the given XSL file.
+        /// </summary>
+        /// <param name="oDOM">An XMLHelper document</param>
+        /// <param name="xslFile">The XSL file.</param>
+        /// <param name="aParams">An array of Parameters to pass to the XSL stylesheet.</param>
+        public void transformXML(XMLHelper oDOM, String xslFile, Dictionary<string, string> aParams)
+        {
+            oDOM.transform(Request.MapPath("~/" + xslFile), aParams, Response.Output);
+        }
+
+        /// <summary>
+        /// Creates a standard request DOM with the resource, system and user (MUD ID).
+        /// </summary>
+        /// <param name="zResource">The resource (method) of the request.</param>
+        /// <returns>A standard request DOM with the resource, system and user</returns>
+        public XMLHelper newRequest(String zResource)
+        {
+            XMLHelper oXML = new XMLHelper();
+            oXML.createStandardRequest(zResource, zgUser, zgSystem.ToUpper());
+            if (zgSecurity == "OFF")
+                oXML.appendAttribute("sec", "off");
+            return oXML;
+        }
+
+        /// <summary>
+        /// Loads a DOM with the XML file or XML String.
+        /// </summary>
+        /// <param name="zXML">The XML string or file.</param>
+        /// <returns>An XML helper DOM</returns>
+        public XMLHelper loadDOM(String zXML)
+        {
+            XMLHelper oDOM = new XMLHelper();
+            oDOM.load(zXML);
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Gets a standard request DOM using the Request.Form and Request.QueryString parameters.
+        /// </summary>
+        /// <param name="zResource">The resource (method) for the request.</param>
+        /// <returns>An XMLHelper DOM containing the Request.Form and Request.QueryString parameters.</returns>
+        public XMLHelper getRequestDOM(String zResource)
+        {
+            XMLHelper oDOM = newRequest(zResource);
+            oDOM.appendNode(Request.Form);
+            oDOM.appendNode(Request.QueryString);
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Gets a request DOM using the Request.Form and Request.QueryString parameters.
+        /// </summary>
+        /// <returns>An XMLHelper DOM containing the Request.Form and Request.QueryString parameters.</returns>
+        public XMLHelper getRequestDOM()
+        {
+            XMLHelper oDOM = new XMLHelper("request");
+            oDOM.appendNode(Request.Form);
+            oDOM.appendNode(Request.QueryString);
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Gets the request DOM with Request.QueryString parameters.
+        /// </summary>
+        /// <returns>An XMLHelper DOM containing Request.QueryString parameters.</returns>
+        public XMLHelper getRequestQueryDOM()
+        {
+            XMLHelper oDOM = new XMLHelper("request");
+            oDOM.appendNode(Request.QueryString);
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Gets the request DOM with Request.Form parameters.
+        /// </summary>
+        /// <returns>An XMLHelper DOM containing Request.Form parameters</returns>
+        public XMLHelper getRequestFormDOM()
+        {
+            XMLHelper oDOM = new XMLHelper("request");
+            oDOM.appendNode(Request.Form);
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Executes a business method returning a DOM.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="oRequest">The Request DOM.</param>
+        /// <returns>An XMLHelper response DOM</returns>
+        public XMLHelper executeBizMethodDOM(BizRule oMethod, XMLHelper oRequest)
+        {
+            return executeBizMethodDOM(oMethod, oRequest.getRootXML(), true);
+        }
+
+        /// <summary>
+        /// Executes a business method returning a DOM.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="zRequestXML">The request XML.</param>
+        /// <returns>An XMLHelper response DOM</returns>
+        public XMLHelper executeBizMethodDOM(BizRule oMethod, String zRequestXML)
+        {
+            return executeBizMethodDOM(oMethod, zRequestXML, true);
+        }
+
+        /// <summary>
+        /// Executes a business method returning a DOM.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="zRequestXML">The request XML.</param>
+        /// <param name="bDisplayErrors">if set to <c>true</c> [automatically display errors].</param>
+        /// <returns>An XMLHelper response DOM</returns>
+        public XMLHelper executeBizMethodDOM(BizRule oMethod, String zRequestXML, Boolean bDisplayErrors)
+        {
+            XMLHelper oDOM = new XMLHelper();
+            oDOM.load(executeBizMethod(oMethod, zRequestXML, bDisplayErrors));
+            return oDOM;
+        }
+
+        /// <summary>
+        /// Executes a business method returning an XML String.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="oRequest">The Request DOM.</param>
+        /// <returns>The response dom as a string</returns>
+        public String executeBizMethod(BizRule oMethod, XMLHelper oRequest)
+        {
+            return executeBizMethod(oMethod, oRequest.getRootXML(), true);
+        }
+
+        /// <summary>
+        /// Executes a business method returning an XML String.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="zRequestXML">The request XML.</param>
+        /// <returns>The response dom as a string</returns>
+        public String executeBizMethod(BizRule oMethod, String zRequestXML)
+        {
+            return executeBizMethod(oMethod, zRequestXML, true);
+        }
+
+        /// <summary>
+        /// Executes a business method returning an XML String.
+        /// </summary>
+        /// <param name="oMethod">The Bizrule method.</param>
+        /// <param name="zRequestXML">The request XML.</param>
+        /// <param name="bDisplayErrors">if set to <c>true</c> [automatically display errors].</param>
+        /// <returns></returns>
+        public String executeBizMethod(BizRule oMethod, String zRequestXML, Boolean bDisplayErrors)
+        {
+
+            try
+	        {
+		        return oMethod(zRequestXML);
+        	}
+	        catch (Exception ex)
+	        {
+                if (bDisplayErrors != false)
+                {
+                    //WADS: Detailed exception info no longer given to the user...
+                    throw new Exception("You cannot give detailed exception info to the user");
+                }
+                else
+                {
+                    throw ex;
+                }
+        	}
+        }
+
+        /// <summary>
+        /// Executes a business method returning an XML String.
+        /// </summary>
+        /// <param name="oMethod">The XMLBizrule method.</param>
+        /// <param name="zRequestXML">The request XML.</param>
+        /// <param name="bDisplayErrors">if set to <c>true</c> [automatically display errors].</param>
+        /// <returns></returns>
+        public XMLHelper executeBizMethod(XMLBizRule oMethod, XMLHelper oRequest, Boolean bDisplayErrors)
+        {
+
+            if (bDisplayErrors == true)
+            {
+                try
+                {
+                    return oMethod(oRequest);
+                }
+                catch (Exception ex)
+                {
+                    if (bDisplayErrors != false)
+                    {
+                        if (ex.Message.Substring(0,9) == "ORA-20000")
+                        {
+                            throw ex;
+                        }
+                        else
+                        {
+                        //WADS: Detailed exception info no longer given to the user...
+                        throw new Exception("You cannot give detailed exception info to the user");
+                        }
+                    }
+                    else
+                    {
+                        throw ex;
+                    }
+                }
+            }
+            else
+            {
+                return oMethod(oRequest);
+            }
+
+        }
+
+        public StringBuilder executeBizMethod(CSVBizRule oMethod, XMLHelper oRequest)
+        {
+
+            return oMethod(oRequest);
+
+        }
+
+        /// <summary>
+        /// Displays an error message
+        /// </summary>
+        /// <param name="ex">The Exception to handle.</param>
+        public void handleError(Exception ex)
+        {
+            handleError(ex, null);
+        }
+
+        /// <summary>
+        /// Displays an error message
+        /// </summary>
+        /// <param name="ex">The Exception to handle.</param>
+        /// <param name="zRequestXML">The Exception to handle.</param>
+        public void handleError(Exception ex, String zRequestXML)
+        {
+            //WADS: Detailed exception info no longer given to the user...
+            throw new Exception("You cannot give detailed exception info to the user");
+        }
+
+        /// <summary>
+        /// Validates the number.
+        /// </summary>
+        /// <param name="zInput">The Number to check.</param>
+        /// <returns>Converted number as a string</returns>
+        public String validNumber(String zInput)
+        {
+            try
+            {
+                return Convert.ToDouble(zInput).ToString();
+            }
+            catch
+            {
+                return "";
+            }
+        }
+        
+        /// <summary>
+        /// Returns a default of the checked value is null otherwise it returns a the value to check
+        /// </summary>
+        /// <param name="oCheck">Value to check.</param>
+        /// <param name="zDefault">The default.</param>
+        /// <returns>Either the Checked value or the default depending on whether the checked value is null</returns>
+        public String ifNull(Object oCheck, String zDefault)
+        {
+            if (oCheck == null)
+                return zDefault;
+            else
+                return oCheck.ToString();
+        }
+        
+        /// <summary>
+        /// Returns a default of the checked value is null otherwise it returns a the value to check
+        /// </summary>
+        /// <param name="oCheck">Value to check.</param>
+        /// <param name="iDefault">The default.</param>
+        /// <returns>Either the Checked value or the default depending on whether the checked value is null</returns>
+        public int ifNull(Object oCheck, int iDefault)
+        {
+            if (oCheck == null)
+                return iDefault;
+            else
+                return Convert.ToInt32(oCheck);
+        }
+
+        /// <summary>
+        /// Determines whether the user has a given resource.
+        /// </summary>
+        /// <param name="zResourceName">Name of the resource to check.</param>
+        /// <returns>
+        /// 	<c>true</c> if the user has the given resource; otherwise, <c>false</c>.
+        /// </returns>
+        public Boolean hasSecurityResource(String zResourceName)
+        {
+            XMLHelper oDOM = (XMLHelper)Session["UserResources"];
+            if (oDOM == null)
+                return false;
+            if (oDOM.nodeCount("//resource[@name='" + zResourceName.ToUpper() + "']") == 0)
+                return false;
+            else
+                return true;
+        }
+        //========================================================================================
+        //                  W A D S
+        //========================================================================================
+        public String RequestQS(String input)
+        {
+            String strCheck = ifNull(Request.QueryString[input], "");
+            return Server.HtmlEncode(strCheck);
+        }
+        public int RequestQS(String input, int intDefault)
+        {
+            return ifNull(Request.QueryString[input], 0);
+        }
+        public String RequestF(String input)
+        {
+            String strCheck = ifNull(Request.Form[input], "");
+            return Server.HtmlEncode(strCheck);
+        }
+        public int RequestF(String input, int intDefault)
+        {
+            return ifNull(Request.Form[input], 0);
+        }
+        public String RequestFGet(String input)
+        {
+            String strCheck = ifNull(Request.Form.Get(input), "");
+            return Server.HtmlEncode(strCheck);
+        }
+        public String RequestP(String input)
+        {
+            String strCheck = ifNull(Request.Params[input], "");
+            return Server.HtmlEncode(strCheck);
+        }
+        public String RequestWADS(String input, String strDefault)
+        {
+            String strCheck = ifNull(Request[input], strDefault);
+            return Server.HtmlEncode(strCheck);
+        }
+        public String RequestWADS(String input)
+        {
+            String strCheck = ifNull(Request[input], "");
+            return Server.HtmlEncode(strCheck);
+        }
+        public int RequestWADS(String input, int intDefault)
+        {
+            return ifNull(Request[input], 0);
+        }
+        public String RequestCookies(String section, String input)
+        {
+            String strCookie = "";
+            try
+            {
+                strCookie = Request.Cookies[section][input];
+            }
+            catch (Exception ex)
+            {
+                strCookie = "";
+            }
+            return Server.HtmlEncode(strCookie);
+        }
+        public String RequestXML(String input)
+        // for xml strings do nothing for now; Server.HtmlEncode corrupts xml stings
+        {
+            String strCheck = ifNull(Request[input], "");
+            return strCheck;
+        }
+
+        public XMLHelper serialisePost()
+        {
+            XMLHelper oRequest = new XMLHelper("request");
+            oRequest.appendNode("system", zgSystem);
+            if (zgSecurity == "OFF") oRequest.appendAttribute("sec", "off");
+            foreach (String s in Request.Form)
+            {
+                if (s != null)
+                {
+                    if (s[0] == '_')
+                    {
+                        if (s.Length > 1)
+                        {
+                            oRequest.appendAttribute(s.Substring(1), Request.Form[s]);
+                        }
+                    }
+                    else
+                    {
+                        //Sync Key
+                        if (s.StartsWith("g_"))
+                        {
+                            String zField = s.Substring(2);
+                            if (ifNull(Request.Form[zField], "") == "")
+                                oRequest.setNode(zField, Request.Form[s]);
+                        }
+                        else
+                        {
+                            oRequest.setNode(s, Request.Form[s]);
+
+                        }
+                    }
+                }
+            }
+            return oRequest;
+        }
+    }
+}

+ 1403 - 0
Utils/XMLHelper.cs

@@ -0,0 +1,1403 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Data.OleDb;
+
+using System.Text.RegularExpressions;
+
+namespace com.cloudsoft.utils
+{
+
+    /// <summary>
+    /// Class contains methods for constructing and querying XML doms
+    /// </summary>
+    /// 
+    public class XMLHelper
+    {
+
+        // Declare module level variables
+        /// <summary>The Node that this XMLHelper wraps</summary>
+        protected XmlNode omNode;
+        protected Boolean isValidXml = true;
+        public String ValidationError;
+        private static String _QUOTE = "\"";
+        private Regex _DatePattern = null;
+        private Regex _DoublePattern = null;
+        internal OleDbConnection _con = null;
+
+        #region Constructors
+
+        /// <summary>Creates a new instance of XMLHelper </summary>
+        public XMLHelper()
+        {
+        }
+
+        /// <summary>
+        /// Creates a new instance of XMLHelper with the base node set
+        /// </summary>
+        /// <param name="zRoot">The root node to create or an XML Document to load</param>
+        public XMLHelper(String zRoot)
+        {
+            if (zRoot.Contains("<") || zRoot.Contains("&#60;") || zRoot.Contains("\\"))
+                //WADS: Cross site scripting...
+                load(zRoot);
+            else
+                //WADS: XPath Injection...
+                createRoot(zRoot);
+        }
+
+        public XMLHelper(StringBuilder zRoot)
+        {
+            load(zRoot);
+        }
+
+        public XMLHelper(Stream stream)
+        {
+            load(stream);
+        }
+
+        /// <summary>
+        /// Creates a new instance of XMLHelper with the base node set
+        /// </summary>
+        /// <param name="oNode">The base node to set</param>
+        public XMLHelper(XmlNode oNode)
+        {
+            omNode = oNode;
+        }
+
+        /// <summary>
+        /// Creates a new instance of XMLHelper with the base node set to the first child of the Document
+        /// </summary>
+        /// <param name="oDoc">Document to base this XMLHelper on</param>
+        public XMLHelper(XmlDocument oDoc)
+        {
+            omNode = (XmlNode)oDoc.DocumentElement;
+        }
+
+        #endregion
+
+        #region IO & Save Methods
+
+        /// <summary>
+        /// Saves the dom to the specified path. Always overwrites anything already there.
+        /// </summary>
+        /// <param name="path">The path to save to.</param>
+        public void SaveAs(String path)
+        {
+
+            try
+            {
+                //Overwrite any existing files...
+                FileInfo fi = new FileInfo(path);
+                if (fi.Exists)
+                    fi.Delete();
+            }
+            catch
+            {
+                //If you can't delete the file then don't try and overwrite it...
+                return;
+            }
+
+            StreamWriter sw = new StreamWriter(path);
+            try
+            {
+
+                //Set up a stream...
+                sw.AutoFlush = true;
+
+                //Write to the stream and close it...
+                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
+                sw.Write(this.getXML());
+
+            }
+            finally
+            {
+                sw.Close();
+                sw.Dispose();
+            }
+
+        }
+
+        #endregion
+
+        #region "Helper" methods
+
+        /// <summary>
+        /// Creates a Standard Request DOM
+        /// </summary>
+        /// <param name="zType">The type of request</param>
+        /// <param name="zMudID">The mud id</param>
+        /// <param name="zSystem">The system id</param>
+        /// <returns></returns>
+        public XMLHelper createStandardRequest(String zType, String zMudID, String zSystem)
+        {
+            return createStandardRequest(zType, zMudID, zSystem, zMudID);
+        }
+
+        /// <summary>
+        /// Handles delegation
+        /// </summary>
+        /// <param name="zType"></param>
+        /// <param name="zMudID"></param>
+        /// <param name="zSystem"></param>
+        /// <param name="UserLogon"></param>
+        /// <returns></returns>
+        public XMLHelper createStandardRequest(String zType, String zMudID, String zSystem, String UserLogon)
+        {
+            this.createRoot("request");
+            this.appendAttribute("type", zType);
+            this.appendNode("mud_id", zMudID);
+            this.appendNode("system", zSystem);
+
+            string zDeligateUser = UserLogon;
+            string[] aSplit = zDeligateUser.Split("\\".ToCharArray());
+            zDeligateUser = aSplit[aSplit.Length - 1].ToUpper();
+
+            if (zMudID != zDeligateUser)
+                this.appendNode("delegate_id", zDeligateUser);
+
+            return this;
+        }
+
+        #endregion
+
+        #region Dom Manipulation
+
+        /// <summary>
+        /// Creates the root Node
+        /// </summary>
+        /// <param name="zRootName">The name of the root node</param>
+        public void createRoot(String zRootName)
+        {
+            //WADS: XPath Injection...
+            this.load("<" + zRootName + "/>");
+        }
+
+        /// <summary>
+        /// Appends a node to the dom
+        /// </summary>
+        /// <param name="vNodeName">The name of the new node</param>
+        /// <returns>Returns an XMLHelper of the new Node</returns>
+        public XMLHelper appendNode(String vNodeName)
+        {
+            XmlDocument oDoc = omNode.OwnerDocument;
+            XmlNode oNewNode = oDoc.CreateElement(vNodeName);
+            omNode.AppendChild(oNewNode);
+            XMLHelper oHelper = new XMLHelper(oNewNode);
+            return oHelper;
+        }
+
+        /// <summary>
+        /// Appends a node to the dom and sets it's value
+        /// </summary>
+        /// <param name="vNodeName">The name of the new node</param>
+        /// <param name="zValue">The value to set the new node</param>
+        /// <returns>Returns the XMLHelper for the new node</returns>
+        public XMLHelper appendNode(String vNodeName, Object zValue)
+        {
+            XmlDocument oDoc = omNode.OwnerDocument;
+            XmlNode oNewNode = oDoc.CreateElement(vNodeName);
+            oNewNode.AppendChild(oDoc.CreateTextNode(zValue == null ? "" : zValue.ToString()));
+            omNode.AppendChild(oNewNode);
+            XMLHelper oHelper = new XMLHelper(oNewNode);
+            return oHelper;
+        }
+
+        /// <summary>
+        /// Appends an XMLHelper dom
+        /// </summary>
+        /// <param name="oDOM">The DOM to append to this DOM</param>
+        /// <returns>Returns the XMLHelper for the new node</returns>
+        public XMLHelper appendNode(XMLHelper oDOM)
+        {
+            XmlNode oNew = omNode.OwnerDocument.ImportNode(oDOM.omNode, true);
+            omNode.AppendChild(oNew);
+            return new XMLHelper(oNew);
+        }
+
+        /// <summary>
+        /// Appends a NameValueCollection to the DOM as Nodes
+        /// </summary>
+        /// <param name="oCol">The DOM to append to this DOM</param>
+        public void appendNode(NameValueCollection oCol)
+        {
+            // Iterate through the collection and add
+            // each name value pair to the dom
+            for (int i = 0; i < oCol.Count; i++)
+            {
+                String zName = oCol.GetKey(i);
+                String[] pValues = oCol.GetValues(i);
+                for (int j = 0; j < pValues.Length; j++)
+                    appendNode(zName, pValues[j]);
+            }
+        }
+
+        /// <summary>
+        /// Appends an array of XMLHelpers
+        /// </summary>
+        /// <param name="oNodes">The Nodelist to append to the existing DOM</param>
+        public void appendNode(XMLHelper[] oNodes)
+        {
+            for (int i = 0; i < oNodes.Length; i++)
+                appendNode(oNodes[i]);
+        }
+
+        /// <summary>
+        /// Appends an attribute to the dom and sets it's value
+        /// </summary>
+        /// <param name="zNodeName">The name of the new node</param>
+        /// <param name="zValue">The value to set the new node</param>
+        public void appendAttribute(String zNodeName, String zValue)
+        {
+            //        Attr oAttr = omNode.getOwnerDocument().createAttribute(zNodeName);
+            //        oAttr.setNodeValue(zValue);
+            //        omNode.appendChild(oAttr);
+            XmlElement oNode = (XmlElement)omNode;
+            oNode.SetAttribute(zNodeName, zValue);
+        }
+
+        /// <summary>
+        /// Retrieved the root node of a XMLHelper dom
+        /// </summary>
+        /// <returns>Returns the Root Node for this XMLHelper DOM</returns>
+        public XMLHelper getRootNode()
+        {
+            return new XMLHelper(omNode.OwnerDocument);
+        }
+
+        public void appendXPathNode(String zXPath, String zValue)
+        {
+            appendXPathNode(zXPath, zValue, true);
+        }
+
+        /// <summary>
+        /// Appends a node/attribute based on an XPath (like alias names in SQL)
+        /// </summary>
+        /// <param name="zXPath">The name of the new node/attribute in XPath syntax</param>
+        /// <param name="zValue">The value to set the new node</param>
+        public void appendXPathNode(String zXPath, String zValue, Boolean AlwaysAddNewNode)
+        {
+            try
+            {
+                int i;
+                XmlNode oOrig = omNode;
+                // Split the Name by "/"
+                String[] arrNodes = zXPath.Split(new char[] { '/' });
+                for (i = 0; i < arrNodes.Length - 1; i++)
+                {
+                    XmlNode oNode = omNode.SelectSingleNode(arrNodes[i]);
+                    if (oNode == null)
+                        omNode = appendNode(arrNodes[i]).omNode;
+                    else
+                        omNode = oNode;
+                }
+                if (arrNodes[i].StartsWith("@"))
+                    appendAttribute(arrNodes[i].Substring(1), zValue);
+                else
+                {
+                    if (AlwaysAddNewNode)
+                    {
+                        appendNode(arrNodes[i], zValue);
+                    }
+                    else
+                    {
+                        if (this.nodeCount(arrNodes[i]) > 0)
+                        {
+                            this.getNode(arrNodes[i]).setValue(zValue);
+                        }
+                        else
+                        {
+                            appendNode(arrNodes[i], zValue);
+                        }
+                    }
+                }
+                omNode = oOrig;
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine(ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// Removes a node given the nodename
+        /// </summary>
+        /// <param name="zNodeName">The name of node to remove</param>
+        public void removeNode(String zNodeName)
+        {
+            try
+            {
+                XmlNode oTempNode = omNode.SelectSingleNode(zNodeName);
+                if (oTempNode != null)
+                    oTempNode.ParentNode.RemoveChild(oTempNode);
+            }
+            catch
+            {
+                // Do nothing if we can't remove the node
+            }
+
+        }
+
+        #endregion
+
+        #region Serialisation
+
+        /// <summary>
+        /// Searalises the current tree from the current Node to a Writer (like Resonse.Output)
+        /// </summary>
+        /// <param name="oWriter">The Writer to write the XML to (eg. Resonse.Output)</param>
+        public void serializeNode(TextWriter oWriter)
+        {
+            try
+            {
+                serializeNode(omNode, oWriter);
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine(ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// Serializes the node.
+        /// </summary>
+        /// <param name="oNode">The node.</param>
+        /// <param name="oWriter">The writer.</param>
+        private void serializeNode(XmlNode oNode, TextWriter oWriter)
+        {
+            try
+            {
+                oWriter.Write(oNode.OuterXml);
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine(ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// Serializes the node.
+        /// </summary>
+        /// <param name="oNode">The node.</param>
+        /// <returns>An XML String</returns>
+        private String serializeNode(XmlNode oNode)
+        {
+            try
+            {
+                return (oNode.OuterXml);
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine(ex.Message);
+                return ("");
+            }
+        }
+
+        public String getJSON()
+        {
+            StringWriter stringOut = new StringWriter();
+            getJSON(stringOut);
+            return (stringOut.ToString());
+        }
+        public void getJSON(TextWriter oOut)
+        {
+            oOut.Write("{");
+            getJSON(omNode.OwnerDocument.FirstChild, false, oOut);
+            oOut.Write("}");
+        }
+
+        private void getJSON(XmlNode oNode, Boolean isArray, TextWriter oOut)
+        {
+            String zName = oNode.Name;
+            if (zName.Equals("#text")) zName = "$";
+            if (!isArray)
+                oOut.Write(_QUOTE + zName + _QUOTE + ":");
+            if (isJSONArray(oNode.ChildNodes))
+            {
+                oOut.Write("[");
+                getJSON(oNode.ChildNodes, true, oOut);
+                oOut.Write("]");
+            }
+            else if (oNode.NodeType == XmlNodeType.Attribute)
+            {
+                oOut.Write(getJSONValue(oNode.Value));
+            }
+            else if (!oNode.HasChildNodes && (oNode.Attributes == null || oNode.Attributes.Count == 0))
+            {
+                if (oNode.Value == null)
+                    oOut.Write("null");
+                else
+                    oOut.Write(getJSONValue(oNode.Value));
+            }
+            else if (oNode.Attributes.Count == 0 && oNode.ChildNodes.Count == 1 && !oNode.FirstChild.HasChildNodes)
+            {
+                oOut.Write(getJSONValue(oNode.FirstChild.Value));
+            }
+            else
+            {
+                oOut.Write("{");
+                getJSON(oNode.Attributes, oOut);
+                if (oNode.Attributes.Count > 0 && oNode.ChildNodes.Count > 0)
+                    oOut.Write(",");
+                getJSON(oNode.ChildNodes, false, oOut);
+                oOut.Write("}");
+            }
+        }
+        private void getJSON(XmlNodeList oNodeList, Boolean isArray, TextWriter oOut)
+        {
+            for (int i = 0; i < oNodeList.Count; i++)
+            {
+                XmlNode oNode = oNodeList.Item(i);
+                if (i > 0) oOut.Write(",");
+                getJSON(oNode, isArray, oOut);
+            }
+        }
+        private void getJSON(XmlAttributeCollection oNodeMap, TextWriter oOut)
+        {
+            for (int i = 0; i < oNodeMap.Count; i++)
+            {
+                XmlNode oNode = oNodeMap.Item(i);
+                if (i > 0) oOut.Write(",");
+                getJSON(oNode, false, oOut);
+            }
+        }
+        private String getJSONValue(String zValue)
+        {
+            zValue = zValue.Trim();
+            if (DatePattern().IsMatch(zValue))
+            {
+                DateTime matchDate = DateTime.Now;
+                try { matchDate = DateTime.Parse(zValue); }
+                catch (Exception ex) { }
+                String ret = "new Date(" + matchDate.Year + "," + (matchDate.Month - 1) + "," + matchDate.Day;
+                if (zValue.Length > 11)
+                    ret += "," + matchDate.Hour + "," + matchDate.Minute + "," + matchDate.Second;
+                ret += ")";
+                return ret;
+            }
+            else if (zValue.Length <= 10)
+            {
+                try { return int.Parse(zValue).ToString(); }
+                catch (Exception ex) { }
+                if (DoublePattern().IsMatch(zValue))
+                    return zValue;
+                //try { return Double.Parse(zValue).ToString();}
+                //catch (Exception ex) {}
+            }
+            return _QUOTE + zValue.Replace("\\", "\\\\").Replace("\"", "\\\"") + _QUOTE;
+        }
+
+        private Boolean isJSONArray(XmlNodeList oNodeList)
+        {
+            if (oNodeList.Count < 1 || (oNodeList.Count == 1 && (oNodeList.Item(0).Name + "s") != oNodeList.Item(0).ParentNode.Name)) return (false);
+            String zName = oNodeList.Item(0).Name;
+            for (int i = 0; i < oNodeList.Count; i++)
+            {
+                if (!oNodeList.Item(i).Name.Equals(zName))
+                    return (false);
+            }
+            return (true);
+        }
+        private Regex DatePattern()
+        {
+            if (_DatePattern == null)
+            {
+                _DatePattern = new Regex("^(([0-9])|([0-2][0-9])|([3][0-1]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\\d{4}.*", RegexOptions.IgnoreCase);
+            }
+            return _DatePattern;
+        }
+        private Regex DoublePattern()
+        {
+            if (_DoublePattern == null)
+            {
+                _DoublePattern = new Regex("^[-+]?[0-9]*\\.?[0-9]+$");
+            }
+            return _DoublePattern;
+        }
+
+        #endregion
+
+        #region Load Methods
+
+        /// <summary>
+        /// Loads a string into the DOM or a file. Either an XML string or a file location may be used
+        /// </summary>
+        /// <param name="zXML">Either the XML as a string or a file location</param>
+        /// <returns>Boolean indicating success or failure</returns>
+        public Boolean load(String zXML)
+        {
+            try
+            {
+                XmlDocument oDOM = new XmlDocument();
+                if (zXML.StartsWith("<") || zXML.StartsWith("&#60;"))
+                    //WADS: XPath Injection...
+                    oDOM.LoadXml(zXML);
+                else
+                    //WADS: XPath Injection...
+                    oDOM.Load(zXML);
+                omNode = (XmlNode)oDOM.DocumentElement;
+                return true;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("Can't load dom. Error: " + ex.Message);
+            }
+        }
+
+        public Boolean load(Stream stream)
+        {
+            try
+            {
+                XmlDocument oDOM = new XmlDocument();
+                oDOM.Load(stream);
+                omNode = (XmlNode)oDOM.DocumentElement;
+                return true;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("Can't load dom. Error: " + ex.Message);
+            }
+        }
+
+        public Boolean load(StringBuilder zXML)
+        {
+            try
+            {
+                StringReader sr = new StringReader(zXML.ToString());
+                XmlReader xr = XmlReader.Create(sr);
+                XmlDocument oDOM = new XmlDocument();
+                oDOM.Load(xr);
+                omNode = (XmlNode)oDOM.DocumentElement;
+                return true;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("Can't load dom. Error: " + ex.Message);
+            }
+        }
+        public Boolean loadTSV(String zPath)
+        {
+            try
+            {
+                // Create an instance of StreamReader to read from a file.
+                // The using statement also closes the StreamReader.
+                this.createRoot("response");
+                XMLHelper oRows = this.appendNode("rows");
+                using (StreamReader sr = new StreamReader(zPath))
+                {
+                    String[] aHeader = null;
+                    String line;
+                    // Read and display lines from the file until the end of 
+                    // the file is reached.
+                    while ((line = sr.ReadLine()) != null)
+                    {
+                        // Get the header if we don't have it
+                        if (aHeader == null)
+                        {
+                            aHeader = line.Split('\t');
+                        }
+                        else
+                        {
+                            String[] aFields = line.Split('\t');
+                            int i = 0;
+                            XMLHelper oRow = oRows.appendNode("row");
+                            foreach (String zHeader in aHeader)
+                                oRow.appendNode(zHeader, aFields[i++]);
+                        }
+                    }
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                // Let the user know what went wrong.
+                throw new Exception("The file could not be read: " + e.Message);
+            }
+        }
+        #endregion
+
+        #region Get and Set Methods
+
+        /// <summary>
+        /// Retrieved the child nodes an XMLHelper dom
+        /// </summary>
+        /// <returns>Returns the Child nodes as an array</returns>
+        public XMLHelper[] getChildNodes()
+        {
+            XmlNodeList oNodes = omNode.ChildNodes;
+            XMLHelper[] arrNodes = new XMLHelper[oNodes.Count];
+            for (int i = 0; i < oNodes.Count; i++)
+                arrNodes[i] = new XMLHelper(oNodes.Item(i));
+            return arrNodes;
+        }
+        public XMLHelper getFirstChild()
+        {
+            return new XMLHelper(omNode.FirstChild);
+        }
+
+        public DateTime getSQLDate(String zXPath)
+        {
+            return getDate(zXPath);
+
+        }
+        public DateTime getSQLDateTime(String zXPath)
+        {
+            return getDate(zXPath);
+        }
+        /// <summary>
+        /// Gets the XML of the current node as a string
+        /// </summary>
+        /// <returns>Returns the XML of the current node as a string</returns>
+        public String getXML()
+        {
+            return serializeNode(omNode);
+        }
+
+        /// <summary>
+        /// Gets the InnerXML of the current node as a string
+        /// </summary>
+        /// <returns>Returns the InnerXML of the current node as a string</returns>
+        public String getInnerXML()
+        {
+            return omNode.InnerXml;
+        }
+
+        /// <summary>
+        /// Gets the XML of the root node as a string
+        /// </summary>
+        /// <returns>Returns the XML of the root node as a string</returns>
+        public String getRootXML()
+        {
+            return omNode.OwnerDocument.OuterXml;
+        }
+
+        /// <summary>
+        /// Get the parent XMLHelper
+        /// </summary>
+        /// <returns>Returns the Parent node as an XMLHelper object</returns>
+        public XMLHelper getParent()
+        {
+            XMLHelper oHelper = new XMLHelper(omNode.ParentNode);
+            return oHelper;
+        }
+
+        /// <summary>
+        /// Returns the Name of a node or element
+        /// </summary>
+        /// <returns>The node name of the current node</returns>
+        public String getName()
+        {
+            try
+            {
+                return omNode.Name;
+            }
+            catch (Exception)
+            {
+
+                return "";
+            }
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element
+        /// JF 12/2007 - Added a check for a null valued XMLHelper (with a null omNode)
+        /// rather than relying on the exception handler.
+        /// </summary>
+        /// <returns>The nodevalue of the current node</returns>
+        public String getValue()
+        {
+            if (omNode != null)
+            {
+                try
+                {
+                    return omNode.InnerText;
+                }
+                catch (Exception)
+                {
+                    return "";
+                }
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a string
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a string</returns>
+        public String getValue(String zXPath)
+        {
+            return getNode(zXPath).getValue();
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a string
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a string</returns>
+        public String getString(String zXPath)
+        {
+            return getValue(zXPath);
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a long
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a long</returns>
+        public long getLong(String zXPath)
+        {
+            try
+            {
+                return Convert.ToInt64(getValue(zXPath).Trim());
+
+            }
+            catch (Exception)
+            {
+
+                return 0;
+            }
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as an int
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as an int</returns>
+        public int getInt(String zXPath)
+        {
+            try
+            {
+                String value = getValue(zXPath).Trim();
+                if (value.Length > 0)
+                {
+                    return Convert.ToInt32(value);
+                }
+                else
+                {
+                    return 0;
+                }
+
+            }
+            catch (Exception)
+            {
+
+                return 0;
+            }
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a double
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a double</returns>
+        public double getDouble(String zXPath)
+        {
+            try
+            {
+                return Convert.ToDouble(getValue(zXPath).Trim());
+            }
+            catch
+            {
+                return 0.0;
+            }
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a DateTime Object
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a DateTime Object</returns>
+        public DateTime getDate(String zXPath)
+        {
+            DateTime d = DateTime.MinValue;
+            try
+            {
+                DateTime.TryParse(getValue(zXPath).Trim(), out d);
+            }
+            catch { }
+            return d;
+
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as a Boolean
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a Boolean</returns>
+        public Boolean getBoolean(String zXPath)
+        {
+            String zVal = getValue(zXPath).ToUpper();
+            return (zVal.Equals("Y") || zVal.Equals("YES") || zVal.Equals("TRUE"));
+        }
+
+        /// <summary>
+        /// Returns the value of a node or element as either Y or N
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>The nodevalue of the Node found as a Boolean</returns>
+        public String getYN(String zXPath)
+        {
+            return (getBoolean(zXPath) ? "Y" : "N");
+        }
+        /// <summary>
+        /// Returns an XMLHelper for a XPath
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>XMLHelper for a XPath</returns>
+        public XMLHelper getNode(String zXPath)
+        {
+            XmlNode oNode;
+            try
+            {
+                oNode = omNode.SelectSingleNode(zXPath);
+                return new XMLHelper(oNode);
+            }
+
+            catch
+            {
+                // JF 12/2007 - Don't just blindly return an empty XMLHelper if the getNode fails.
+                // Should create an alternative function for this purpose if it is ever required. 
+                throw new Exception("Can't get node for xpath: " + zXPath);
+            }
+        }
+
+        /// <summary>
+        /// Returns an Array of XMLHelper objects for a XPath
+        /// </summary>
+        /// <param name="zXPath">A valid XPath to find a node</param>
+        /// <returns>Array of XMLHelper object for a XPath</returns>
+        public XMLHelper[] getNodes(String zXPath)
+        {
+            try
+            {
+                XmlNodeList oNodes = omNode.SelectNodes(zXPath);
+                XMLHelper[] arrNodes = new XMLHelper[oNodes.Count];
+                for (int i = 0; i < oNodes.Count; i++)
+                    arrNodes[i] = new XMLHelper(oNodes.Item(i));
+                return arrNodes;
+
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine(ex.Message);
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Gets a CSV string given an XPath
+        /// </summary>
+        /// <param name="zXPath">The XPath.</param>
+        /// <returns>A CSV String</returns>
+        public String getCSV(String zXPath)
+        {
+            StringWriter oSW = new StringWriter();
+            XmlNodeList oNodes = omNode.SelectNodes(zXPath);
+            for (int i = 0; i < oNodes.Count; i++)
+            {
+                if (i > 0)
+                    oSW.Write(',');
+                oSW.Write(oNodes[i].InnerText);
+            }
+            return oSW.ToString();
+        }
+
+        /// <summary>
+        /// Sets a Nodes value
+        /// </summary>
+        /// <param name="zNodeName">The name of the node to set</param>
+        /// <param name="zValue">The value to set the node</param>
+        public void setNode(String zNodeName, String zValue)
+        {
+            removeNode(zNodeName);
+            appendNode(zNodeName, zValue);
+        }
+
+        /// <summary>
+        /// Sets a Nodes value
+        /// </summary>
+        /// <param name="zNodeName">The name of the node to set</param>
+        /// <param name="zValue">The value to set the node</param>
+        public void setValue(String zValue)
+        {
+            omNode.InnerText = zValue;
+        }
+
+        /// <summary>
+        /// Sets an attribute value
+        /// </summary>
+        /// <param name="zNodeName">The name of the attribute to set</param>
+        /// <param name="zValue">The value to set the attribute</param>
+        public void setAttribute(String zAttributeName, String zValue)
+        {
+            omNode.Attributes[zAttributeName].Value = zValue;
+        }
+
+        public void setAttribute(String zAttributeName, Int32 iValue)
+        {
+            omNode.Attributes[zAttributeName].Value = iValue.ToString();
+        }
+        /// <summary>
+        /// Gets the numbers of rows given an XPath
+        /// </summary>
+        /// <param name="zXPath">The Xpath to get the nodecount for</param>
+        /// <returns>The number of nodes for the given Xpath</returns>
+        public int nodeCount(String zXPath)
+        {
+            try
+            {
+                XmlNodeList oNodes = omNode.SelectNodes(zXPath);
+                return (oNodes.Count);
+            }
+            catch
+            {
+                return 0;
+            }
+        }
+
+        public XPathNodeIterator getIterator(String sourceNodePath)
+        {
+            XPathNavigator nav = omNode.CreateNavigator();
+            XPathExpression expression = nav.Compile(sourceNodePath);
+            return nav.Select(expression);
+        }
+
+        #endregion
+
+        #region Testing
+
+        /// <summary>
+        /// Test Harness
+        /// </summary>
+        /// <param name="args">the command line arguments</param>
+        public static void Main(String[] args)
+        {
+
+            // Test simple Load
+            XMLHelper oDOM = new XMLHelper();
+
+            // Test creating a DOM by handing and manipulating it
+            oDOM.createStandardRequest("test_type", "PYL38997", "CIMS");
+            oDOM.appendNode("test", "value");
+            System.Console.WriteLine("test:" + oDOM.getValue("test"));
+            System.Console.WriteLine("@type:" + oDOM.getValue("@type"));
+            oDOM.removeNode("test");
+            System.Console.WriteLine(oDOM.getRootXML());
+
+            // More manipulation
+            oDOM.appendNode("test", "value");
+            oDOM.setNode("test", "new Value");
+            oDOM = oDOM.appendNode("groups");
+            for (int i = 0; i < 10; i++)
+                oDOM.appendNode("group").appendAttribute("id", Convert.ToString(i));
+
+            // Test getNodes
+            XMLHelper[] oNodes = oDOM.getNodes("//group");
+            for (int i = 0; i < oNodes.Length; i++)
+                System.Console.WriteLine(oNodes[i].getXML());
+            System.Console.WriteLine(oDOM.getRootXML());
+
+            // Test appending an entirely new DOM
+            XMLHelper oNew = new XMLHelper("new");
+            oNew.appendNode("test", "40213423");
+            oDOM.appendNode(oNew);
+            System.Console.WriteLine(oDOM.getRootXML());
+
+            // Test appending a Nodelist
+            oNew.appendNode(oNodes);
+            System.Console.WriteLine(oNew.getRootXML());
+
+            System.Console.WriteLine(oDOM.getRootNode().getChildNodes().Length);
+            System.Console.WriteLine(oDOM.omNode.OwnerDocument.GetElementsByTagName("group").Count);
+            System.Console.WriteLine(oDOM.getParent().getNode("group").getXML());
+
+            XMLHelper o = new XMLHelper("response");
+            o.appendXPathNode("customer/@id", "1");
+            o.appendXPathNode("customer/name/first", "john");
+            o.appendXPathNode("customer/name/last", "doe");
+            o.appendNode("date", "01-jan-2005");
+            o.appendNode("empty_date", "");
+            System.Console.WriteLine(o.getDate("date"));
+            System.Console.WriteLine(o.getDate("empty_date"));
+            System.Console.WriteLine(o.getRootXML());
+            System.Console.WriteLine(o.omNode.ChildNodes.Count);
+            System.Console.WriteLine("Inner : " + o.getInnerXML());
+
+        }
+
+        #endregion
+
+        #region Distinct XML
+
+        /// <summary>
+        /// Appends a distinct set of the specified nodes to the current document.
+        /// See description for other appendDistinct overload (Example 1).
+        /// </summary>
+        public void appendDistinct(String sourceNodePath, String keyAttribute, String resultRoot)
+        {
+            appendDistinct(sourceNodePath, keyAttribute, resultRoot, null, "");
+        }
+
+        /// <summary>
+        /// High performance option for append distinct.
+        /// Allows direct access with an iterator.
+        /// Useful if adding multiple distincts from the same source rowset.
+        /// </summary>
+        /// <param name="incomingIterator"></param>
+        /// <param name="keyAttribute"></param>
+        /// <param name="resultRoot"></param>
+        /// <param name="additionalAttributes"></param>
+        /// <param name="resultNodesName"></param>
+        /// <param name="UseNodes">Forces the iterator to select nodes rather than attributes</param>
+        public void appendDistinct(XPathNodeIterator incomingIterator, String keyAttribute, String resultRoot, String[] additionalAttributes, String resultNodesName, Boolean UseNodes)
+        {
+            string value;
+            string attribute;
+            SortedList<string, object> ids = new SortedList<string, object>();
+            MemoryStream ms = new MemoryStream();
+
+            XmlTextWriter xmlWriter = new XmlTextWriter(ms, Encoding.UTF8);
+            xmlWriter.WriteStartElement(resultRoot);
+            XPathNodeIterator iterator = incomingIterator.Clone();
+            while (iterator.MoveNext())
+            {
+                if (UseNodes)
+                    attribute = keyAttribute;
+                else
+                    attribute = "@" + keyAttribute;
+                value = iterator.Current.SelectSingleNode(attribute).Value;
+                if (!ids.ContainsKey(value))
+                {
+                    if (additionalAttributes != null)
+                    {
+                        xmlWriter.WriteStartElement(resultNodesName);
+                        xmlWriter.WriteAttributeString(keyAttribute, value);
+                        ids.Add(value, null);
+                        foreach (String extraNode in additionalAttributes)
+                        {
+                            if (UseNodes)
+                                attribute = extraNode;
+                            else
+                                attribute = "@" + extraNode;
+                            xmlWriter.WriteAttributeString(extraNode, iterator.Current.SelectSingleNode(attribute).Value);
+                        }
+                        xmlWriter.WriteEndElement();
+                    }
+                    else
+                    {
+                        xmlWriter.WriteElementString(keyAttribute, value);
+                        ids.Add(value, null);
+                    }
+                }
+            }
+            xmlWriter.WriteEndElement();
+            xmlWriter.Flush();
+            ms.Seek(0, System.IO.SeekOrigin.Begin);
+
+            XmlDocument distinct = new XmlDocument();
+            distinct.Load(ms);
+            xmlWriter.Close();
+
+            omNode.AppendChild(omNode.OwnerDocument.ImportNode(distinct.DocumentElement, true));
+
+        }
+
+        public void appendDistinct(XPathNodeIterator incomingIterator, String keyAttribute, String resultRoot, String[] additionalAttributes, String resultNodesName)
+        {
+            appendDistinct(incomingIterator, keyAttribute, resultRoot, additionalAttributes, resultNodesName, false);
+        }
+
+        /// <summary>
+        /// Appends a distinct set of the specified nodes to the current document.
+        /// If additionalAttributes is null then resultNodesName is not used and the results will look
+        /// like the first example. With additionalAttributes 
+        /// </summary>
+        /// <param name="sourceNodePath">XPath to the nodes to be distincted.</param>
+        /// <param name="keyAttribute">Attribute to key on for determining uniqueness.</param>
+        /// <param name="resultRoot">Name of the root node to create and append the distinct nodes to.</param>
+        /// <param name="additionalAttributes">Additional attributes to include in the distinct items.</param>
+        /// <param name="resultNodesName">Name of individual result nodes.</param>
+        /// <param name="UseNodes">Use nodes instead of attributes for the data.</param>
+        /// 
+        /// <example >
+        /// 
+        /// Source:
+        /// <activities>
+        ///     <activity customer_id="1" name="Phil" type="M"/>
+        ///     <activity customer_id="1" name="Phil" type="C"/>
+        ///     <activity customer_id="2" name="Trev" type="M"/>
+        /// </activities>
+        /// 
+        /// Example 1: appendDistinct("activities/activity", "customer_id", "customer_ids")
+        /// <customer_ids execution_duration="0">
+        ///   <customer_id>1</customer_id> 
+        ///   <customer_id>2</customer_id> 
+        /// </customer_ids>
+        /// 
+        /// Example 2: appendDistinct("activities/activity", "customer_id", "customers", new string[] { "name" }, "customer" )
+        /// <customers execution_duration="0">
+        ///   <customer customer_id="1" name="Phil" /> 
+        ///   <customer customer_id="2" name="Trev" /> 
+        /// </customers>
+        /// 
+        /// </example>
+        public void appendDistinct(String sourceNodePath, String keyAttribute, String resultRoot, String[] additionalAttributes, String resultNodesName, Boolean UseNodes)
+        {
+            DateTime startTime = DateTime.Now;
+
+            XPathNavigator nav = omNode.CreateNavigator();
+            XPathExpression expression = nav.Compile(sourceNodePath);
+            XPathNodeIterator iterator = nav.Select(expression);
+
+            appendDistinct(iterator, keyAttribute, resultRoot, additionalAttributes, resultNodesName, UseNodes);
+
+            TimeSpan ExecutionDuration = DateTime.Now - startTime;
+
+            this.getNode(resultRoot).appendAttribute("execution_duration", ExecutionDuration.TotalMilliseconds.ToString());
+
+        }
+
+        public void appendDistinct(String sourceNodePath, String keyAttribute, String resultRoot, String[] additionalAttributes, String resultNodesName)
+        {
+            appendDistinct(sourceNodePath, keyAttribute, resultRoot, additionalAttributes, resultNodesName, false);
+        }
+
+        #endregion
+
+        #region Validation
+
+        public string validateXML(String schema)
+        {
+            StringReader srXml = new StringReader(getRootXML());
+            XmlValidatingReader vr;
+            XmlTextReader tr;
+            XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+
+            XMLHelper oResponse = new XMLHelper("response");
+
+            try
+            {
+
+                schemaCol.Add(null, schema);
+                isValidXml = true;
+
+                // Read the xml.
+                tr = new XmlTextReader(srXml);
+
+                // Create the validator.
+                vr = new XmlValidatingReader(tr);
+
+                // Set the validation tyep.
+                vr.ValidationType = ValidationType.Auto;
+
+                // Add the schema.
+                if (schemaCol != null)
+                {
+                    vr.Schemas.Add(schemaCol);
+                }
+
+                // Set the validation event handler.
+                vr.ValidationEventHandler +=
+                   new ValidationEventHandler(ValidationCallBack);
+
+                // Read the xml schema.
+                while (isValidXml && vr.Read())
+                {
+                }
+
+                vr.Close();
+
+                oResponse.appendNode("valid", "true");
+
+                return oResponse.getRootXML();
+
+            }
+            catch (Exception ex)
+            {
+                oResponse.appendNode("valid", "false");
+                oResponse.appendNode("error", ex.Message);
+                ValidationError = ex.Message;
+                return oResponse.getRootXML();
+            }
+            finally
+            {
+                // Clean up...
+                vr = null;
+                tr = null;
+                schemaCol = null;
+            }
+        }
+
+        public Boolean validateUsing(String schema)
+        {
+            StringReader srXml = new StringReader(getRootXML());
+            XmlValidatingReader vr;
+            XmlTextReader tr;
+            XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+            schemaCol.Add(null, schema);
+            isValidXml = true;
+
+            try
+            {
+                // Read the xml.
+                tr = new XmlTextReader(srXml);
+
+                // Create the validator.
+                vr = new XmlValidatingReader(tr);
+
+                // Set the validation tyep.
+                vr.ValidationType = ValidationType.Auto;
+
+                // Add the schema.
+                if (schemaCol != null)
+                {
+                    vr.Schemas.Add(schemaCol);
+                }
+
+                // Set the validation event handler.
+                vr.ValidationEventHandler +=
+                   new ValidationEventHandler(ValidationCallBack);
+
+                // Read the xml schema.
+                while (isValidXml && vr.Read())
+                {
+                }
+
+                vr.Close();
+
+                return isValidXml;
+            }
+            catch (Exception ex)
+            {
+                ValidationError = ex.Message;
+                return false;
+            }
+            finally
+            {
+                // Clean up...
+
+                vr = null;
+                tr = null;
+            }
+        }
+
+        private void ValidationCallBack(object sender,
+                                   ValidationEventArgs args)
+        {
+            // The xml does not match the schema.
+
+            isValidXml = false;
+            ValidationError = args.Message;
+        }
+
+        #endregion
+
+        #region XSL Transformation
+
+        /// <summary>
+        /// Transforms the current DOM using the XSL and returns an XMLHelper DOM
+        /// </summary>
+        /// <param name="zXSL">The XSL for the transform</param>
+        /// <returns>XMLHelper DOM with the result of the transform</returns>
+        public XMLHelper transform(String zXSL)
+        {
+            return transform(zXSL, new Dictionary<string, string>());
+        }
+
+        /// <summary>
+        /// Transforms the current DOM using the XSL to a TextWriter
+        /// </summary>
+        /// <param name="zXSL">The XSL for the transform</param>
+        /// <param name="oOut">Thre Textwriter to output to</param>
+        public void transform(String zXSL, TextWriter oOut)
+        {
+            transform(zXSL, new Dictionary<string, string>(), oOut);
+        }
+
+
+        public XMLHelper transform(Stream oXSL)
+        {
+            return transform(oXSL, new Dictionary<string, string>());
+        }
+        public XMLHelper transform(Stream oXSL, Dictionary<string, string> aParams)
+        {
+            StringWriter oText = new StringWriter();
+
+            transform(oXSL, aParams, oText);
+            return new XMLHelper(oText.GetStringBuilder());
+        }
+        /// <summary>
+        /// Transforms the current DOM using the XSL to a TextWriter
+        /// </summary>
+        /// <param name="zXSL">The XSL for the transform</param>
+        /// <param name="aParams">String Array of paramters to pass to the XSL</param>
+        /// <param name="oOut">Thre Textwriter to output to</param>
+        public void transform(String zXSL, Dictionary<string, string> aParams, TextWriter oOut)
+        {
+            Stream oXSL = new FileStream(zXSL, FileMode.Open);
+            transform(oXSL, aParams, oOut);
+        }
+        public void transform(Stream oXSL, Dictionary<string, string> aParams, TextWriter oOut)
+        {
+
+            XslCompiledTransform transformer = new XslCompiledTransform();
+
+            XsltArgumentList args = new XsltArgumentList();
+            foreach (string key in aParams.Keys)
+            {
+                args.AddParam(key, "", aParams[key]);
+            }
+
+            //Having to specify settings for the load, due to embedded script usage...
+            XsltSettings xsltSettings = new XsltSettings(true, true);
+            XmlUrlResolver xmlResolver = new XmlUrlResolver();
+            XmlReader reader = XmlReader.Create(oXSL);
+            transformer.Load(reader, xsltSettings, xmlResolver);
+            //transformer.Load(oXSL, );
+
+            if (omNode.ParentNode == omNode.OwnerDocument)
+                transformer.Transform(omNode.OwnerDocument, args, oOut);
+            else
+                transformer.Transform(omNode, args, oOut);
+
+        }
+
+
+        /// <summary>
+        /// Transforms the current DOM using the XSL and returns an XMLHelper DOM
+        /// </summary>
+        /// <param name="zXSL">The XSL for the transform</param>
+        /// <param name="aParams">String Array of paramters to pass to the XSL</param>
+        /// <returns>XMLHelper DOM with the result of the transform</returns>
+        public XMLHelper transform(String zXSL, Dictionary<string, string> aParams)
+        {
+            //try
+            //{
+            StringWriter oText = new StringWriter();
+
+            transform(zXSL, aParams, oText);
+            return new XMLHelper(oText.GetStringBuilder());
+            //}
+            //catch (Exception ex)
+            //{
+            //    System.Console.WriteLine(ex.Message);
+            //    return null;
+            //}
+        }
+
+
+        #endregion
+
+    }
+
+}

BIN
bin/Debug/com.cloudsoft.utils.dll


BIN
bin/Debug/com.cloudsoft.utils.pdb


BIN
bin/Release/com.cloudsoft.utils.dll


BIN
bin/Release/com.cloudsoft.utils.pdb


BIN
bin/x64/Debug/com.cloudsoft.utils.dll


BIN
bin/x64/Debug/com.cloudsoft.utils.pdb


+ 140 - 0
com.cloudsoft.utils.csproj

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>com.cloudsoft.utils</RootNamespace>
+    <AssemblyName>com.cloudsoft.utils</AssemblyName>
+    <StartupObject>
+    </StartupObject>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>
+    </AssemblyOriginatorKeyFile>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Accessibility" />
+    <Reference Include="System" />
+    <Reference Include="System.configuration" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
+    <Compile Include="Utils\DBHelper.cs" />
+    <Compile Include="Utils\DBParams.cs" />
+    <Compile Include="Utils\ErrHelper.cs" />
+    <Compile Include="Utils\UIHelper.cs">
+      <SubType>ASPXCodeBehind</SubType>
+    </Compile>
+    <Compile Include="Utils\XMLHelper.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 20 - 0
com.cloudsoft.utils.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "com.cloudsoft.utils", "com.cloudsoft.utils.csproj", "{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DAB2DD25-CBA0-4F13-878C-1F18B432D5B2}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

BIN
com.cloudsoft.utils.v11.suo


BIN
com.cloudsoft.utils.v12.suo


BIN
obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 4 - 0
obj/Debug/GSK.UKPH.csproj.FileListAbsolute.txt

@@ -0,0 +1,4 @@
+C:\dev\WI3\Components\GSK.UKPH\bin\Debug\com.cloudsoft.utils.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Debug\com.cloudsoft.utils.pdb
+C:\dev\WI3\Components\GSK.UKPH\obj\Debug\com.cloudsoft.utils.dll
+C:\dev\WI3\Components\GSK.UKPH\obj\Debug\com.cloudsoft.utils.pdb

BIN
obj/Debug/Refactor/GSK.UKPH.dll


+ 15 - 0
obj/Debug/com.cloudsoft.utils.csproj.FileListAbsolute.txt

@@ -0,0 +1,15 @@
+C:\dev\WI3\Components\GSK.UKPH\bin\Debug\com.cloudsoft.utils.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Debug\com.cloudsoft.utils.pdb
+C:\dev\WI3\Components\GSK.UKPH\obj\Debug\com.cloudsoft.utils.csprojResolveAssemblyReference.cache
+C:\dev\WI3\Components\GSK.UKPH\obj\Debug\com.cloudsoft.utils.dll
+C:\dev\WI3\Components\GSK.UKPH\obj\Debug\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\bin\Debug\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\bin\Debug\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\obj\Debug\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\obj\Debug\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\obj\Debug\com.cloudsoft.utils.csprojResolveAssemblyReference.cache
+C:\dev\P3BI\Apps\cloudsoft.net\bin\Debug\com.cloudsoft.utils.dll
+C:\dev\P3BI\Apps\cloudsoft.net\bin\Debug\com.cloudsoft.utils.pdb
+C:\dev\P3BI\Apps\cloudsoft.net\obj\Debug\com.cloudsoft.utils.csprojResolveAssemblyReference.cache
+C:\dev\P3BI\Apps\cloudsoft.net\obj\Debug\com.cloudsoft.utils.dll
+C:\dev\P3BI\Apps\cloudsoft.net\obj\Debug\com.cloudsoft.utils.pdb

BIN
obj/Debug/com.cloudsoft.utils.csprojResolveAssemblyReference.cache


BIN
obj/Debug/com.cloudsoft.utils.dll


BIN
obj/Debug/com.cloudsoft.utils.pdb


BIN
obj/Release/DesignTimeResolveAssemblyReferencesInput.cache


+ 13 - 0
obj/Release/GSK.UKPH.csproj.FileListAbsolute.txt

@@ -0,0 +1,13 @@
+C:\dev\WI3\Components\GSK.UKPH\obj\Release\ResolveAssemblyReference.cache
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\GSK.UKPH.dll.config
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\GSK.UKPH.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\GSK.UKPH.pdb
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\AntiXSSLibrary.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\Oracle.DataAccess.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\saxon9api.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\saxon9.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\IKVM.Runtime.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\IKVM.GNU.Classpath.dll
+C:\dev\WI3\Components\GSK.UKPH\bin\Release\saxon9api.netmodule
+C:\dev\WI3\Components\GSK.UKPH\obj\Release\GSK.UKPH.dll
+C:\dev\WI3\Components\GSK.UKPH\obj\Release\GSK.UKPH.pdb

BIN
obj/Release/GSK.UKPH.dll


BIN
obj/Release/GSK.UKPH.pdb


+ 5 - 0
obj/Release/com.cloudsoft.utils.csproj.FileListAbsolute.txt

@@ -0,0 +1,5 @@
+C:\dev\cloudsoft.net\bin\Release\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\bin\Release\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\obj\Release\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\obj\Release\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\obj\Release\com.cloudsoft.utils.csprojResolveAssemblyReference.cache

BIN
obj/Release/com.cloudsoft.utils.csprojResolveAssemblyReference.cache


BIN
obj/Release/com.cloudsoft.utils.dll


BIN
obj/Release/com.cloudsoft.utils.pdb


BIN
obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 5 - 0
obj/x64/Debug/com.cloudsoft.utils.csproj.FileListAbsolute.txt

@@ -0,0 +1,5 @@
+C:\dev\cloudsoft.net\bin\x64\Debug\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\bin\x64\Debug\com.cloudsoft.utils.pdb
+C:\dev\cloudsoft.net\obj\x64\Debug\com.cloudsoft.utils.csprojResolveAssemblyReference.cache
+C:\dev\cloudsoft.net\obj\x64\Debug\com.cloudsoft.utils.dll
+C:\dev\cloudsoft.net\obj\x64\Debug\com.cloudsoft.utils.pdb

BIN
obj/x64/Debug/com.cloudsoft.utils.csprojResolveAssemblyReference.cache


BIN
obj/x64/Debug/com.cloudsoft.utils.dll


BIN
obj/x64/Debug/com.cloudsoft.utils.pdb