public SYS_Exception SelectSYS_Exception(int ID) { SYS_Exception sys_exception = new SYS_Exception(); DbDataReader reader = null; DbConnection connection = Common.CreateConnection(Common.ConnectionString); connection.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Exception_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_ExceptionDataAccess.SetSYS_ExceptionInfo(reader, ref sys_exception); } return(sys_exception); } catch (Exception ex) { throw new Exception(String.Format("SYS_ExceptionDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } connection.Close(); } }
private static void SetListSYS_ExceptionInfo(ref DbDataReader reader, ref List <SYS_Exception> sys_exceptions) { SYS_Exception sys_exception = null; while (reader.Read()) { sys_exception = new SYS_Exception(); SYS_ExceptionDataAccess.SetSYS_ExceptionInfo(reader, ref sys_exception); sys_exceptions.Add(sys_exception); } }