Пример #1
0
        public ActionResult ChangeOrderStatus(int id, int newStatus)
        {
            _employeesHelper.ChangeOrderStatus(id, newStatus);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie zmieniono status!");

            return(Json(new { success = true, data = "" }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult DeleteKey(int id)
        {
            _employeesHelper.DeleteKey(id);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto kod!");

            return(RedirectToAction("RegisterKeys"));
        }
Пример #3
0
        public ActionResult DeleteOrder(int id)
        {
            _employeesHelper.DeleteOrder(id);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usnięto zamówienie!");

            return(RedirectToAction("OrderManagment"));
        }
Пример #4
0
        public ActionResult MakeAdmin(int id)
        {
            _employeesHelper.MakeAdmin(id);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie nadano uprawnienia!");

            return(RedirectToAction("EmployeeManagment"));
        }
Пример #5
0
        public ActionResult DeleteItem(int id)
        {
            _employeesHelper.DeleteItem(id);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto produkt!");

            return(RedirectToAction("ItemsManagment"));
        }
Пример #6
0
        public ActionResult DeleteOpinion(int id)
        {
            _employeesHelper.DeleteOpinion(id);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto opinię!");

            return(RedirectToAction("Opinions"));
        }
Пример #7
0
        public ActionResult ItemAdd(ItemModel model, List <HttpPostedFileBase> fileUpload)
        {
            _employeesHelper.AddProduct(model, fileUpload);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie dodano produkt!");

            return(RedirectToAction("ItemsManagment"));
        }
Пример #8
0
        public ActionResult ItemsEdit(ItemModel model)
        {
            _employeesHelper.EditProduct(model, Request.Files);
            TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie zmodyfikowano produkt!");

            return(RedirectToAction("ItemsManagment"));
        }
Пример #9
0
        public async Task <IActionResult> Edit(int id, [Bind("AlertId,EmployeeId,Alert")] EmployeeAlert employeeAlert)
        {
            if (id != employeeAlert.AlertId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeAlert);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeAlertExists(employeeAlert.AlertId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "Firstname", employeeAlert.EmployeeId);
            return(View(employeeAlert));
        }
Пример #10
0
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            var session = filterContext.HttpContext.Session["Employee"] as employees;
            var rule    = session.Id_Rule;

            if (rule != (int)Rules.Admin)
            {
                filterContext.Result = new RedirectResult("/Pracownik/Konto");
                filterContext.Controller.TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie masz uprawnień do tego typu operacji!");
            }
        }
Пример #11
0
        public async Task <IActionResult> Create([Bind("AlertId,EmployeeId,Alert")] EmployeeAlert employeeAlert)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeAlert);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "Firstname", employeeAlert.EmployeeId);
            return(View(employeeAlert));
        }
Пример #12
0
        public ActionResult ClientDelete(int id)
        {
            var result = _employeesHelper.TryDeleteClient(id);

            if (result)
            {
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto klienta!");
            }
            else
            {
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Brak możliwości usunięcia! Klient posiada aktywne zamówienia!");
            }

            return(RedirectToAction("ClientManagment"));
        }
Пример #13
0
        public ActionResult DeleteAdmin(int id)
        {
            var session = Session["Employee"] as employees;

            if (session.Id == id)
            {
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie możesz sam sobie odebrać uprawnień!");
            }
            else
            {
                _employeesHelper.DeleteAdmin(id);
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie odebrano uprawnienia!");
            }

            return(RedirectToAction("EmployeeManagment"));
        }
Пример #14
0
        public ActionResult DeleteEmployee(int id)
        {
            var seesion = Session["Employee"] as employees;

            if (seesion.Id == id)
            {
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Danger, "Nie możesz usunąć samego siebie!");
            }
            else
            {
                _employeesHelper.DeleteEmployee(id);
                TempData["Alert"] = EmployeeAlert.SetAlert(EmployyeAlerts.Succes, "Poprawnie usunięto pracownika!");
            }

            return(RedirectToAction("EmployeeManagment"));
        }