Пример #1
0
        public SYS_RightOfUser SelectSYS_RightOfUser(int ID)
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();

            SYS_RightOfUser sys_rightofuser = new SYS_RightOfUser();
            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_RightOfUser_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_RightOfUserDataAccess.SetSYS_RightOfUserInfo(reader, ref sys_rightofuser);
                }
                return(sys_rightofuser);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_RightOfUserDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Пример #2
0
        private static void SetListSYS_RightOfUserInfo(ref DbDataReader reader, ref List <SYS_RightOfUser> sys_rightofusers)
        {
            SYS_RightOfUser sys_rightofuser = null;

            while (reader.Read())
            {
                sys_rightofuser = new SYS_RightOfUser();
                SYS_RightOfUserDataAccess.SetSYS_RightOfUserInfo(reader, ref sys_rightofuser);
                sys_rightofusers.Add(sys_rightofuser);
            }
        }