Пример #1
0
 public static Employee GetEmployeeFromLogin(string login)
 {
     using (DGS_EnterpriseEntities dbDGS = new DGS_EnterpriseEntities())
     {
         return(dbDGS.Employees.Where(e => e.LoginName == login).FirstOrDefault());
     }
 }
Пример #2
0
        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());
        }
Пример #3
0
 public static Employee GetEmployeeFromEmployeeId(int employeeId)
 {
     using (DGS_EnterpriseEntities dbDGS = new DGS_EnterpriseEntities())
     {
         return(dbDGS.Employees.Where(e => e.EmployeeID == employeeId).FirstOrDefault());
     }
 }
Пример #4
0
 public DGS_EnterpriseEntities Init()
 {
     return(dbContext ?? (dbContext = new DGS_EnterpriseEntities()));
 }
Пример #5
0
 public DGS_EnterpriseEntities Init()
 {
     return dbContext ?? (dbContext = new DGS_EnterpriseEntities());
 }