Hi folks,
I have a situation where I need a [flags] type enum to be
global. Within a
page I have no problem accessing or sending them to
functions; but as soon
as I try to pass them into a class method I get a property
versus class
error.
Basically this is a set of constants that define the action
a person can do
within the admin app (read, edit, create) , in the users
datatable is an
integer value derived from the combination of permissions
granted. 3 | 5 |
7 so a user with an action level at 7 can create new records
as well as
reading and editing existing records.
Using the flagsAttribute, it is easy to just to bitwise AND
then find out if
this person can create new records, if not then the add an
item option is
not visible.
Within the page it works perfectly; however I need to have
it available
throughout the application and not just at this one level.
It errors as
soon as I add the class (instantiated) name to the flagname
objUtils.ActionAttr myActionAttr.
This is what I am doing locally which works perfectly.
ActionAttr myActionAttr = (ActionAttr)thisUserActionAttr;
//where
thisUserActionAttr = 7
then I send it to a Boolean method called
chkActionAttr(ActionAttr userActionattr, ActionAttr
compareTo)
It does a bitwise AND between the two to determine if this
person can edit
or not.
I have a not so great work around that does not rely on
sending the enum
back and forth; but that is a pain in the a$$; but I will
take it if we
can't do it any other way.
Basically I send the integer value and a string then using a
switch
statement I assign the AND results to a boolean and return
it (ugh).
Any suggestions?
Pamela Reinskou, Sr. Application Architect
BCIP Certified Web Developer - Databases
VersusLaw, Inc.
Still Revolutionizing The Way America Does Law
http://www.versuslaw.com
425.250.0142
--- List Settings ---
http://aspadvice.com/list
s/
|