//public SYS_Log SelectSYS_Log(int ID) //{ // SYS_Log sys_log = new SYS_Log(); // DbDataReader reader = null; // DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); // conn.Open(); // try // { // List<DbParameter> para = new List<DbParameter>(); // para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); // reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Log_SelectById]", para.ToArray()); // if (reader.HasRows && reader.Read()) // SYS_LogDataAccess.SetSYS_LogInfo(reader, ref sys_log); // return sys_log; // } // catch (Exception ex) // { // throw new Exception(String.Format("SYS_LogDataAccess.SelectById: {0}", ex.Message)); // } // finally // { // if (reader != null) // reader.Close(); // conn.Close(); // } //} //public List<SYS_Log> SelectAllSYS_Log() //{ // List<SYS_Log> sys_log = new List<SYS_Log>(); // DbDataReader reader = null; //DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); // conn.Open(); // try // { // reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Log_SelectAll]",(DbParameter[])null); // if (reader.HasRows) // SYS_LogDataAccess.SetListSYS_LogInfo(ref reader, ref sys_log); // return sys_log; // } // catch (Exception ex) // { // throw new Exception(String.Format(" SYS_LogDataAccess.SelectAll: {0}", ex.Message)); // } // finally // { // if (reader != null) // reader.Close(); // conn.Close(); // } //} public BindingList <SYS_Log> SelectBindingAllSYS_Log() { BindingList <SYS_Log> sys_log = new BindingList <SYS_Log>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Log_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_LogDataAccess.SetBindingListSYS_LogInfo(ref reader, ref sys_log); } return(sys_log); } catch (Exception ex) { throw new Exception(String.Format(" SYS_LogDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public SYS_Log SelectSYS_Logstr(string connect, int ID) { SYS_Log sys_log = new SYS_Log(); DbDataReader reader = null; DbConnection connection = _DbHelper.CreateConnection(connect); connection.Open(); try { List<DbParameter> para = new List<DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Log_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) SYS_LogDataAccess.SetSYS_LogInfo(reader, ref sys_log); } catch (Exception ex) { throw new Exception(String.Format("SYS_LogDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) reader.Close(); connection.Close(); } return sys_log; }
private static void SetBindingListSYS_LogInfo(ref DbDataReader reader, ref BindingList <SYS_Log> sys_logs) { SYS_Log sys_log = null; while (reader.Read()) { sys_log = new SYS_Log(); SYS_LogDataAccess.SetSYS_LogInfo(reader, ref sys_log); sys_logs.Add(sys_log); } }