public static CustomList <OutOfOfficeInfo> GetExistingEntry(string fromDate, string toDate, string empKey) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <OutOfOfficeInfo> OutOfOfficeInfoCollection = new CustomList <OutOfOfficeInfo>(); IDataReader reader = null; try { String sql = "EXEC spGetOutOfOfficeEntry '" + fromDate + "','" + toDate + "','" + empKey + "'"; conManager.OpenDataReader(sql, out reader); while (reader.Read()) { OutOfOfficeInfo newOutOfOfficeInfo = new OutOfOfficeInfo(); newOutOfOfficeInfo.SetData(reader); newOutOfOfficeInfo.EmpCode = reader.GetString("EmpCode"); newOutOfOfficeInfo.EmpName = reader.GetString("EmpName"); OutOfOfficeInfoCollection.Add(newOutOfOfficeInfo); } return(OutOfOfficeInfoCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <OutOfOfficeInfo> GetAllOutOfOfficeInfo() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <OutOfOfficeInfo> OutOfOfficeInfoCollection = new CustomList <OutOfOfficeInfo>(); IDataReader reader = null; const String sql = "select *from OutOfOfficeInfo"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { OutOfOfficeInfo newOutOfOfficeInfo = new OutOfOfficeInfo(); newOutOfOfficeInfo.SetData(reader); OutOfOfficeInfoCollection.Add(newOutOfOfficeInfo); } OutOfOfficeInfoCollection.InsertSpName = "spInsertOutOfOfficeInfo"; OutOfOfficeInfoCollection.UpdateSpName = "spUpdateOutOfOfficeInfo"; OutOfOfficeInfoCollection.DeleteSpName = "spDeleteOutOfOfficeInfo"; return(OutOfOfficeInfoCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <OutOfOfficeInfo> GetAllOutOutOfOfficeEntry(string date) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <OutOfOfficeInfo> OutOfOfficeInfoCollection = new CustomList <OutOfOfficeInfo>(); StringBuilder searchArg = new StringBuilder(); searchArg = (StringBuilder)HttpContext.Current.Session[StaticInfo.SearchArg]; if (searchArg == null) { return(OutOfOfficeInfoCollection); } string search = String.Empty; search = searchArg.ToString(); search = search + "@Date=" + "'" + date + "',"; search = search.Length > 0 ? search.Substring(0, search.Length - 1) : string.Empty; IDataReader reader = null; try { String sql = "EXEC spGetOutOfOfficeEntryEmpList " + search + ""; conManager.OpenDataReader(sql, out reader); while (reader.Read()) { OutOfOfficeInfo newOutOfOfficeInfo = new OutOfOfficeInfo(); newOutOfOfficeInfo.SetData(reader); newOutOfOfficeInfo.EmpName = reader.GetString("EmpName"); newOutOfOfficeInfo.PunchCardNo = reader.GetString("PunchCardNo"); newOutOfOfficeInfo.IsDefault = reader.GetBoolean("IsDefault"); OutOfOfficeInfoCollection.Add(newOutOfOfficeInfo); } return(OutOfOfficeInfoCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }