public BOSettingComparer(BOSetting.Columns column, BOSetting.SortDirections direction) { _column = column; _direction = direction; }
public static BOSetting GetByKey(string key) { logger.Trace("GetByKey"); SqlConnection con = new SqlConnection(GetConnectionString()); con.Open(); try { SqlCommand cmd = new SqlCommand("P_Setting_GetByKey", con); cmd.CommandType = CommandType.StoredProcedure; SetCharParameter(cmd.Parameters, "@SET_Key", MAXIMUM_LENGTH_KEY, key, false); SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleResult); try { if (rdr.Read()) { BOSetting BusinessObject = new BOSetting(rdr); return BusinessObject; } else { //Create Key if it does not exist BOSetting BusinessObject = new BOSetting(); BusinessObject.Key = key; BusinessObject.Save(); return BusinessObject; } } finally { rdr.Close(); } } finally { con.Close(); } }