// GET: SouvenirRequest
        public ActionResult Index()
        {
            UserViewModel currentuser = SouvenirRequestRepo.GetIdByName(User.Identity.Name);

            if (currentuser.Role == "Staff" || currentuser.Role == "Admin")
            {
                return(View(SouvenirRequestRepo.Get()));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        public ActionResult Edit(int id)
        {
            UserViewModel            result = SouvenirRequestRepo.GetIdByName(User.Identity.Name);
            SouvenirRequestViewModel model  = SouvenirRequestRepo.GetById(id);

            if (result.Role == "Staff" || result.Role == "Admin")
            {
                return(PartialView("_Edit", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        public ActionResult SouSettItemApproved(SouvenirRequestViewModel model)
        {
            UserViewModel model1 = SouvenirRequestRepo.GetIdByName(User.Identity.Name);

            model.Settlement_Approved_By = model1.M_Employee_Id;
            ResultResponse result = SouvenirRequestRepo.Approved(model);

            return(Json(new
            {
                success = result.Success,
                entity = model,
                message = result.Message
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Received(int id)
        {
            UserViewModel            currentUser = SouvenirRequestRepo.GetIdByName(User.Identity.Name);
            SouvenirRequestViewModel model       = SouvenirRequestRepo.GetById(id);

            if (currentUser.Role == "Requester" || currentUser.Role == "Admin")
            {
                return(PartialView("_Received", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Exemplo n.º 5
0
        public ActionResult Create()
        {
            UserViewModel model = SouvenirRequestRepo.GetIdByName(User.Identity.Name);

            ViewBag.Souvenir = new SelectList(UnitRepo.Get(), "Id", "Name");
            if (model.Role == "Staff" || model.Role == "Admin")
            {
                return(PartialView("_Create", new SouvenirViewModel()));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        public ActionResult SouSettRequest(SouvenirRequestViewModel model, List <SouvenirItemViewModel> itemFile)
        {
            UserViewModel model2 = SouvenirRequestRepo.GetIdByName(User.Identity.Name);

            model.Settlement_By   = model2.M_Employee_Id;
            model.Settlement_Date = DateTime.Now;
            ResultResponse result = SouvenirRequestRepo.Settlement(model, itemFile);

            return(Json(new
            {
                success = result.Success,
                entity = model,
                message = result.Message
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult Edit(int id)
        {
            UserViewModel model2 = SouvenirRequestRepo.GetIdByName(User.Identity.Name);

            ViewBag.Unit = new SelectList(UnitRepo.Get(), "Id", "Name");
            SouvenirViewModel model = SouvenirRepo.GetById(id);

            if (model2.Role == "Staff" || model2.Role == "Admin")
            {
                return(PartialView("_Edit", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
        public ActionResult Add()
        {
            UserViewModel            result = SouvenirRequestRepo.GetIdByName(User.Identity.Name);
            SouvenirRequestViewModel model  = new SouvenirRequestViewModel();

            ViewBag.Event      = new SelectList(EventRepo.Get(), "Id", "Code");
            model.Request_By   = result.M_Employee_Id;
            model.Name         = result.Fullname;
            model.Code         = SouvenirRequestRepo.GetNewCode();
            model.Request_Date = DateTime.Now;
            if (result.Role == "Staff" || result.Role == "Admin")
            {
                return(PartialView("_Add", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }