public List <SYS_UserConfig> SelectAllSYS_UserConfig() { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); List <SYS_UserConfig> sys_userconfig = new List <SYS_UserConfig>(); DbDataReader reader = null; try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_UserConfig_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_UserConfigDataAccess.SetListSYS_UserConfigInfo(ref reader, ref sys_userconfig); } return(sys_userconfig); } catch (Exception ex) { throw new Exception(String.Format(" SYS_UserConfigDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public SYS_UserConfig SelectSYS_UserConfig(int ID) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); SYS_UserConfig sys_userconfig = new SYS_UserConfig(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_UserConfig_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_UserConfigDataAccess.SetSYS_UserConfigInfo(reader, ref sys_userconfig); } return(sys_userconfig); } catch (Exception ex) { throw new Exception(String.Format("SYS_UserConfigDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_UserConfigInfo(ref DbDataReader reader, ref List <SYS_UserConfig> sys_userconfigs) { SYS_UserConfig sys_userconfig = null; while (reader.Read()) { sys_userconfig = new SYS_UserConfig(); SYS_UserConfigDataAccess.SetSYS_UserConfigInfo(reader, ref sys_userconfig); sys_userconfigs.Add(sys_userconfig); } }