Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB.net - Macro Substitution
Message
From
10/01/2011 04:05:17
 
 
To
09/01/2011 13:23:49
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01488984
Message ID:
01495386
Views:
69
>OH MY GOD - that was it?!
>
>Yup that did the trick! I still have a few changes i need to do to that code - such as dynamicly assign the enum values to the param variable, but that should not be a problem. Those user permissions are actually comming from the Active Directory depending what groups a user belongs to. Currently i am putting those into an array.
>
Dim param As e_SecurityCodes = e_SecurityCodes.DMS_Accounting_PR
>I might start another thread tomorow depending if i can figure out how to dynamicly create the enum structure based on rows in a table - i like keeping things flexible. But i am gonna play around with this for a while.
>
>Thank you SO much, you have realy gone out of your way to explain things to non dot netter.

Not very good at explaining things - but we got there in the end. As a side note: you could organise the enum values better if it's not too late. Something like:
<Flags()> _
Public Enum E_SecurityCodes
    DMS_None = 0
    DMS_Accounting_AR = 1
    DMS_Accounting_AP = 2
    DMS_Accounting_PR = 4
    DMS_Accounting_All = 7
    'Or, if you don't trust your maths, you can use
    'DMS_Accounting_All = DMS_Accounting_AR Or DMS_Accounting_AP Or DMS_Accounting_PR
    DMS_HR_Employee = 8
    DMS_HR_Caregiver = 16
    DMS_HR_All = 24
    DMS_Client = 32
    DMS_All = 63
End Enum
This way you use up a lot less ints but, more importantly (assuming I've interpreted your intentions correctly) DMS_Accounting_All will actually include the AR,AP and PR flags, DMS_HR_All will include the Employee and CareGiver options and DMS_All will include all flags. This approach can, for example, simplify your filtering. If you want to filter on records with any accounting flag you can just use :
Dim list= (From x In result_Match Where x.SecurityCodes.IncludeIfAnyOf(DMS_Accounting_All) Select x).ToList()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform