Esempio n. 1
0
        public ActionResult Delete(string ids)
        {
            IBLL.IORG_RoleMenuOpAuthorityBLL bll = new BLL.ORG_RoleMenuOpAuthorityBLL();
            string returnValue = string.Empty;

            int[] deleteId = System.Array.ConvertAll <string, int>(ids.Split(','), delegate(string s) { return(int.Parse(s)); });
            if (ids != null && ids.Length > 0)
            {
                if (bll.DeleteRoleOp(deleteId))
                {
                    LogClassModels.WriteServiceLog(Suggestion.DeleteSucceed + ",信息的Id为" + string.Join(",", ids), "消息"
                                                   );//删除成功,写入日志

                    return(Json(new { Code = "ok", Message = Suggestion.DeleteSucceed }));
                }
                else
                {
                    LogClassModels.WriteServiceLog(Suggestion.DeleteFail + ",信息的Id为" + string.Join(",", ids) + "," + "删除失败", "消息"
                                                   );//删除失败,写入日志
                    return(Json(new { Code = "error", Message = Suggestion.DeleteFail + returnValue }));
                }
            }
            else
            {
                return(Json(new { Code = "error", Message = "未选择任何数据" }));
            }
        }
Esempio n. 2
0
        public ActionResult Config(int id, string type, bool isEditOpt, bool isEditDpt, bool isEditData, string selectedMenuOpt, string selectedMenuDpt, string selectedMenuScope)
        {
            try
            {
                // 配置权限
                IBLL.IORG_RoleMenuOpAuthorityBLL bll = new BLL.ORG_RoleMenuOpAuthorityBLL();
                bool rtn = bll.ConfigAuthority(id, type, isEditOpt, isEditDpt, isEditData, selectedMenuOpt, selectedMenuDpt, selectedMenuScope);

                if (rtn)
                {
                    return(Json(new { Code = "ok", Message = "权限配置成功" }));
                }
                else
                {
                    return(Json(new { Code = "error", Message = "权限配置失败" }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Code = "error", Message = "操作失败:服务器错误" }));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取默认选中的菜单
        /// </summary>
        /// <param name="id">主键</param>
        /// <param name="type">类别(role;user)</param>
        /// <param name="tr"></param>
        private void GetChecked(int id, string type, ref SysMenu tr)
        {
            IBLL.IORG_MenuOpBLL MoBll = new BLL.ORG_MenuOpBLL();
            //获取菜单相关操作
            List <ORG_MenuOp> ListOpt = new List <ORG_MenuOp>();

            //ListOpt = MoBll.GetByParam("","ID","asc","XYBZ = 'Y' and Org_Menu_ID = '" + tr.id + "' order by Sort asc");
            ListOpt = MoBll.GetByParam("", "asc", "Sort", "XYBZDDL_String&Y^Org_Menu_IDDDL_Int&" + tr.id.ToString());
            string MenuOpIds = "";

            //获取菜单操作权限
            if (type == "role")
            {
                IBLL.IORG_RoleMenuOpAuthorityBLL RmoBll          = new BLL.ORG_RoleMenuOpAuthorityBLL();
                ORG_RoleMenuOpAuthority          MenuOpAuthority = new ORG_RoleMenuOpAuthority();
                //MenuOpAuthority = bll.GetByParam("", "asc", "Sort", string.Format("ORG_Role_ID = {0} and ORG_Menu_ID = '{1}'", id, tr.id)).FirstOrDefault();
                MenuOpAuthority = RmoBll.GetByParam("", "asc", "ID", string.Format("ORG_Role_IDDDL_Int&{0}^ORG_Menu_IDDDL_String&{1}", id, tr.id)).FirstOrDefault();

                if (MenuOpAuthority != null)
                {
                    MenuOpIds = MenuOpAuthority.ORG_MenuOp_ID_List ?? "";
                    //tr.DataScope = MenuOpAuthority.DataScope;
                    tr.IsChecked = true;
                }

                ORG_RoleDepartmenScopetAuthority          DepartmentScopet = new ORG_RoleDepartmenScopetAuthority();
                IBLL.IORG_RoleDepartmenScopetAuthorityBLL RdsBll           = new BLL.ORG_RoleDepartmenScopetAuthorityBLL();
                //DepartmentScopet = RdsBll.GetModel<ORG_RoleDepartmenScopetAuthority>(string.Format("ORG_Role_ID = {0} and ORG_Menu_ID = '{1}'", id, tr.id));
                DepartmentScopet = RdsBll.GetByParam("", "asc", "ID", string.Format("ORG_Role_IDDDL_Int&{0}^ORG_Menu_IDDDL_String&{1}", id, tr.id)).FirstOrDefault();
                if (DepartmentScopet != null)
                {
                    tr.DataScope = DepartmentScopet.DepartmentScope;
                }
            }
            else//user
            {
                IBLL.IORG_UserMenuOpAuthorityBLL UmoBll          = new BLL.ORG_UserMenuOpAuthorityBLL();
                ORG_UserMenuOpAuthority          MenuOpAuthority = new ORG_UserMenuOpAuthority();
                //MenuOpAuthority = bll.GetModel<ORG_UserMenuOpAuthority>(string.Format("ORG_User_ID = {0} and ORG_Menu_ID = '{1}'", id, tr.id));
                MenuOpAuthority = UmoBll.GetByParam("", "asc", "ID", string.Format("ORG_User_IDDDL_Int&{0}^ORG_Menu_IDDDL_String&{1}", id, tr.id)).FirstOrDefault();
                if (MenuOpAuthority != null)
                {
                    MenuOpIds = MenuOpAuthority.ORG_MenuOp_ID_List ?? "";
                    //tr.DataScope = MenuOpAuthority.DataScope;
                    tr.IsChecked = true;
                }

                ORG_UserDepartmenScopetAuthority          DepartmentScopet = new ORG_UserDepartmenScopetAuthority();
                IBLL.IORG_UserDepartmenScopetAuthorityBLL UdsBll           = new BLL.ORG_UserDepartmenScopetAuthorityBLL();
                //DepartmentScopet = bll.GetModel<ORG_UserDepartmenScopetAuthority>(string.Format("ORG_User_ID = {0} and ORG_Menu_ID = '{1}'", id, tr.id));
                DepartmentScopet = UdsBll.GetByParam("", "asc", "ID", string.Format("ORG_User_IDDDL_Int&{0}^ORG_Menu_IDDDL_String&{1}", id, tr.id)).FirstOrDefault();
                if (DepartmentScopet != null)
                {
                    tr.DataScope = DepartmentScopet.DepartmentScope;
                }
            }

            List <MenuOption> ListMenuOpt = new List <MenuOption>();
            MenuOption        Option      = new MenuOption();

            foreach (ORG_MenuOp model in ListOpt)
            {
                Option             = new MenuOption();
                Option.ID          = model.ID;
                Option.MenuOpName  = model.MenuOpName;
                Option.SYS_Menu_ID = model.ORG_Menu_ID;
                // 获取当前操作权限
                foreach (string MenuOpId in MenuOpIds.Split(','))
                {
                    if (MenuOpId == model.ID)
                    {
                        Option.IsChecked = true;
                        break;
                    }
                }
                tr.MenuOptions.Add(Option);
                tr.MenuOptIds += Option.ID + ",";
            }

            if (!string.IsNullOrEmpty(tr.MenuOptIds))
            {
                tr.MenuOptIds = tr.MenuOptIds.Substring(0, tr.MenuOptIds.LastIndexOf(','));
            }
        }