Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string column = "AnyColumn"; // This is column name (It is dynamic and has boolean value)
- //Calling the function and passing arguments
- ProcessingLayer.CheckClientsFeature(999, column);
- <------------------- This code can be in processing layer --------------------------->
- public object GetPropValue(object obj, string propName)
- {
- return obj.GetType().GetProperty(propName).GetValue(obj, null);
- }
- public bool CheckClientsFeature(int clientcode, string clientfeature)
- {
- var featureBoolVal = db.Clients.Where(x => x.ClientCode == clientcode).ToList().Select(x => GetPropValue(x, clientfeature)).FirstOrDefault();
- if(featureBoolVal.Equals(true))
- {
- return true;
- }
- return false;
- }
- <------------------------------------------------------------------------------------->
Add Comment
Please, Sign In to add comment