Пример #1
0
        public ActionResult BindRole(string id)
        {
            if (string.IsNullOrEmpty(id) || TypeHelper.TypeToInt32(id, -1) < 0)
            {
                return(RedirectToAction("List"));
            }
            var dataList = DawnAuthRoleBLL.ISelect();
            var roleList = DawnAuthUserRoleBLL.ISelect(string.Format("user_id='{0}'", int.Parse(id)));

            ViewBag.UserId       = id;
            ViewBag.UserBindRole = roleList;
            return(View(dataList));
        }
Пример #2
0
        public string Delete(string id)
        {
            if (string.IsNullOrEmpty(id) || TypeHelper.TypeToInt32(id, -1) < 0)
            {
                return(GeneralHandler.FBaseInfo);
            }
            var stateInfo = GeneralHandler.StateSuccess;

            if (int.Parse(id) == DawnauthHandler.UserId)
            {
                stateInfo = "不可对当前登录管理员进行数据删除操作!";
            }
            else
            {
                //形象照片
                var picList = DawnAuthUserPicBLL.ISelect();
                foreach (var item in picList)
                {
                    DawnAuthUserPicBLL.Delete(item.PicId);
                }
                //登录日志
                var logList = DawnAuthUserLoginBLL.ISelect();
                foreach (var item in logList)
                {
                    DawnAuthUserLoginBLL.Delete(item.LogId);
                }
                //角色映射
                var roleList = DawnAuthUserRoleBLL.ISelect();
                foreach (var item in roleList)
                {
                    DawnAuthUserRoleBLL.Delete(item.MapId);
                }
                //状态机制
                var statList = DawnAuthUserStatusBLL.ISelect();
                foreach (var item in statList)
                {
                    DawnAuthUserStatusBLL.Delete(item.MapId);
                }
                //管理员数据
                DawnAuthUserBLL.Delete(int.Parse(id));
            }
            return(stateInfo);
        }