|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using EncPassCSharp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DAL
|
|
|
|
|
|
{
|
|
|
|
|
|
public class DalCommon
|
|
|
|
|
|
{
|
|
|
|
|
|
private DalInterface DBHelper;
|
|
|
|
|
|
public string dbType = ConfigurationManager.ConnectionStrings["DBType"].ConnectionString;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
|
|
public DalCommon()
|
|
|
|
|
|
{
|
|
|
|
|
|
string DBDataPassWord = EncPassClass.DePassWord(ConfigurationManager.ConnectionStrings["DBDataPassWord"].ConnectionString);
|
|
|
|
|
|
if (this.dbType == "1")
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DBHelper = new DBHelperSQL();
|
|
|
|
|
|
string ConnectionStringSQL = string.Format(ConfigurationManager.ConnectionStrings["ConnectionStringSQL"].ConnectionString, DBDataPassWord);
|
|
|
|
|
|
this.DBHelper.CreateConnectionStringSql(ConnectionStringSQL);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (this.dbType == "4")
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DBHelper = new DBHelperMySQL();
|
|
|
|
|
|
string ConnectionStringSQL = string.Format(ConfigurationManager.ConnectionStrings["ConnectionStringMySQL"].ConnectionString, DBDataPassWord);
|
|
|
|
|
|
this.DBHelper.CreateConnectionStringSql(ConnectionStringSQL);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DBHelper = new DBHelperOra();
|
|
|
|
|
|
string ConnectionStringOracle = string.Format(ConfigurationManager.ConnectionStrings["ConnectionStringOracle"].ConnectionString, DBDataPassWord);
|
|
|
|
|
|
this.DBHelper.CreateConnectionStringSql(ConnectionStringOracle);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int ExecuteSql(string str)
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.DBHelper.ExecuteSql(str);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int ExecuteSql(string SQLString, params IDataParameter[] cmdParms)
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.DBHelper.ExecuteSql(SQLString, cmdParms);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object GetSingle(string str)
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.DBHelper.GetSingle(str);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DataSet Query(string str)
|
|
|
|
|
|
{
|
|
|
|
|
|
return this.DBHelper.Query(str);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|