public static CustomList <HRM_Eval> GetAllHRM_Eval(String EvalKey) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <HRM_Eval> HRM_EvalCollection = new CustomList <HRM_Eval>(); IDataReader reader = null; String sql = "Select * from HRM_Eval Where EvalKey='" + EvalKey + "'"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { HRM_Eval newHRM_Eval = new HRM_Eval(); newHRM_Eval.SetData(reader); HRM_EvalCollection.Add(newHRM_Eval); } HRM_EvalCollection.InsertSpName = "spInsertHRM_Eval"; HRM_EvalCollection.UpdateSpName = "spUpdateHRM_Eval"; HRM_EvalCollection.DeleteSpName = "spDeleteHRM_Eval"; return(HRM_EvalCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <HRM_Eval> doSearch(string whereClause) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <HRM_Eval> HRM_EvalCollection = new CustomList <HRM_Eval>(); StringBuilder searchArg; searchArg = (StringBuilder)HttpContext.Current.Session[StaticInfo.SearchArg]; if (searchArg == null && whereClause == "") { return(HRM_EvalCollection); } string search = String.Empty; search = searchArg.ToString(); IDataReader reader = null; String sql = String.Empty; sql = "Select * from HRM_Eval Inner join HRM_Emp on HRM_Emp.EmpKey=HRM_Eval.EmpKey WHERE HRM_Eval.EmpKey=" + whereClause + ""; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { HRM_Eval newHRM_Emp = new HRM_Eval(); newHRM_Emp.SetData(reader); newHRM_Emp.SetDataEmp(reader); HRM_EvalCollection.Add(newHRM_Emp); } HRM_EvalCollection.InsertSpName = "spInsertHRM_Eval"; HRM_EvalCollection.UpdateSpName = "spUpdateHRM_Eval"; HRM_EvalCollection.DeleteSpName = "spDeleteHRM_Eval"; return(HRM_EvalCollection); } catch (Exception ex) { throw (ex); } finally { if (conManager != null) { conManager.CloseConnection(); conManager.Dispose(); } if (reader != null && !reader.IsClosed) { reader.Close(); } } }