Example #1
0
        public SYS_Language SelectSYS_Language(int ID)
        {
            SYS_Language sys_language = new SYS_Language();
            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_Language_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_LanguageDataAccess.SetSYS_LanguageInfo(reader, ref sys_language);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_LanguageDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(sys_language);
        }
Example #2
0
        public List <SYS_Language> SelectAllSYS_Language()
        {
            List <SYS_Language> sys_language = new List <SYS_Language>();
            DbDataReader        reader       = null;
            DbConnection        connection   = _DbHelper.CreateConnection(Common.ConnectionString);

            connection.Open();
            try
            {
                reader = _DbHelper.ExecuteReader(connection, Common.DatabaseSchema + "[SYS_Language_SelectAll]",
                                                 (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_LanguageDataAccess.SetListSYS_LanguageInfo(ref reader, ref sys_language);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_LanguageDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                connection.Close();
            }
            return(sys_language);
        }
        private static void SetListSYS_LanguageInfo(ref DbDataReader reader, ref List <SYS_Language> sys_languages)
        {
            SYS_Language sys_language = null;

            while (reader.Read())
            {
                sys_language = new SYS_Language();
                SYS_LanguageDataAccess.SetSYS_LanguageInfo(reader, ref sys_language);
                sys_languages.Add(sys_language);
            }
        }