You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
8.6 KiB

  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.Common;
  6. using System.Data.SqlClient;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace NFine.Repository
  11. {
  12. public interface IDatabase : IDisposable
  13. {
  14. bool inTransaction { get; set; }
  15. DbTransaction BeginTrans();
  16. void Commit();
  17. void Rollback();
  18. void Close();
  19. bool BulkInsert(DataTable dt);
  20. int ExecuteBySql(StringBuilder strSql);
  21. int ExecuteBySql_Other(StringBuilder strSql, string Connect);
  22. int ExecuteBySql(StringBuilder strSql, DbTransaction isOpenTrans);
  23. int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters);
  24. int ExecuteBySql(StringBuilder strSql, DbParameter[] parameters, DbTransaction isOpenTrans);
  25. int ExecuteByProc(string procName);
  26. int ExecuteByProc(string procName, DbTransaction isOpenTrans);
  27. int ExecuteByProc(string procName, DbParameter[] parameters);
  28. int ExecuteByProc(string procName, DbParameter[] parameters, DbTransaction isOpenTrans);
  29. int Insert<T>(T entity);
  30. int Insert<T>(T entity, DbTransaction isOpenTrans);
  31. int Insert<T>(List<T> entity);
  32. int Insert<T>(List<T> entity, DbTransaction isOpenTrans);
  33. int Insert(string tableName, Hashtable ht);
  34. int Insert(string tableName, Hashtable ht, DbTransaction isOpenTrans);
  35. int Update<T>(T entity);
  36. int Update<T>(T entity, DbTransaction isOpenTrans);
  37. int Update<T>(string propertyName, string propertyValue);
  38. int Update<T>(string propertyName, string propertyValue, DbTransaction isOpenTrans);
  39. int Update<T>(List<T> entity);
  40. int Update<T>(List<T> entity, DbTransaction isOpenTrans);
  41. int Update(string tableName, Hashtable ht, string propertyName);
  42. int Update(string tableName, Hashtable ht, string propertyName, DbTransaction isOpenTrans);
  43. int Delete<T>(T entity);
  44. int Delete<T>(T entity, DbTransaction isOpenTrans);
  45. int Delete<T>(object propertyValue);
  46. int Delete<T>(object propertyValue, DbTransaction isOpenTrans);
  47. int Delete<T>(string propertyName, string propertyValue);
  48. int Delete<T>(string propertyName, string propertyValue, DbTransaction isOpenTrans);
  49. int Delete(string tableName, string propertyName, string propertyValue);
  50. int Delete(string tableName, string propertyName, string propertyValue, DbTransaction isOpenTrans);
  51. int Delete(string tableName, Hashtable ht);
  52. int Delete(string tableName, Hashtable ht, DbTransaction isOpenTrans);
  53. int Delete<T>(object[] propertyValue);
  54. int Delete<T>(object[] propertyValue, DbTransaction isOpenTrans);
  55. int Delete<T>(string propertyName, object[] propertyValue);
  56. int Delete<T>(string propertyName, object[] propertyValue, DbTransaction isOpenTrans);
  57. int Delete(string tableName, string propertyName, object[] propertyValue);
  58. int Delete(string tableName, string propertyName, object[] propertyValue, DbTransaction isOpenTrans);
  59. List<T> FindListTop<T>(int Top) where T : new();
  60. List<T> FindListTop<T>(int Top, string propertyName, string propertyValue) where T : new();
  61. List<T> FindListTop<T>(int Top, string WhereSql) where T : new();
  62. List<T> FindListTop<T>(int Top, string WhereSql, DbParameter[] parameters) where T : new();
  63. List<T> FindList<T>() where T : new();
  64. List<T> FindList<T>(string propertyName, string propertyValue) where T : new();
  65. List<T> FindList<T>(string WhereSql) where T : new();
  66. List<T> FindList<T>(string WhereSql, DbParameter[] parameters) where T : new();
  67. List<T> FindListBySql<T>(string strSql);
  68. List<T> FindListBySql<T>(string strSql, DbParameter[] parameters);
  69. List<T> FindListPage<T>(string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  70. List<T> FindListPage<T>(string WhereSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  71. List<T> FindListPage<T>(string WhereSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  72. List<T> FindListPageBySql<T>(string strSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  73. List<T> FindListPageBySql<T>(string strSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  74. DataTable FindTableTop<T>(int Top) where T : new();
  75. DataTable FindTableTop<T>(int Top, string WhereSql) where T : new();
  76. DataTable FindTableTop<T>(int Top, string WhereSql, DbParameter[] parameters) where T : new();
  77. DataTable FindTable<T>() where T : new();
  78. DataTable FindTable<T>(string WhereSql) where T : new();
  79. DataTable FindTable<T>(string WhereSql, DbParameter[] parameters) where T : new();
  80. DataTable FindTableBySql(string strSql);
  81. DataTable FindTableBySql(string strSql, DbParameter[] parameters);
  82. DataTable FindTablePage<T>(string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  83. DataTable FindTablePage<T>(string WhereSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  84. DataTable FindTablePage<T>(string WhereSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount) where T : new();
  85. DataTable FindTablePageBySql(string strSql, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  86. DataTable FindTablePageBySql(string strSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  87. DataTable FindTablePageBySql_ERP(string strSql, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount );
  88. DataTable GetDataTableBySql_ERP(string strSql, params SqlParameter[] spArr);
  89. DataTable FindTablePageBySql_Other(string strSql, string connectstr, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  90. DataTable FindTablePageBySql_OtherTemp(string strSql, string TempName, string Droptable, string connectstr, DbParameter[] parameters, string orderField, string orderType, int pageIndex, int pageSize, ref int recordCount);
  91. DataTable GetDataTableBySql_Other(string strSql, string connectstr, params SqlParameter[] spArr);
  92. DataTable FindTableByProc(string procName);
  93. DataTable FindTableByProc(string procName, DbParameter[] parameters);
  94. DataSet FindDataSetBySql(string strSql);
  95. DataSet FindDataSetBySql(string strSql, DbParameter[] parameters);
  96. DataSet FindDataSetByProc(string procName);
  97. DataSet FindDataSetByProc(string procName, DbParameter[] parameters);
  98. T FindEntity<T>(object propertyValue) where T : new();
  99. T FindEntity<T>(string propertyName, object propertyValue) where T : new();
  100. T FindEntityByWhere<T>(string WhereSql) where T : new();
  101. T FindEntityByWhere<T>(string WhereSql, DbParameter[] parameters) where T : new();
  102. T FindEntityBySql<T>(string strSql);
  103. T FindEntityBySql<T>(string strSql, DbParameter[] parameters);
  104. Hashtable FindHashtable(string tableName, string propertyName, object propertyValue);
  105. Hashtable FindHashtable(string tableName, StringBuilder WhereSql);
  106. Hashtable FindHashtable(string tableName, StringBuilder WhereSql, DbParameter[] parameters);
  107. Hashtable FindHashtableBySql(string strSql);
  108. Hashtable FindHashtableBySql(string strSql, DbParameter[] parameters);
  109. int FindCount<T>() where T : new();
  110. int FindCount<T>(string propertyName, string propertyValue) where T : new();
  111. int FindCount<T>(string WhereSql) where T : new();
  112. int FindCount<T>(string WhereSql, DbParameter[] parameters) where T : new();
  113. int FindCountBySql(string strSql);
  114. int FindCountBySql(string strSql, DbParameter[] parameters);
  115. object FindMax<T>(string propertyName) where T : new();
  116. object FindMax<T>(string propertyName, string WhereSql) where T : new();
  117. object FindMax<T>(string propertyName, string WhereSql, DbParameter[] parameters) where T : new();
  118. object FindMaxBySql(string strSql);
  119. object FindMaxBySql(string strSql, DbParameter[] parameters);
  120. }
  121. }