示例#1
0
        public ActionResult GetAllBranchByRoleLogin(string id, bool hasAll = false, int idSelected = 0, bool isDisable = false)
        {
            int userid = 0, roleid = 0, BranchId = 0;

            int.TryParse(user.Id.ToString(), out userid);
            int.TryParse(user.Roleid.ToString(), out roleid);
            int.TryParse(user.BranchId.ToString(), out BranchId);

            var db           = new CommonBusiness();
            var result       = db.GetAllBranchsByRoleIdLogin(userid, roleid, BranchId);
            var checkRole    = entity.Role.FirstOrDefault(m => m.Id == roleid);
            var checkBrandch = entity.Branch.FirstOrDefault(m => m.Id == BranchId);

            if (checkRole.Level == 12 || checkBrandch.IsParent == true)
            {
                ViewBag.isDisable = false;
                hasAll            = true;
            }
            else
            {
                ViewBag.isDisable = true;
            }
            ViewBag.id         = id;
            ViewBag.idSelected = idSelected;
            ViewBag.hasAll     = hasAll;

            return(PartialView(result));
        }