コード例 #1
0
        public List <SYS_Position> SelectAllSYS_Position()
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            List <SYS_Position> sys_position = new List <SYS_Position>();
            DbDataReader        reader       = null;

            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Position_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_PositionDataAccess.SetListSYS_PositionInfo(ref reader, ref sys_position);
                }
                return(sys_position);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_PositionDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
コード例 #2
0
        public SYS_Position SelectSYS_Position(int ID)
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            SYS_Position sys_position = new SYS_Position();
            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_Position_GetByID]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_PositionDataAccess.SetSYS_PositionInfo(reader, ref sys_position);
                }
                return(sys_position);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_PositionDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
コード例 #3
0
        private static void SetListSYS_PositionInfo(ref DbDataReader reader, ref List <SYS_Position> sys_positions)
        {
            SYS_Position sys_position = null;

            while (reader.Read())
            {
                sys_position = new SYS_Position();
                SYS_PositionDataAccess.SetSYS_PositionInfo(reader, ref sys_position);
                sys_positions.Add(sys_position);
            }
        }