using EasyNet.Common;
using EasyNet.Manager;
using System;
namespace EasyNet.DBUtility
{
public class DBHelper
{
private DbManager m;
public DBHelper()
{
m = DbManager.PriviteInstance();
}
public static DBHelper GetInstance() => new DBHelper();
///
/// 自定義刪除資料
///
/// todo: describe obj parameter on Delete
/// sql
///
public int Delete(Object obj) => m.Delete(obj);
///
/// 自定義修改資料
///
/// todo: describe obj parameter on Update
/// sql
///
public int Update(Object obj) => m.Update(obj);
///
/// 自定義修改資料(MasterDteil)
///
/// todo: describe obj parameter on UpdateTran
/// sql
///
public int UpdateTran(Object obj) => m.UpdateTran(obj);
///
/// 自定義修改資料
///
/// todo: describe obj parameter on Insert
/// sql
///
public int Insert(Object obj) => m.Insert(obj);
///
/// 執行預存函數
///
/// 參數
///
public static int ExecuteSqlTran(Object param) => DbManager.ExecuteSqlTran(param);
///
/// 根據SQL查詢資料
///
/// SQL命令
/// todo: describe obj parameter on QueryList
/// 對象類型
///
public static Object QueryList(string sSql, Object obj) => DbManager.QueryList(sSql, obj);
///
/// 根據SQL查詢資料
///
/// todo: describe obj parameter on QueryCount
/// 對象類型
///
public static int QueryCount(Object obj) => DbManager.QueryCount(obj);
///
/// 根據SQL查詢單筆資料
///
/// SQL命令
/// todo: describe obj parameter on QueryOne
/// 對象類型
///
public static Object QueryOne(string sSql, Object obj) => DbManager.QueryOne(sSql, obj);
///
/// 分頁查詢返回分頁對象
///
/// 對象類型
/// 參數
///
public PageResult QueryPage(ParamMap param) => m.QueryPage(param);
///
/// 分頁查詢返回分頁對象
///
/// SQL命令
/// 參數
/// todo: describe bCount parameter on QueryPageByPrc
/// 對象類型
///
public static PageResult QueryPageByPrc(string sSql, Object param, bool bCount) => DbManager.QueryPageByPrc(sSql, param, bCount);
///
/// 開啟事務
///
public void BeginTransaction()
{
m.BeginTransaction();
}
///
/// 提交事務
///
public void CommitTransaction()
{
m.Commit();
}
///
/// 回滾事務
///
public void RollbackTransaction()
{
m.Rollback();
}
}
}