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