Ejemplo n.º 1
0
        // GET: Employee
        public ActionResult Index()
        {
            if (Session["authenticated"] != null && (bool)Session["authenticated"] == true)
            {
                // logic to count user actions
                var userName = Session["userName"] as string;
                loginBL.UpdateActionCounter(userName);
                var amountActions = loginBL.GetUpdateActionsForUser(userName);
                Session["AmountOfActions"] = amountActions;
                if (amountActions < 0)
                {
                    TempData["ErrorMessage"] = "Logout out by the system! user doesn't have actions";
                    Session.Clear();
                    return(RedirectToAction("Index", "Login"));
                }

                var serachedList = TempData["searchedList"] as List <EmployeeWithDepDTO>;
                if (serachedList != null)
                {
                    ViewBag.employees = serachedList;
                }
                else
                {
                    ViewBag.employees = employeeBL.GetEmployeesWithDepartment();
                }
                ViewBag.shifts = employeeShiftBL.GetShiftsForEmployee();
                return(View());
            }
            return(RedirectToAction("Index", "Login"));
        }
Ejemplo n.º 2
0
 // GET: Department
 public ActionResult Index()
 {
     if (Session["authenticated"] != null && (bool)Session["authenticated"] == true)
     {
         // logic to count user actions
         var userName = Session["userName"] as string;
         loginBL.UpdateActionCounter(userName);
         var amountActions = loginBL.GetUpdateActionsForUser(userName);
         Session["AmountOfActions"] = amountActions;
         if (amountActions < 0)
         {
             TempData["ErrorMessage"] = "Logout out by the system! user doesn't have actions";
             Session.Clear();
             return(RedirectToAction("Index", "Login"));
         }
         else
         {
             var model = departmentBL.GetAll();
             foreach (var item in model)
             {
                 item.isExist = departmentBL.IsEmployeeInDepartment(item.DepId);
             }
             return(View(model));
         }
     }
     return(RedirectToAction("Index", "Login"));
 }