Exemplo n.º 1
0
        public ActionResult PersonnelPermissionEdit(PersonnelPermissionRequest personnelPermissionRequest)
        {
            ModelState.Remove("ModifiedOnDatetime");
            ModelState.Remove("ModifiedUsername");
            Personnels per = personnelManager.Find(x => x.Id == personnelPermissionRequest.PersonnelsId);

            if (ModelState.IsValid)
            {
                BusinessLayerResult <PersonnelPermissionRequest> res = personnelPermissionRequestManager.UpdatePersonnelPermissionRequest(personnelPermissionRequest);
                if (res.Errors.Count > 0)
                {
                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));

                    ViewBag.PersonnelsId         = per.Id;
                    ViewBag.PersonnelNameSurname = per.Name + ' ' + per.Surname;
                    ViewBag.PersonnelImage       = per.ProfileImage;
                    ViewBag.PermissionTip        = new SelectList(permissionTipManager.List(), "Id", "Name");
                    return(View(personnelPermissionRequest));
                }

                return(RedirectToAction("PersonnelPermissionList"));
            }

            ViewBag.PersonnelsId         = per.Id;
            ViewBag.PersonnelNameSurname = per.Name + ' ' + per.Surname;
            ViewBag.PersonnelImage       = per.ProfileImage;
            ViewBag.PermissionTip        = new SelectList(permissionTipManager.List(), "Id", "Name");
            return(View(personnelPermissionRequest));
        }
Exemplo n.º 2
0
        public ActionResult PersonnelPermissionApprove(PersonnelPermissionRequest personnelPermissionRequest)
        {
            //PersonnelPermissionRequest per = personnelPermissionRequestManager.Find(x => x.Id == personnelPermissionRequest.Id);
            personnelPermissionRequest.Users = CurrentSession.User;
            BusinessLayerResult <PersonnelPermissionRequest> res = personnelPermissionRequestManager.ApprovePersonnelPermissionRequest(personnelPermissionRequest);

            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                return(View(personnelPermissionRequest));
            }

            return(RedirectToAction("PersonnelPermissionList"));
        }
Exemplo n.º 3
0
        public ActionResult PersonnelPermissionCancel(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PersonnelPermissionRequest personnelPermissionRequest = personnelPermissionRequestManager.Find(x => x.Id == id.Value);

            if (personnelPermissionRequest == null)
            {
                return(HttpNotFound());
            }
            return(View(personnelPermissionRequest));
        }
Exemplo n.º 4
0
        public ActionResult PersonnelPermissionEdit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PersonnelPermissionRequest personnelPermissionRequest = personnelPermissionRequestManager.Find(x => x.Id == id.Value);

            if (personnelPermissionRequest == null)
            {
                return(HttpNotFound());
            }

            ViewBag.PersonnelsId         = personnelPermissionRequest.PersonnelsId;
            ViewBag.NumberOfDays         = personnelPermissionRequest.NumberofDays;
            ViewBag.PersonnelNameSurname = personnelPermissionRequest.Personnels.Name + ' ' + personnelPermissionRequest.Personnels.Surname;
            ViewBag.PersonnelImage       = personnelPermissionRequest.Personnels.ProfileImage;
            ViewBag.PermissionTip        = new SelectList(permissionTipManager.List(), "Id", "Name", personnelPermissionRequest.PersonnelPermissionTipsId);
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult PersonnelPermissionDelete(int?id)
        {
            PersonnelPermissionRequest personnelPermissionRequest = personnelPermissionRequestManager.Find(x => x.Id == id.Value);
            var name = personnelPermissionRequest.Personnels.Name + ' ' + personnelPermissionRequest.Personnels.Surname;

            if (personnelPermissionRequest != null)
            {
                int res = personnelPermissionRequestManager.Delete(personnelPermissionRequest);
                if (res > 0)
                {
                    return(Json(new { hasError = false, Message = $"{ name }" + " adlı personele verilen izin başarılı bir şekilde silindi." }, JsonRequestBehavior.AllowGet));
                    //return Json(new { hasError = false, Massage = "Personel başarılı bir şekilde silindi." });
                }
                else
                {
                    return(Json(new { hasError = true, Message = $"{ name }" + " adlı personele verilen izin silinirken hata oluştu." }, JsonRequestBehavior.AllowGet));
                    //return Json(new { hasError = true, Message = "Personel silinirken hata oluştu." });
                }
            }
            return(Json(new { results = true, Message = $"{ name }" + " adlı personelin izni bulunamadı." }, JsonRequestBehavior.AllowGet));
        }