Exemplo n.º 1
0
        public List <SYS_RoleOfUser> SelectSYS_RoleOfUserByRoleID(int RoleID)
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            List <SYS_RoleOfUser> sys_roleofuser = new List <SYS_RoleOfUser>();
            DbDataReader          reader         = null;

            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_USERID, RoleID, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_RoleOfUser_SelectByIDRole]", para.ToArray());

                SYS_RoleOfUserDataAccess.SetListSYS_RoleOfUserInfo(ref reader, ref sys_roleofuser);
                return(sys_roleofuser);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_RoleOfUserDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
Exemplo n.º 2
0
        public List <SYS_RoleOfUser> SelectAllSYS_RoleOfUser()
        {
            DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            List <SYS_RoleOfUser> sys_roleofuser = new List <SYS_RoleOfUser>();
            DbDataReader          reader         = null;

            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_RoleOfUser_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_RoleOfUserDataAccess.SetListSYS_RoleOfUserInfo(ref reader, ref sys_roleofuser);
                }
                return(sys_roleofuser);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_RoleOfUserDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }