public static CustomList <DailyAttendance> GetAllDailyAttendance() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <DailyAttendance> DailyAttendanceCollection = new CustomList <DailyAttendance>(); IDataReader reader = null; const String sql = "select *from DailyAttendance"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { DailyAttendance newDailyAttendance = new DailyAttendance(); newDailyAttendance.SetData(reader); DailyAttendanceCollection.Add(newDailyAttendance); } DailyAttendanceCollection.InsertSpName = "spInsertDailyAttendance"; return(DailyAttendanceCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <DailyAttendance> GetAllAttForDailyAttendanceProcess(string fromDate, string toDate, string searchStr, string PW, string PH, string PLV, string SinglePunch) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <DailyAttendance> DailyAttendanceCollection = new CustomList <DailyAttendance>(); /*string search = String.Empty; * search = CommonHelper.CreateSearchString(); * if (search != "") * { * search = search.Length > 0 ? search.Substring(0, search.Length - 1) : string.Empty; * search = "@FromDate='" + fromDate + "',@ToDate='" + toDate + "'," + search; * } * else * { * search = "@FromDate='" + fromDate + "',@ToDate='" + toDate + "'," + search; * search = search.Length > 0 ? search.Substring(0, search.Length - 1) : string.Empty; * } * search = search + ",@SearchStr='" + searchStr + "'"; */ IDataReader reader = null; try { String sql = "EXEC spAttendanceProcess '" + fromDate + "','" + toDate + "','" + searchStr + "','" + PW + "','" + PH + "','" + PLV + "','" + SinglePunch + "'"; conManager.OpenDataReader(sql, out reader); while (reader.Read()) { DailyAttendance newAttendance = new DailyAttendance(); newAttendance.SetDataAtt(reader); DailyAttendanceCollection.Add(newAttendance); } return(DailyAttendanceCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }