Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads
 
Add your own
alternative version

AccountPlus

, 10 Sep 2009
A Complete Account Management System
accountplus.zip
AccountPlus
AccountPlus
AccountPlus.JPG
Database
AccountPlus.mdb
Documents
AccountPlus.doc
Thumbs.db
Setup
setup.msi
Thumbs.db
Source_Code.zip
accountplussource.zip
AccountPlusSource
AccountPlus.BusinessLogic
AccountPlus.BusinessLogic.csproj.user
Properties
AccountPlus.Configurations
Properties
AccountPlus.DataAccess
Properties
AccountPlus.Formatting
Properties
AccountPlus.Messaging
Properties
AccountPlus.Setup
AccountPlus.Setup.CustomActions
Properties
Settings.settings
AccountPlus.Setup.vdproj
AccountPlus.UserInterface
AccountPlus.UserInterface.csproj.user
AccPlus.csproj.user
Help
AccountPlus.pdf
log4net.dll
Properties
Settings.settings
propertiesORoptions.ico
Assemblies
log4net.dll
database.zip
Database
MS Access
AccountPlus.mdb
MySQL
SQL Server
Backup
AccountPlus.bak
Script
setup.zip
Setup
Setup.msi
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.OracleClient;
using System.Data.Odbc;
using System.Data.OleDb;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace AccountPlus.DataAccess
{
    internal class DataAdapterManager
    {

        internal IDataAdapter GetDataAdapter(string sqlCommand, IDbConnection connection)
        {
            return GetDataAdapter(sqlCommand, connection, CommandType.Text);
        }


        internal IDataAdapter GetDataAdapter(string sqlCommand, IDbConnection connection, DBParameter param , CommandType commandType)
        {
            IDataAdapter adapter = null;            
            IDbCommand command = (new CommandBuilder()).GetCommand(sqlCommand, connection, param , commandType);

            switch (Configuration.DBProvider.Trim().ToUpper())
            {
                case Common.SQL_SERVER_DB_PROVIDER:
                    adapter = new SqlDataAdapter((SqlCommand)command);
                    break;
                case Common.MY_SQL_DB_PROVIDER:
                    adapter = new MySqlDataAdapter((MySqlCommand)command);
                    break;
                case Common.ORACLE_DB_PROVIDER:
                    adapter = new OracleDataAdapter((OracleCommand)command);
                    break;
                case Common.EXCESS_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.OLE_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.ODBC_DB_PROVIDER:
                    adapter = new OdbcDataAdapter((OdbcCommand)command);
                    break;
            }

            return adapter;
        }

        internal IDataAdapter GetDataAdapter(string sqlCommand, IDbConnection connection, DBParameterCollection paramCollection, CommandType commandType)
        {
            IDataAdapter adapter = null;
            IDbCommand command = (new CommandBuilder()).GetCommand(sqlCommand, connection, paramCollection, commandType);

            switch (Configuration.DBProvider.Trim().ToUpper())
            {
                case Common.SQL_SERVER_DB_PROVIDER:
                    adapter = new SqlDataAdapter((SqlCommand)command);
                    break;
                case Common.MY_SQL_DB_PROVIDER:
                    adapter = new MySqlDataAdapter((MySqlCommand)command);
                    break;
                case Common.ORACLE_DB_PROVIDER:
                    adapter = new OracleDataAdapter((OracleCommand)command);
                    break;
                case Common.EXCESS_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.OLE_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.ODBC_DB_PROVIDER:
                    adapter = new OdbcDataAdapter((OdbcCommand)command);
                    break;
            }

            return adapter;
        }

        internal IDataAdapter GetDataAdapter(string sqlCommand, IDbConnection connection, CommandType commandType)
        {
            IDataAdapter adapter = null;
            IDbCommand command = (new CommandBuilder()).GetCommand(sqlCommand, connection, commandType);

            switch (Configuration.DBProvider.Trim().ToUpper())
            {
                case Common.SQL_SERVER_DB_PROVIDER:
                    adapter = new SqlDataAdapter((SqlCommand)command);
                    break;
                case Common.MY_SQL_DB_PROVIDER:
                    adapter = new MySqlDataAdapter((MySqlCommand)command);
                    break;
                case Common.ORACLE_DB_PROVIDER:
                    adapter = new OracleDataAdapter((OracleCommand)command);
                    break;
                case Common.EXCESS_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.OLE_DB_PROVIDER:
                    adapter = new OleDbDataAdapter((OleDbCommand)command);
                    break;
                case Common.ODBC_DB_PROVIDER:
                    adapter = new OdbcDataAdapter((OdbcCommand)command);
                    break;
            }

            return adapter;
        }

        internal DataTable GetDataTable(string sqlCommand, DBParameterCollection paramCollection, IDbConnection connection, string tableName, CommandType commandType)
        {
            DataTable dt = null;

            if(tableName != string.Empty)
                dt = new DataTable(tableName);
            else
                dt = new DataTable();

            IDbCommand command = null;
            if (paramCollection != null)
            {
                if(paramCollection.Parameters.Count > 0)
                    command = (new CommandBuilder()).GetCommand(sqlCommand, connection, paramCollection, commandType);
                else
                    command = (new CommandBuilder()).GetCommand(sqlCommand, connection, commandType);
            }
            else
                command = (new CommandBuilder()).GetCommand(sqlCommand, connection, commandType);

            switch (Configuration.DBProvider.Trim().ToUpper())
            {
                    
                case Common.SQL_SERVER_DB_PROVIDER:

                    SqlDataAdapter sqlAdapter = null;
                    sqlAdapter = new SqlDataAdapter((SqlCommand)command);
                    try
                    {                        
                        sqlAdapter.Fill(dt);
                    }
                    catch (Exception ex1)
                    {
                        throw ex1;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (sqlAdapter != null)
                        {
                            sqlAdapter.Dispose();
                        }
                    }
                    break;
                case Common.MY_SQL_DB_PROVIDER:
                    MySqlDataAdapter mySqlAdapter = null;
                    mySqlAdapter = new MySqlDataAdapter((MySqlCommand)command);
                    try
                    {
                        mySqlAdapter.Fill(dt);
                    }
                    catch (Exception ex2)
                    {
                        throw ex2;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (mySqlAdapter != null)
                        {
                            mySqlAdapter.Dispose();
                        }
                    }
                    break;
                case Common.ORACLE_DB_PROVIDER:
                    OracleDataAdapter oracleAdapter = null;
                    oracleAdapter = new OracleDataAdapter((OracleCommand)command);
                    try
                    {
                        oracleAdapter.Fill(dt);
                    }
                    catch (Exception ex3)
                    {
                        throw ex3;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (oracleAdapter != null)
                        {
                            oracleAdapter.Dispose();
                        }
                    }
                    break;
                case Common.EXCESS_DB_PROVIDER:
                    OleDbDataAdapter oleDBAdapterAccess = null;
                    oleDBAdapterAccess = new OleDbDataAdapter((OleDbCommand)command);
                    try
                    {
                        oleDBAdapterAccess.Fill(dt);
                    }
                    catch (Exception ex4)
                    {
                        throw ex4;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (oleDBAdapterAccess != null)
                        {
                            oleDBAdapterAccess.Dispose();
                        }
                    }
                    break;
                case Common.OLE_DB_PROVIDER:
                    OleDbDataAdapter oleAdapter = null;
                    oleAdapter = new OleDbDataAdapter((OleDbCommand)command);
                    try
                    {
                        oleAdapter.Fill(dt);
                    }
                    catch (Exception ex4)
                    {
                        throw ex4;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (oleAdapter != null)
                        {
                            oleAdapter.Dispose();
                        }
                    }                    
                    break;
                case Common.ODBC_DB_PROVIDER:
                    OdbcDataAdapter odbcAdapter = null;
                    odbcAdapter = new OdbcDataAdapter((OdbcCommand)command);
                    try
                    {
                        odbcAdapter.Fill(dt);
                    }
                    catch (Exception ex4)
                    {
                        throw ex4;
                    }
                    finally
                    {
                        if (command != null)
                        {
                            command.Dispose();
                        }

                        if (odbcAdapter != null)
                        {
                            odbcAdapter.Dispose();
                        }
                    }
                    break;            
            }

            return dt;
        }

        internal DataTable GetDataTable(string sqlCommand, DBParameter param, IDbConnection connection, string tableName, CommandType commandType)
        {
            DBParameterCollection paramCollection = new DBParameterCollection();
            paramCollection.Add(param);
            return GetDataTable(sqlCommand, paramCollection , connection, tableName, commandType);
        }

        internal DataTable GetDataTable(string sqlCommand, IDbConnection connection, string tableName, CommandType commandType)
        {            
            return GetDataTable(sqlCommand, new DBParameterCollection(), connection, tableName, commandType);
        }

        internal DataTable GetDataTable(string sqlCommand, IDbConnection connection, CommandType commandType)
        {
            return GetDataTable(sqlCommand, new DBParameterCollection(), connection, string.Empty, commandType);
        }

        internal DataTable GetDataTable(string sqlCommand, IDbConnection connection)
        {
            return GetDataTable(sqlCommand, new DBParameterCollection(), connection, string.Empty, CommandType.Text);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Ashish Tripathi
Founder Aspirea Technologies Pvt Ltd
India India
• 8 years of experience in IT Industry as a Developer.
• Experience of End-To-End Software Development and Implementation (Entire SDLC i.e Software Development Life Cycle)
• Real time Exposure to Banking, Finance and Energy industry.
• Expertise in distributed application architecture as well as web based applications using Microsoft.NET platform.
• Expertise in database design, SQL programming and SQL performance tuning.
• Expertise in Web Services and WCF Services.
• Experience of Rich Internet Application using Adobe Flex.
• Experience in migration of legacy application to latest technology, migration of VB application to .NET.
• Knowledge of OOPS and Design Concepts.
• Expertise in Agile/ Scrum software development processes.
 
Specialties
• Languages\ Technologies-
.NET Framework 1.1/2.0/3.0/3.5, C#.NET, VB.NET, ASP.NET, VB6, AJAX, ASP.NET, Adobe Flex 3.0, Web Services, Windows Communication Foundation (WCF), LINQ, SQL Server, Oracle, MySql, MS Access, HTML, XML, JavaScript, C# Script, CSS and XSLT.
 
• Methodology/ Concepts-
OOPS, Data Structures, Design Concepts and Agile/ Scrum Software Development
Follow on   Twitter

| Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 10 Sep 2009
Article Copyright 2008 by Ashish Tripathi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid