Ejemplo n.º 1
0
        public List <SYS_Config> SelectAllSYS_Config()
        {
            List <SYS_Config> sys_config = new List <SYS_Config>();
            DbDataReader      reader     = null;
            DbConnection      connection = _DbHelper.CreateConnection(Common.ConnectionString);

            connection.Open();
            try
            {
                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Config_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_ConfigDataAccess.SetListSYS_ConfigInfo(ref reader, ref sys_config);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_ConfigDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(sys_config);
        }
Ejemplo n.º 2
0
        public SYS_Config SelectSYS_Config(int ID)
        {
            SYS_Config   sys_config = new SYS_Config();
            DbDataReader reader     = null;
            DbConnection connection = _DbHelper.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_Config_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_ConfigDataAccess.SetSYS_ConfigInfo(reader, ref sys_config);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_ConfigDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Open();
            }
            return(sys_config);
        }
Ejemplo n.º 3
0
        private static void SetListSYS_ConfigInfo(ref DbDataReader reader, ref List <SYS_Config> sys_configs)
        {
            SYS_Config sys_config = null;

            while (reader.Read())
            {
                sys_config = new SYS_Config();
                SYS_ConfigDataAccess.SetSYS_ConfigInfo(reader, ref sys_config);
                sys_configs.Add(sys_config);
            }
        }