Data Access Service Class is only available in data access
internal class SQLServer {private SqlConnection connection; private static SQLServer sqlServer; private SqlTransaction sqlTransaction; private bool inTransaction; private SQLServer () {connection = new SqlConnection (GetConnectionString ()); inTransaction = false;} private string GetConnectionString () {string ConnectionString = System.configuration.configurationSettingS.AppSettings ["Connectionstring"]; // If encryption can decrypt Return Connectionstring here;}
///////////////////////////////////////> (Connection == Null) Connection = New SqlConnection (GetConnectionsTRINNECTION); Return connection;}}} // / /// Open /// summary> public void openconnection () {if (connection.State.toString (). TouPper ()! = "open") connection.open ();} // / /// Close connection /// summary> public void closeconnection () {if (connection.State.toString (). TouPper () == "open") connection.close ();} // / /// transaction /// summary> public sqltransaction sqltran {get {return sqltransaction;}} /// /// Start transaction /// summary> public void begintransaction () { Sqltransaction = connection.begintransaction (); IntraSaction = true;} /// /// Submit transaction /// summary> public void committransaction () {if (sqltransaction! = null) sqltransaction.commit (); INTRANSACTION = false;} /// /// Roll Roll Transaction /// summary> public void RollbackTra NSAction () {if (sqltransaction! = null) sqltransaction.rollback (); IntraSaction = false;} /// /// Get a single object reference /// summary> /// SQLServer Object reference returns> public static sqlserver instance () {if (sqlserver == null) {sqlserver = new SQLServer ();} return sqlserver;}}