public List <T> GetEntities <T>(string strSql, List <SqlParameter> listPar) where T : new() { try { DataTable dt; List <T> listClass = new List <T>(); if (listPar != null) { dt = QueryDataTable(strSql, listPar); } else { dt = QueryDataTable(strSql); } for (int i = 0; i < dt.Rows.Count; i++) { T typeClass = new T(); typeClass = SetValueTools.SetPropertyValue <T>(dt, i); listClass.Add(typeClass); } return(listClass); } catch { throw; } }
public T GetEntity <T>(string strSql, List <SqlParameter> listPar) where T : new() { try { DataTable dt; List <T> listClass = new List <T>(); if (listPar != null) { dt = QueryDataTable(strSql, listPar); } else { dt = QueryDataTable(strSql); } T typeClass = new T(); typeClass = SetValueTools.SetPropertyValue <T>(dt, 0); listClass.Add(typeClass); return(typeClass); } catch { throw; } }