Ejemplo n.º 1
0
        public ActionResult GetSubRoles(long id = 0)
        {
            var condition = new UserRoleCondition { ParentID = id};
            var datas = UserRoleBiz.Search(condition).Select(q => new
                            {
                                id = q.ID,
                                pid = q.ParentID,
                                q.RoleName,
                                CreatedDate = q.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
                                ModifyDate = q.ModifyDate.ToString("yyyy-MM-dd HH:mm:ss")
                            });

            return Json(new {success = true, data = datas}, "text/html", JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
 public ActionResult Index()
 {
     var condition = new UserRoleCondition();
     var datas = UserRoleBiz.Search(condition).ToList();
     if (CurrentUser.UserType != (int)UserTypeEnum.SuperAdmin)
     {
         var sr = datas.FirstOrDefault(q => q.RoleName == "SuperManager");
         if (sr != null)
         {
             datas.Remove(sr);
         }
     }
     var model = PDM.Create(datas.AsEnumerable(), condition);
     return View(model);
 }
Ejemplo n.º 3
0
        public IEnumerable<UserRole> Search(UserRoleCondition condition)
        {
            using (var db = new Entities())
            {
                var query = db.UserRole.Where(q => q.Status == (int) StatusEnum.Valid);

                if (condition.ParentID.HasValue)
                {
                    query = query.Where(q => q.ParentID == condition.ParentID.Value);
                }

                if (CurrentUserBiz.CurrentUser != null && CurrentUserBiz.CurrentUser.UserType != (int)UserTypeEnum.SuperAdmin)
                {
                    query = query.Where(q => q.ParentID >= -1);
                }
                return query.OrderByDescending(q => q.ModifyDate).ToList();
            }
        }
Ejemplo n.º 4
0
 public ActionResult Index(UserRoleCondition condition)
 {
     var datas = UserRoleBiz.Search(condition);
     var model = PDM.Create(datas, condition);
     return View(model);
 }