Exemplo n.º 1
0
        public ActionResult Add(AdminRole arl, string ModuleIds)
        {
            if (!Request.IsAjaxRequest())
            {
                return(Content("操作失败,你的浏览器禁用了Javascript脚本!"));
            }
            var srm = new ShowResultModel();

            if (ModelState.IsValid)
            {
                try
                {
                    _adminRoleService.AddRole(arl, ModuleIds);
                    srm.TipMsg    = "新增角色成功!<br/><br/><input type='button' class='box-buttonadd' value='继续添加'  onclick='window.document.getElementById(&#34;lhgfrm_divaddRole&#34;).contentWindow.Goon();'/><input type='button' class='box-buttonclose' value='取消' onclick='window.document.getElementById(&#34;lhgfrm_divaddRole&#34;).contentWindow.Undo()'/>";
                    srm.IsSuccess = true;
                }
                catch (InvalidOperationException ex)
                {
                    srm.TipMsg = ex.Message;
                }
                catch (Exception ex)
                {
                    srm.TipMsg = ex.Message;
                    LoggerHelper.Log("【管理员角色添加】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString()));
                }
            }
            else
            {
                srm.TipMsg = "数据有效性验证失败!";
            }
            return(Json(srm));
        }