using System;
using System.Data;
using System.Diagnostics;
using System.Reflection;
using System.Security.Principal;
namespace IndianHealthService.BMXNet.Ado
{
///
/// BMXNET implementaiton of DbConnection. This class can be used like
/// any ADO.NET DbConnection implementation or the suggested RemoteSession API's can
/// be used.
///
/// See ADO.NET documentation for details of this class.
///
internal class BMXNetConnection : System.Data.Common.DbConnection, IDbConnection
{
private ConnectionState m_state;
private string m_sConnString;
private BMXNetSessionConnection m_sessionConnection;
public BMXNetSessionConnection SessionConnection
{
get { return m_sessionConnection; }
set { m_sessionConnection = value; }
}
private RPMSDb m_RPMSDb;
private int m_nTimeout;
private string m_sDatabase;
private string m_sAccess;
private string m_sVerify;
private int m_nPort;
private string m_sAddress;
private string m_sAppContext;
private bool m_bUseWinIdent;
// default constructor.
public BMXNetConnection()
{
// Initialize the connection object into the closed state.
m_state = ConnectionState.Closed;
//TAE ... crazy this.m_rpx = new BMXNetBroker();
}
public BMXNetConnection(string sConnString)
{
// Initialize the connection object into a closed state.
m_state = ConnectionState.Closed;
this.ConnectionString = sConnString;
}
public BMXNetConnection(BMXNetSessionConnection aConnection)
{
if (aConnection.IsConnected)
{
m_state = ConnectionState.Open;
this.SessionConnection = aConnection;
m_RPMSDb = new RPMSDb(this.SessionConnection);
}
else
{
m_state = ConnectionState.Closed;
}
}
/****
* IMPLEMENT THE REQUIRED PROPERTIES.
****/
override public string ConnectionString
{
get
{
return m_sConnString;
}
set
{
m_nTimeout = 0;
try
{
// Parse values from connect string
m_sConnString = value;
string sSemi = ";";
string sEq = "=";
string sU = "^";
char[] cSemi = sSemi.ToCharArray();
char[] cEq = sEq.ToCharArray();
char[] cU = sU.ToCharArray();
string [] saSplit = m_sConnString.Split(cSemi);
string [] saProp;
string [] saTemp;
string sPropName;
string sPropVal;
for (int j = 0; j