Beispiel #1
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);
        }
Beispiel #2
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);
            }
        }