Exemplo n.º 1
0
        public static bool IsUserManager(int userId, TabelContext context)
        {
            var employee = context.Employees.Include("Role").FirstOrDefault(em => em.Id == userId);

            if (employee == null)
            {
                return(false);
            }
            return(employee.Role.Name == VariablesConfig.AdminRoleName);
        }
Exemplo n.º 2
0
        public Employee Login(LoginViewModel loginVm)
        {
            Employee result;

            using (var db = new TabelContext())
            {
                result = db.Employees.Include("Role").FirstOrDefault(em => em.Email == loginVm.Login &&
                                                                     em.Pass == loginVm.Password);
            }
            return(result);
        }
Exemplo n.º 3
0
        public static Employee GetCurrentUser(HttpSessionStateBase session)
        {
            if (!Convert.ToBoolean(session["Authorised"]))
            {
                return(null);
            }

            int id;

            if (!int.TryParse(session["UserId"].ToString(), out id))
            {
                return(null);
            }

            using (var db = new TabelContext())
            {
                return(db.Employees.Include("Role").FirstOrDefault(em => em.Id == id));
            }
        }
Exemplo n.º 4
0
        public static bool IsLogged(HttpSessionStateBase session)
        {
            if (!Convert.ToBoolean(session["Authorised"]))
            {
                return(false);
            }

            int id;

            if (!int.TryParse(session["UserId"].ToString(), out id))
            {
                return(false);
            }

            using (var db = new TabelContext())
            {
                return(db.Employees.FirstOrDefault(em => em.Id == id) != null);
            }
        }
Exemplo n.º 5
0
 public EmployeeService(TabelContext tabelContext) : base(tabelContext)
 {
 }
Exemplo n.º 6
0
 public TimesheetService(TabelContext tabelContext)
     : base(tabelContext)
 {
 }
Exemplo n.º 7
0
 protected BaseDataEditService(TabelContext tabelContext)
 {
     _tabelContext = tabelContext;
 }