Пример #1
0
 public string Del(string code)
 {
     try
     {
         if (SqlToNull.CheckBadWord(code))
         {
             code = SqlToNull.Filter(code);
         }
         if (UserManager.IsContainUserRoleInfoCode(GetCookie.GetUserCookie().userCode, code, byte.Parse(GetCookie.GetUserCookie().userType)))
         {
             return("该角色下有用户正在使用,删除失败!");
         }
         else
         {
             Role.delOaRoleByRoleCode(code);
             EastElite.SMS.Business.RoleInfo RoleIN = UserManager.GetRoleInfoItem(code);
             UserManager.DeleteRoleInfoItem(code);
             BLL.Log.UserLog.AddUserLog("删除角色成功", GetCookie.GetUserCookie().userName + " 删除修改 " + RoleIN.name + " 角色 ");
             return("删除成功");
         }
     }
     catch (Exception ex)
     {
         BLL.Log.UserLog.AddUserLog("删除角色失败", ex.Message);
         throw;
     }
 }
Пример #2
0
        /// <summary>
        ///获取人员分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public ActionResult GetUserList(int pageIndex, string strWhere)
        {
            if (SqlToNull.CheckBadWord(strWhere))
            {
                strWhere = SqlToNull.Filter(strWhere);
            }
            string SubAgencyCode = "", UserName = "";

            if (strWhere != "")
            {
                string[] str = strWhere.Split('★');
                if (strWhere.IndexOf('★') > -1)
                {
                    SubAgencyCode = str[0].ToString();
                    UserName      = str[1].ToString();
                }
                else
                {
                    SubAgencyCode = str[0].ToString();
                }
            }

            BLL.Cookie.TeUser U         = GetCookie.GetUserCookie();
            string            condition = string.Format(@"[UserType]=1  AND (SELECT SUBSTRING(AgencyCode,1,10) FROM dbo.StaffInfo WHERE Code=[UserCode])='{0}'", U.rootCode);

            if (!string.IsNullOrEmpty(SubAgencyCode))
            {
                if (string.IsNullOrEmpty(condition))
                {
                    condition = string.Format(@"[AgencyName] LIKE N'{0}'", SubAgencyCode);
                }
                else
                {
                    condition += (" AND " + string.Format(@"[AgencyName] LIKE N'{0}'", SubAgencyCode));
                }
            }
            if (!string.IsNullOrEmpty(UserName))
            {
                if (string.IsNullOrEmpty(condition))
                {
                    condition = string.Format(@"[UserName] like '%{0}%'", UserName);
                }
                else
                {
                    condition += (" AND " + string.Format(@"[UserName] like '%{0}%'", UserName));
                }
            }

            int pageSize = 10;                                 //每页条数
            int Count    = 0;                                  //总条数
            List <BLL.SMSModel.UserInfoList> model = List.GetUserList(pageIndex, pageSize, condition, ref Count);
            int pageCount = (Count + pageSize - 1) / pageSize; //页码

            return(Json(new { model, pageCount, pageIndex }, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        /// <summary>
        ///获取分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public ActionResult GetRoleList(int pageIndex, string strWhere)
        {
            if (SqlToNull.CheckBadWord(strWhere))
            {
                strWhere = SqlToNull.Filter(strWhere);
            }
            int pageSize = 10;                                 //每页条数
            int Count    = 0;                                  //总条数
            List <BLL.SMSModel.RoleInfo> model = List.GetPageList(pageIndex, pageSize, strWhere, ref Count);
            int pageCount = (Count + pageSize - 1) / pageSize; //页码

            return(Json(new { model, pageCount, pageIndex }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        /// <summary>
        /// 链接管理分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public ActionResult GetLink(int pageIndex, string strWhere)
        {
            GetCookie.ExistCookie();
            if (SqlToNull.CheckBadWord(strWhere))
            {
                strWhere = SqlToNull.Filter(strWhere);
            }
            int pageSize = 10;

            BLL.WEB.PageList Page = new BLL.WEB.PageList();

            int pageCount = (Page.GetPostCount() + pageSize - 1) / pageSize;

            List <BLL.Link> model = Page.GetPostList <BLL.Link>(pageIndex, pageSize, strWhere, "Link", "Code").ToList();

            return(Json(new { model, pageCount, pageIndex }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public void Del(string code)
        {
            try
            {
                if (SqlToNull.CheckBadWord(code))
                {
                    code = SqlToNull.Filter(code);
                }
                Role.delOaRoleByRoleCode(code);
                EastElite.SMS.Business.RoleInfo RoleIN = UserManager.GetRoleInfoItem(code);
                UserManager.DeleteRoleInfoItem(code);

                BLL.Log.UserLog.AddUserLog("删除角色成功", GetCookie.GetUserCookie().userName + " 删除修改 " + RoleIN.name + " 角色 ");
            }
            catch (Exception ex)
            {
                BLL.Log.UserLog.AddUserLog("删除角色失败", ex.Message);
                throw;
            }
        }
Пример #6
0
        /// <summary>
        /// 获取当前人员的角色
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        public ActionResult GetRole(string Code)
        {
            if (SqlToNull.CheckBadWord(Code))
            {
                Code = SqlToNull.Filter(Code);
            }
            int Count = 0;//总条数

            BLL.Cookie.TeUser U         = GetCookie.GetUserCookie();
            string            condition = string.Format(@"[UserType]=1 AND (SELECT SUBSTRING(AgencyCode,1,10) FROM dbo.StaffInfo WHERE Code=[UserCode])='{0}' and UserCode ='{1}' ", U.rootCode, Code);

            List <BLL.SMSModel.RoleInfo>         model    = List.GetPageList(1, 1000, "", ref Count);
            List <BLL.SMSModel.UserRoleInfoList> UserRole = List.GetUserRoleList(1, 1000, condition, ref Count);
            string UserRoleStr = "";

            for (int i = 0; i < UserRole.Count; i++)
            {
                UserRoleStr += UserRole[i].RoleCode + ",";
            }
            UserRoleStr = UserRoleStr.Length > 0 ? UserRoleStr.Substring(0, UserRoleStr.Length - 1) : "";

            return(Json(new { model, UserRoleStr }, JsonRequestBehavior.AllowGet));
        }