Exemple #1
0
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Forms";

            if (Session["Form_Id"] == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            Field field = db.Fields.Include(s => s.Form).Include(a => a.Values).Include(a => a.CreatedBy).FirstOrDefault(a => a.Id == id);

            if (field == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }


            if (CheckDelete.checkFieldsDelete(id.Value) == false)
            {
                return(RedirectToAction("index", new { Id = Convert.ToInt32(Session["Form_Id"]), msg = "DeleteError" }));
            }


            return(View(field));
        }
Exemple #2
0
        public ActionResult Edit(string id)
        {
            ViewBag.Current = "Users";

            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            ApplicationUser user = UserManager.FindById(id);

            if (user == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }


            if (CheckDelete.CheckUserEdit(id) == false)
            {
                return(RedirectToAction("Index", new { Id = "OperationError" }));
            }
            EditProfileViewModel EProfile = new EditProfileViewModel()
            {
                Email        = user.Email,
                FullName     = user.FullName,
                Role         = user.RoleName,
                Id           = user.Id,
                UserName     = user.UserName,
                Gender       = user.Gender,
                JobTitleId   = user.JobTitleId == null ? 0 : user.JobTitleId.Value,
                DepartmentID = user.DepartmentId == null ? 0 : user.DepartmentId.Value
            };

            ViewBag.Role = new SelectList(db.Roles.ToList(), "Name", "Name", EProfile.Role);

            List <int> SelectedGroups = new List <int>();

            SelectedGroups = db.UsersGroups.Where(a => a.UserId.Equals(id)).Select(a => a.GroupId).ToList();

            List <SelectListItem> ListSl = new List <SelectListItem>();

            foreach (var G in db.Groups.ToList())
            {
                var sl = new SelectListItem()
                {
                    Text     = G.Name,
                    Value    = G.Id.ToString(),
                    Selected = SelectedGroups.DefaultIfEmpty().Contains(G.Id) ? true : false
                };

                ListSl.Add(sl);
            }
            ViewBag.Groups = ListSl;


            ViewBag.DepartmentID = new SelectList(DepartmentListDisplay.CreateDepartmentListDisplay(), "Id", "Name", EProfile.DepartmentID);
            ViewBag.JobTitleId   = new SelectList(db.JobTitles.ToList(), "Id", "Name", EProfile.JobTitleId);


            return(View(EProfile));
        }
Exemple #3
0
        public ActionResult LockOut(string id)
        {
            ViewBag.Current = "Users";

            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }

            ApplicationUser user = UserManager.FindById(id);

            if (user == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }


            if (CheckDelete.CheckUserLockOut(id) == false)
            {
                return(RedirectToAction("Index", new { Id = "OperationError" }));
            }

            if (user.LockoutEnabled == true)
            {
                ViewBag.LockState = "A";
            }
            else
            {
                ViewBag.LockState = "B";
            }


            return(View(user));
        }
Exemple #4
0
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Forms";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            Form form = _context.Forms.Include(a => a.Fields).Include(a => a.CreatedBy).SingleOrDefault(a => a.Id == id);

            if (form == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }

            IEnumerable <Document> Documents = _context.Documents.Where(a => a.FormId == id);

            if (CheckDelete.checkFormDelete(id.Value) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }

            return(View(form));
        }
Exemple #5
0
        public ActionResult Delete(string id)
        {
            ViewBag.Current = "Roles";

            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            ApplicationRoles AppRole = manger.Roles.FirstOrDefault(a => a.Id.Equals(id));

            if (AppRole == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }

            if (CheckDelete.CheckRoleDelete(id) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }
            RoleViewModel RVM = new RoleViewModel()
            {
                Name              = AppRole.Name,
                CreatedAt         = AppRole.CreatedAt,
                UpdatedAt         = AppRole.UpdatedAt,
                CreatedByFullName = db.Users.Find(AppRole.CreatedById).FullName,
            };

            ViewBag.RoleId = AppRole.Id;



            return(View(RVM));
        }
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Group";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }

            Group Group = _context.Groups.Find(id);

            if (Group == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }
            if (CheckDelete.CheckGroupDelete(id.Value) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }

            return(View(Group));
        }
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Department";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            Department department = db.Departments.Include(a => a.CreatedBy).SingleOrDefault(a => a.Id == id);

            if (department == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }

            if (CheckDelete.CheckDepertmentDelete(id.Value) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }

            return(View(department));
        }
Exemple #8
0
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "JobTitles";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            JobTitle jobTitle = db.JobTitles.Find(id);

            if (jobTitle == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }


            if (CheckDelete.CheckJobTitleDelete(jobTitle.Id) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }
            return(View(jobTitle));
        }
Exemple #9
0
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Party";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }

            Party party = _context.Parties.Find(id);

            if (party == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }

            if (CheckDelete.CheckPartydelete(party.Id) == false)
            {
                return(RedirectToAction("Index", new { Id = "DeleteError" }));
            }

            return(View(party));
        }
Exemple #10
0
        public ActionResult Delete(int?id)
        {
            ViewBag.Current = "Kind";


            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }

            Kind kind = _context.Kinds.Find(id);

            if (kind == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }


            if (CheckDelete.CheckDocumentKindsDelete(kind.Id) == false)
            {
                return(RedirectToAction("HttpNotFoundError", "DeleteError"));
            }
            return(View(kind));
        }