public BindingList <DM_MODULE> SelectBindingAllDM_MODULE() { BindingList <DM_MODULE> dm_module = new BindingList <DM_MODULE>(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[DM_MODULE_SelectAll]", (DbParameter[])null); if (reader.HasRows) { DM_MODULEDataAccess.SetBindingListDM_MODULEInfo(ref reader, ref dm_module); } return(dm_module); } catch (Exception ex) { throw new Exception(String.Format(" DM_MODULEDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public DM_MODULE SelectDM_MODULE(int IDMODULE) { DM_MODULE dm_module = new DM_MODULE(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_IDMODULE, IDMODULE, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[DM_MODULE_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { DM_MODULEDataAccess.SetDM_MODULEInfo(reader, ref dm_module); } return(dm_module); } catch (Exception ex) { throw new Exception(String.Format("DM_MODULEDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetBindingListDM_MODULEInfo(ref DbDataReader reader, ref BindingList <DM_MODULE> dm_modules) { DM_MODULE dm_module = null; while (reader.Read()) { dm_module = new DM_MODULE(); DM_MODULEDataAccess.SetDM_MODULEInfo(reader, ref dm_module); dm_modules.Add(dm_module); } }