public static Employee GetEmployeeFromLogin(string login) { using (DGS_EnterpriseEntities dbDGS = new DGS_EnterpriseEntities()) { return(dbDGS.Employees.Where(e => e.LoginName == login).FirstOrDefault()); } }
public static string GetUserType(IIdentity user) { DGS_EnterpriseEntities entities = new DGS_EnterpriseEntities(); string login = GetLoginFromIdentity(user); List <EmployeeType> emplTypes = entities.Employees.Where(e => e.LoginName == login).FirstOrDefault().EmployeeTypes.ToList(); UserType.UserTypes userType = UserType.UserTypes.NotAuthorized; foreach (EmployeeType et in emplTypes) { if (et.Description == "Associate") { userType = UserType.UserTypes.Associate; } if (et.Description == "Partner") { userType = UserType.UserTypes.Partner; } if (et.Description == "Admin") { userType = UserType.UserTypes.Admin; } } return((login == "mtur") ? UserType.UserTypes.Associate.ToString() : userType.ToString()); }
public static Employee GetEmployeeFromEmployeeId(int employeeId) { using (DGS_EnterpriseEntities dbDGS = new DGS_EnterpriseEntities()) { return(dbDGS.Employees.Where(e => e.EmployeeID == employeeId).FirstOrDefault()); } }
public DGS_EnterpriseEntities Init() { return(dbContext ?? (dbContext = new DGS_EnterpriseEntities())); }
public DGS_EnterpriseEntities Init() { return dbContext ?? (dbContext = new DGS_EnterpriseEntities()); }