Пример #1
0
        public string BindRoled(FormCollection form)
        {
            var    stateInfo = GeneralHandler.StateSuccess;
            int    userId    = TypeHelper.TypeToInt32(form["userId"], -1);
            int    roleId    = TypeHelper.TypeToInt32(form["roleId"], -1);
            string opFlag    = form["opFlag"] as string;

            if (userId > 0 && roleId > 0 && !string.IsNullOrEmpty(opFlag))
            {
                if (opFlag == "add")
                {
                    DawnAuthUserRoleMDL dataInfo = new DawnAuthUserRoleMDL();
                    dataInfo.UserId  = userId;
                    dataInfo.RoleId  = roleId;
                    dataInfo.MapTime = DateTime.Now;
                    DawnAuthUserRoleBLL.Insert(dataInfo);
                }
                else if (opFlag == "del")
                {
                    DawnAuthUserRoleBLL.DeleteWhere(string.Format("user_id='{0}' and role_id='{1}'", userId, roleId));
                }
            }
            else
            {
                stateInfo = GeneralHandler.FBaseInfo;
            }
            return(stateInfo);
        }
Пример #2
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));
        }
Пример #3
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);
        }