fitframework
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | List of all members
IS.Base.DBBase Class Reference

Class DBBase, phụ trách tất cả các thao tác với cơ sở dữ liệu. Lớp này không được sử dụng trực tiếp mà sẽ được thực hiện qua các lớp *_BUS như trong BusinessController More...

Public Member Functions

 DBBase (string sConnectionString)
 Initializes a new instance of the DBBase class.
 
 DBBase (string server, string data, string user, string password)
 Initializes a new instance of the DBBase class.
 
 DBBase (string server, string data)
 Initializes a new instance of the DBBase class.
 
void setCommandTimeout (int _value)
 Giá trị mặc định theo SQL, được tính theo đơn vị giây.
 
void setConnection (SqlConnection _conn)
 Sets the connection.
 
void BuildConnectionString (string server, string data)
 Builds the connection string.
 
void BuildConnectionString (string server, string data, string user, string password)
 Builds the connection string.
 
int Open ()
 Opens this instance.
 
void Close ()
 Closes this instance.
 
void setTran (SqlTransaction pTran)
 Gán transaction trong SQL cho đối tượng này để đảm bảo nhiều đối tượng có thể thực hiện được cùng một phiên dữ liệu.
 
int beginTran ()
 Create the transaction for current connection.
 
int commit ()
 Commits the current transaction.
 
int rollback ()
 Rollbace the current transaction.
 
SqlTransaction getTran ()
 get current transation
 
int doCommand (ref SqlCommand cm)
 Does the command.
 
int doSQL (string SQL)
 Does the SQL.
 
int getSQL (ref DataSet ds, string sTableName, string SQL)
 Gets the SQL.
 
SqlDataReader getSQL (string SQL)
 Gets the SQL.
 
DataTable getSQLTable (string SQL)
 Gets the SQL.
 
int getCommand (ref System.Data.DataSet ds, string sTableName, SqlCommand cm)
 Gets the command.
 
SqlDataReader getCommand (SqlCommand cm)
 Gets the command.
 
DataTable getCommandTable (SqlCommand cm)
 Gets the command table.
 
int getCommand (ref System.Data.DataSet ds, ref SqlCommand cm)
 Gets the store procedure.
 
int getCommand (ref System.Data.DataSet ds, string sTableName, ref SqlCommand cm)
 Gets the store procedure.
 
SqlCommand createCommand (string spName, SqlParameter pr, params SqlParameter[] para)
 Tạo ra câu lệnh sql từ một stored procedure.
 
SqlCommand createCommand (string spName, params spParam[] para)
 Creates the command.
 
SqlCommand createCommandSQL (string Sql, params spParam[] para)
 create command from direct sql
 
int getCount (ref SqlCommand cm)
 Get the count(*) in select and convert it to int.
 
DataTable getPage (string sql, int startRecord, int rowPerPage)
 Gets the page.
 
DataTable getPage (ref SqlCommand cm, int startRecord, int rowPerPage)
 Gets the page.
 
int getVersion ()
 Lấy phiên bản chính của sql server hiện tại.
 
int doStoreProcedure (string spName, params spParam[] para)
 doStoreProcedure Does the store procedure.
 
int getStoreProcedure (ref DataSet ds, string tbName, string storePocedureName, params spParam[] para)
 Gets the store procedure.
 

Public Attributes

__error _er = new __error()
 Thông tin về lỗi cuối cùng được thực hiện bởi hệ thống.
 

Properties

SqlConnection Connection [get]
 Gets the connection.
 
string ConnectionString [get, set]
 Gets or sets the connection string.
 
bool Connected [get]
 Gets a value indicating whether this DBBase is connected.
 

Detailed Description

Class DBBase, phụ trách tất cả các thao tác với cơ sở dữ liệu. Lớp này không được sử dụng trực tiếp mà sẽ được thực hiện qua các lớp *_BUS như trong BusinessController

Constructor & Destructor Documentation

◆ DBBase() [1/3]

IS.Base.DBBase.DBBase ( string sConnectionString)
inline

Initializes a new instance of the DBBase class.

Parameters
sConnectionStringThe s connection string.

◆ DBBase() [2/3]

IS.Base.DBBase.DBBase ( string server,
string data,
string user,
string password )
inline

Initializes a new instance of the DBBase class.

Parameters
serverThe server.
dataThe data.
userThe user.
passwordThe password.

◆ DBBase() [3/3]

IS.Base.DBBase.DBBase ( string server,
string data )
inline

Initializes a new instance of the DBBase class.

Parameters
serverThe server.
dataThe data.

Member Function Documentation

◆ beginTran()

int IS.Base.DBBase.beginTran ( )
inline

Create the transaction for current connection.

Returns

◆ BuildConnectionString() [1/2]

void IS.Base.DBBase.BuildConnectionString ( string server,
string data )
inline

Builds the connection string.

Parameters
serverThe server.
dataThe data.

◆ BuildConnectionString() [2/2]

void IS.Base.DBBase.BuildConnectionString ( string server,
string data,
string user,
string password )
inline

Builds the connection string.

Parameters
serverThe server.
dataThe data.
userThe user.
passwordThe password.

◆ commit()

int IS.Base.DBBase.commit ( )
inline

Commits the current transaction.

Returns

◆ createCommand() [1/2]

SqlCommand IS.Base.DBBase.createCommand ( string spName,
params spParam[] para )
inline

Creates the command.

Parameters
spNameName of the stored procedure.
parastored procedure parameters
Returns
SqlCommand with out connection or transiction, the command will be called by doProcudere or getProcudere in this class

◆ createCommand() [2/2]

SqlCommand IS.Base.DBBase.createCommand ( string spName,
SqlParameter pr,
params SqlParameter[] para )
inline

Tạo ra câu lệnh sql từ một stored procedure.

Parameters
spNameTên hàm
prTham số
paraCác tham số khác
Returns

◆ createCommandSQL()

SqlCommand IS.Base.DBBase.createCommandSQL ( string Sql,
params spParam[] para )
inline

create command from direct sql

Parameters
SqlThe SQL.
paraThe para.
Returns

◆ doCommand()

int IS.Base.DBBase.doCommand ( ref SqlCommand cm)
inline

Does the command.

Parameters
cmThe cm.
Returns
Negative value: error, else number of rows affected

◆ doSQL()

int IS.Base.DBBase.doSQL ( string SQL)
inline

Does the SQL.

Parameters
SQLThe SQL.
Returns
Negative value: error, else number of rows affected

◆ doStoreProcedure()

int IS.Base.DBBase.doStoreProcedure ( string spName,
params spParam[] para )
inline

doStoreProcedure Does the store procedure.

Parameters
spNameName of the sp.
paraThe para.
Returns
Negative value: error, else number of rows affected

◆ getCommand() [1/4]

int IS.Base.DBBase.getCommand ( ref System::Data::DataSet ds,
ref SqlCommand cm )
inline

Gets the store procedure.

Parameters
dsThe ds.
cmThe cm.
Returns
Negative value means error, else the number of records

◆ getCommand() [2/4]

int IS.Base.DBBase.getCommand ( ref System::Data::DataSet ds,
string sTableName,
ref SqlCommand cm )
inline

Gets the store procedure.

Parameters
dsThe ds.
sTableNameName of the s table.
cmThe cm.
Returns
Negative value means error, else the number of records

◆ getCommand() [3/4]

int IS.Base.DBBase.getCommand ( ref System::Data::DataSet ds,
string sTableName,
SqlCommand cm )
inline

Gets the command.

Parameters
dsThe ds.
sTableNameName of the s table.
cmThe cm.
Returns

◆ getCommand() [4/4]

SqlDataReader IS.Base.DBBase.getCommand ( SqlCommand cm)
inline

Gets the command.

Parameters
cmThe cm.
Returns

◆ getCommandTable()

DataTable IS.Base.DBBase.getCommandTable ( SqlCommand cm)
inline

Gets the command table.

Parameters
cmThe cm.
Returns

◆ getCount()

int IS.Base.DBBase.getCount ( ref SqlCommand cm)
inline

Get the count(*) in select and convert it to int.

Parameters
cmSql command that contain the select count(*)
Returns
Return >=0 is the count(*) else error

◆ getPage() [1/2]

DataTable IS.Base.DBBase.getPage ( ref SqlCommand cm,
int startRecord,
int rowPerPage )
inline

Gets the page.

Parameters
cmThe cm.
startRecordThe start record.
rowPerPageThe row per page.
Returns

◆ getPage() [2/2]

DataTable IS.Base.DBBase.getPage ( string sql,
int startRecord,
int rowPerPage )
inline

Gets the page.

Parameters
sqlThe SQL.
startRecordThe start record.
rowPerPageThe row per page.
Returns

◆ getSQL() [1/2]

int IS.Base.DBBase.getSQL ( ref DataSet ds,
string sTableName,
string SQL )
inline

Gets the SQL.

Parameters
dsThe ds.
sTableNameName of the s table.
SQLThe SQL.
Returns
-1: error, else number of record returned

◆ getSQL() [2/2]

SqlDataReader IS.Base.DBBase.getSQL ( string SQL)
inline

Gets the SQL.

Parameters
SQLThe SQL.
Returns
null for error, else the result

◆ getSQLTable()

DataTable IS.Base.DBBase.getSQLTable ( string SQL)
inline

Gets the SQL.

Parameters
SQLThe SQL.
Returns
null for error, else the result

◆ getStoreProcedure()

int IS.Base.DBBase.getStoreProcedure ( ref DataSet ds,
string tbName,
string storePocedureName,
params spParam[] para )
inline

Gets the store procedure.

Parameters
dsThe ds.
tbNameName of the tb.
storePocedureNameName of the store pocedure.
paraThe para.
Returns
negative value means error, else number of records

◆ getTran()

SqlTransaction IS.Base.DBBase.getTran ( )
inline

get current transation

Returns

◆ getVersion()

int IS.Base.DBBase.getVersion ( )
inline

Lấy phiên bản chính của sql server hiện tại.

Returns

◆ Open()

int IS.Base.DBBase.Open ( )
inline

Opens this instance.

Returns

◆ rollback()

int IS.Base.DBBase.rollback ( )
inline

Rollbace the current transaction.

Returns

◆ setCommandTimeout()

void IS.Base.DBBase.setCommandTimeout ( int _value)
inline

Giá trị mặc định theo SQL, được tính theo đơn vị giây.

Parameters
_value

◆ setConnection()

void IS.Base.DBBase.setConnection ( SqlConnection _conn)
inline

Sets the connection.

Parameters
_connThe _conn.

◆ setTran()

void IS.Base.DBBase.setTran ( SqlTransaction pTran)
inline

Gán transaction trong SQL cho đối tượng này để đảm bảo nhiều đối tượng có thể thực hiện được cùng một phiên dữ liệu.

Parameters
pTran

Property Documentation

◆ Connected

bool IS.Base.DBBase.Connected
get

Gets a value indicating whether this DBBase is connected.

true if connected; otherwise, false.

◆ Connection

SqlConnection IS.Base.DBBase.Connection
get

Gets the connection.

The connection.

◆ ConnectionString

string IS.Base.DBBase.ConnectionString
getset

Gets or sets the connection string.

The connection string.


The documentation for this class was generated from the following file: