Ejemplo n.º 1
0
 /// <summary>
 /// 构造权限类别下拉框数据
 /// </summary>
 /// <returns></returns>
 public SelectList GetPermissionType(PermissionInfo info)
 {
     List<PermissionType> list = new List<PermissionType>();
     list.Add(new PermissionType { ID = 1, Name = "模块"});
     list.Add(new PermissionType { ID = 2, Name = "主窗体" });
     list.Add(new PermissionType { ID = 3, Name = "工具栏" });
     return new SelectList(list, "ID", "Name");
 }
Ejemplo n.º 2
0
 public ActionResult PermissionAdd(PermissionInfo info)
 {
     info.ParentID = (string.IsNullOrEmpty(info.ParentID) ? "0" : info.ParentID);
     if (string.IsNullOrEmpty(info.ID))
     {
         PermissionInfo hasInfo = UserService.GetModel<PermissionInfo>("Code", info.Code);
         if (hasInfo != null && hasInfo.ID != "")
         {
             Result.IsOk = false;
             Result.Msg = "权限编码已存在";
         }
         else
         {
             info.ID = GuidHelper.GetUniqueID();
             if (UserService.Insert<PermissionInfo>(info))
             {
                 Result.IsOk = true;
                 Result.Msg = "添加成功";
             }
             else
             {
                 Result.IsOk = false;
                 Result.Msg = "添加失败";
             }
         }
     }
     else
     {
         if (UserService.Update<PermissionInfo>(info))
         {
             Result.IsOk = true;
             Result.Msg = "更新成功";
         }
         else
         {
             Result.IsOk = false;
             Result.Msg = "更新失败";
         }
     }
     Result.RedirectUrl = "/User/PermissionList";
     return Json(Result);
 }