public static CustomList <ShiftRule> GetAllShiftRule() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <ShiftRule> ShiftRuleCollection = new CustomList <ShiftRule>(); IDataReader reader = null; const String sql = "Select * from ShiftRule"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { ShiftRule newShiftRule = new ShiftRule(); newShiftRule.SetData(reader); ShiftRuleCollection.Add(newShiftRule); } ShiftRuleCollection.InsertSpName = "spInsertShiftRule"; ShiftRuleCollection.UpdateSpName = "spUpdateShiftRule"; ShiftRuleCollection.DeleteSpName = "spDeleteShiftRule"; return(ShiftRuleCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList <ShiftRule> doSearch(string whereClause) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <ShiftRule> ShiftRuleCollection = new CustomList <ShiftRule>(); IDataReader reader = null; String sql = string.Format("Select * From [ShiftRule] Where 1=1 {0}", whereClause); try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { ShiftRule newShiftRule = new ShiftRule(); newShiftRule.SetData(reader); ShiftRuleCollection.Add(newShiftRule); } return(ShiftRuleCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }