public static bool CheckIsDelegated(string sessionId) { DelegationServices.ValidateDelegateStatus(sessionId); var User = LoginServices.GetUserBySessionId(sessionId); if (db.emp_Delegations.Any(x => x.Emp_Id == User.Emp_Id && x.Status == "ACTIVE")) { return(true); } //Not Delegated For Particular Time Period return(false); }
public static Employee GetCurrentDelegate(string sessionId) { DelegationServices.ValidateDelegateStatus(sessionId); var cur = DateTime.Now; var user = LoginServices.GetUserBySessionId(sessionId); var list = db.emp_Delegations.Where(x => cur >= x.Start_Date && cur >= x.Start_Date && cur <= x.End_Date && x.Employee.Department.Dept_id == user.Dept_Id && x.Status == "ACTIVE").FirstOrDefault(); if (list == null) { return(null); } return(list.Employee); }