/// <Summary> /// DataTable is converted to a List set /// </summary> /// <typeparam name = "TResult"> type </typeparam> /// <param name = "dt"> DataTable </param> // <returns> </returns> public static List <TResult> ToList <TResult> (this DataTable dt) where TResult: class, new () /// <summary> /// convert to a able /// </summary> /// <typeparam name = "TResult"> </typeparam> /// <param name = "value"> </param> // <returns> </returns> public stati C DataTable ToDataTable <TResult> (this IEnumerable <TResult> value) where TResult: class business logic interface // name: wujc 2013-06-20namespace Yc. BLL {public class DataDomain: IDataService {private readonly IDataService dal = DataAccess. createService (); public DataDomain () {}# region member method /// <summary> // obtain the number of table rows /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "strWhere"> </param> /// <returns> </returns> Public int GetRowsCount <T> (string strWhere) where T: BaseModel, new () {return dal. getRowsCount <T> (strWhere );} /// <summary> /// obtain the number of table rows /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "SQL"> </param> // <returns> </returns> public int GetRowsCount (string SQL) {return dal. getRowsCount (SQL) ;}/// <summary> /// whether the record Exists /// </summary> public bool Exists <T> (string id) where T: baseModel, New () {return dal. exists <T> (id) ;}/// <summary> /// Add a data record /// </summary> public bool Add <T> (T model) where T: BaseModel, new () {return dal. add <T> (model );} /// <summary> /// add multiple pieces of data /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "modelList"> </param> // <returns> </returns> public bool Add <T> (List <T> modelList) where T: BaseModel, new () {return dal. add <T> (modelList);} // <summar Y> // Update a piece of data /// </summary> public bool Update <T> (T model) where T: BaseModel, new () {return dal. update <T> (model );} /// <summary> /// update multiple data entries /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "model"> </param> // <returns> </returns> public bool Update <T> (List <T> modelList) where T: BaseModel, new () {return dal. update <T> (modelList);} // <summary> // delete a data record // </summary> public bool D Elete <T> (string id) where T: BaseModel, new () {return dal. delete <T> (id );} /// <summary> /// delete a data record /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "id"> </param> // <returns> </returns> public bool Delete <T> (T model) where T: BaseModel, new () {return dal. delete <T> (model );} /// <summary> /// Delete multiple data entries /// </summary> /// <typeparam name = "T"> </typeparam> /// <param name = "model"> </param> // /<Returns> </returns> public bool Delete <T> (List <T> modelList) where T: BaseModel, new () {return dal. delete <T> (modelList );} /// <summary> /// batch delete data /// </summary> /// <param name = "idList"> separated by commas </param> /// <returns> </returns> public bool DeleteList <T> (string idList) where T: BaseModel, new () {return dal. deleteList <T> (idList) ;}/// <summary> /// get an object entity /// </summary> public T GetModel <T> (string id) Where T: BaseModel, new () {return dal. getModel <T> (id );} /// <summary> /// obtain all object entities /// </summary> public List <T> GetModelList <T> (string strWhere) where T: BaseModel, new () {return dal. getModelList <T> (strWhere) ;}/// <summary> // obtain the data list /// </summary> public DataSet GetList <T> (string strWhere) where T: BaseModel, new () {return dal. getList <T> (strWhere);} // <summary> // obtain the data table // </summary> publi C DataTable GetTable <T> (string strWhere) where T: BaseModel, new () {return dal. getTable <T> (strWhere) ;}/// <summary> /// obtain the data list by PAGE /// </summary> public DataSet GetList <T> (string strWhere, string orderby, int startIndex, int endIndex) where T: BaseModel, new () {return dal. getList <T> (strWhere, orderby, startIndex, endIndex) ;}/// <summary> /// obtain the data list by PAGE /// </summary> public DataSet GetListBySql (String SQL, string orderby, int startIndex, int endIndex) {return dal. getListBySql (SQL, orderby, startIndex, endIndex) ;}/// <summary> /// execute the SQL statement, returned Number of affected records /// </summary> /// <param name = "SQLString"> Number of affected records </param> /// <returns> /returns> public int ExecuteSql (string SQLString) {return dal. executeSql (SQLString) ;}/// <summary> /// execute the query statement, return DataSet /// </summary> /// <param name = "SQLString"> query statement </p Aram> // <returns> DataSet </returns> public DataSet Query (string SQLString) {return dal. query (SQLString) ;}/// <summary> /// execute multiple SQL statements to implement database transactions. /// </Summary> /// <param name = "SQLStringList"> hash table of the SQL statement (the key is an SQL statement, and the value is the SqlParameter [] of the statement) </param> public void ExecuteSqlTran (Hashtable SQLStringList) {dal. executeSqlTran (SQLStringList);} # endregion member Method