/// <summary> /// Memthod GetFunctionWorkflowFormFunctionID /// </summary> /// <param name="functionID"></param> /// <param name="memberUser"></param> /// <returns>MaintenanceWorkflow of memberUser</returns> private static MaintenanceWorkflow GetFunctionWorkflowFormFunctionID(int functionID, MemberUser memberUser) { MaintenanceWorkflow fwf = new MaintenanceWorkflow(); foreach (MaintenanceWorkflow fw in memberUser.GetEffectiveCreatorMaintenanceWorkflows()) { if (fw.MemberFunction.FunctionID == functionID) { fwf = fw; break; } } return(fwf); }
/// <summary> /// Memthod UserCanAccess /// </summary> /// <param name="memberUser"></param> /// <param name="functionIds"></param> /// <returns>Access right of each MemberUser</returns> public bool UserCanAccess(MemberUser memberUser, IList <int> functionIds) { foreach (var wf in memberUser.GetEffectiveCreatorMaintenanceWorkflows()) { foreach (var functionId in functionIds) { if (wf.MemberFunction.FunctionID == functionId) { return(true); } } } return(false); }
public static MaintenanceWorkflow GetFunctionMaintenanceWorkflow(MemberUser memberUser, int functionId) { try { var fwf = new MaintenanceWorkflow(); foreach (var fw in memberUser.GetEffectiveCreatorMaintenanceWorkflows().Where(fw => fw.MemberFunction.FunctionID == functionId)) { fwf = fw; break; } return(fwf); } catch (NullReferenceException) { throw new NullReferenceException("function work flow is null"); } }