I'm wondering if I can do something like this in c#:
public CustomerManagerScreen()
{
[TestAttirubute("CustomerManagerScreen_Load")]
private void CustomerManagerScreen_Load(object sender, EventArgs e)
{
CustomerLoad();
}
}
as you can see, method name is a parameter of TestAttribute, what I want to achieve is CustomerManagerScreen_Load will be discarded depending on the result of the TestAttirubute
this is the attribute class...
public class TestAttirubute: System.Attribute
{
private string _MethodName = string.Empty;
public TestAttirubute(string MethodName)
{
this._MethodName = MethodName;
}
public bool hasPermission()
{
return (SessionManager.CurrentUser.UserRole.Role.Rights.Where(a => a.Resource.Code == this._MethodName).Count() != 0) ? true: false;
}
}