From af5e04d62fdc1a0f5c63133e24a97e4d65fce2ab Mon Sep 17 00:00:00 2001 From: yubaolee Date: Sat, 5 Dec 2015 16:07:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E8=A1=A8=E7=BB=93=E6=9E=84=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E6=B3=A8=E6=84=8F=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=BB=93=E6=9E=84=E5=B9=B6=E9=87=8D=E6=96=B0=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.Domain/Module.cs | 4 +- OpenAuth.Domain/ModuleElement.cs | 36 +- OpenAuth.Domain/ModuleElementGrant.cs | 56 -- OpenAuth.Domain/OpenAuth.Domain.csproj | 1 - OpenAuth.Domain/Relevance.cs | 152 ++--- .../ModuleElementManagerController.cs | 139 ++-- .../Views/ModuleElementManager/Index.cshtml | 128 ++-- OpenAuth.Mvc/Views/ModuleManager/Index.cshtml | 3 + OpenAuth.Mvc/Views/UserManager/Index.cshtml | 38 +- .../Models/Mapping/ModuleElementGrantMap.cs | 24 - .../Models/Mapping/ModuleElementMap.cs | 22 +- .../Models/Mapping/RelevanceMap.cs | 70 +- .../Models/OpenAuthDBContext.cs | 2 - .../OpenAuth.Repository.csproj | 1 - 数据库设计关系图/PDM_OA.pdb | 606 +++++++---------- 数据库设计关系图/PDM_OA.pdm | 613 +++++++----------- 16 files changed, 805 insertions(+), 1090 deletions(-) delete mode 100644 OpenAuth.Domain/ModuleElementGrant.cs delete mode 100644 OpenAuth.Repository/Models/Mapping/ModuleElementGrantMap.cs diff --git a/OpenAuth.Domain/Module.cs b/OpenAuth.Domain/Module.cs index e7d6888e..8e38b403 100644 --- a/OpenAuth.Domain/Module.cs +++ b/OpenAuth.Domain/Module.cs @@ -6,12 +6,12 @@ using System.Linq; namespace OpenAuth.Domain { /// - /// 系统模块 + /// 用户ID /// public partial class Module { /// - /// 模块ID + /// 用户ID /// /// public int Id { get; set; } diff --git a/OpenAuth.Domain/ModuleElement.cs b/OpenAuth.Domain/ModuleElement.cs index 96e041ba..d5349903 100644 --- a/OpenAuth.Domain/ModuleElement.cs +++ b/OpenAuth.Domain/ModuleElement.cs @@ -29,10 +29,10 @@ namespace OpenAuth.Domain public string Name { get; set; } /// - /// 组织类型 + /// 元素的类型(如:button/a) /// /// - public int Type { get; set; } + public string Type { get; set; } /// /// 功能模块Id @@ -40,6 +40,30 @@ namespace OpenAuth.Domain /// public int ModuleId { get; set; } + /// + /// 元素附加属性 + /// + /// + public string Attr { get; set; } + + /// + /// 元素调用脚本 + /// + /// + public string Script { get; set; } + + /// + /// 元素图标 + /// + /// + public string Icon { get; set; } + + /// + /// 元素样式 + /// + /// + public string Class { get; set; } + /// /// 备注 /// @@ -52,9 +76,13 @@ namespace OpenAuth.Domain this.Id= 0; this.DomId= string.Empty; this.Name= string.Empty; - this.Type= 0; + this.Type = string.Empty; this.ModuleId= 0; - this.Remark= string.Empty; + this.Attr= string.Empty; + this.Script= string.Empty; + this.Icon= string.Empty; + this.Class= string.Empty; + this.Remark= string.Empty; } diff --git a/OpenAuth.Domain/ModuleElementGrant.cs b/OpenAuth.Domain/ModuleElementGrant.cs deleted file mode 100644 index b51d81eb..00000000 --- a/OpenAuth.Domain/ModuleElementGrant.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; - -namespace OpenAuth.Domain -{ - /// - /// 用户ID - /// - public partial class ModuleElementGrant - { - /// - /// 用户ID - /// - /// - public int Id { get; set; } - - /// - /// 元素流水号 - /// - /// - public int ElementId { get; set; } - - /// - /// 用户流水号 - /// - /// - public int UserId { get; set; } - - /// - /// 角色流水号 - /// - /// - public int RoleId { get; set; } - - /// - /// 权限类型 - /// - /// - public int GrantType { get; set; } - - - public ModuleElementGrant() - { - this.Id= 0; - this.ElementId= 0; - this.UserId= 0; - this.RoleId= 0; - this.GrantType= 0; - } - - - - } -} \ No newline at end of file diff --git a/OpenAuth.Domain/OpenAuth.Domain.csproj b/OpenAuth.Domain/OpenAuth.Domain.csproj index e6e982e1..ae2a7487 100644 --- a/OpenAuth.Domain/OpenAuth.Domain.csproj +++ b/OpenAuth.Domain/OpenAuth.Domain.csproj @@ -51,7 +51,6 @@ - diff --git a/OpenAuth.Domain/Relevance.cs b/OpenAuth.Domain/Relevance.cs index 103b7532..4b2c25db 100644 --- a/OpenAuth.Domain/Relevance.cs +++ b/OpenAuth.Domain/Relevance.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; - -namespace OpenAuth.Domain -{ - /// - /// 用户ID - /// - public partial class Relevance - { - /// - /// 用户ID - /// - /// - public int Id { get; set; } - - /// - /// 第一个表主键ID - /// - /// - public int FirstId { get; set; } - - /// - /// 第二个表主键ID - /// - /// - public int SecondId { get; set; } - - /// - /// 描述 - /// - /// - public string Description { get; set; } - - /// - /// - /// - /// - public string Key { get; set; } - - /// - /// 状态 - /// - /// - public int Status { get; set; } - - /// - /// 授权时间 - /// - /// - public System.DateTime OperateTime { get; set; } - - /// - /// 授权人 - /// - /// - public int OperatorId { get; set; } - - - public Relevance() - { - this.Id= 0; - this.FirstId= 0; - this.SecondId= 0; - this.Description= string.Empty; - this.Key= string.Empty; - this.Status= 0; - this.OperateTime= DateTime.Now; - this.OperatorId= 0; - } - - - - } +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; + +namespace OpenAuth.Domain +{ + /// + /// 用户ID + /// + public partial class Relevance + { + /// + /// 用户ID + /// + /// + public int Id { get; set; } + + /// + /// 第一个表主键ID + /// + /// + public int FirstId { get; set; } + + /// + /// 第二个表主键ID + /// + /// + public int SecondId { get; set; } + + /// + /// 描述 + /// + /// + public string Description { get; set; } + + /// + /// + /// + /// + public string Key { get; set; } + + /// + /// 状态 + /// + /// + public int Status { get; set; } + + /// + /// 授权时间 + /// + /// + public System.DateTime OperateTime { get; set; } + + /// + /// 授权人 + /// + /// + public int OperatorId { get; set; } + + + public Relevance() + { + this.Id= 0; + this.FirstId= 0; + this.SecondId= 0; + this.Description= string.Empty; + this.Key= string.Empty; + this.Status= 0; + this.OperateTime= DateTime.Now; + this.OperatorId= 0; + } + + + + } } \ No newline at end of file diff --git a/OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs b/OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs index 375dde94..5960026f 100644 --- a/OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs +++ b/OpenAuth.Mvc/Controllers/ModuleElementManagerController.cs @@ -1,69 +1,72 @@ -// *********************************************************************** -// Assembly : OpenAuth.Mvc -// Author : Yubao Li -// Created : 12-02-2015 -// -// Last Modified By : Yubao Li -// Last Modified On : 12-02-2015 -// *********************************************************************** -// -// Copyright (c) . All rights reserved. -// -// 模块元素管理,无需权限控制 -// *********************************************************************** - -using System; -using System.Web.Mvc; -using Infrastructure; -using OpenAuth.App; -using OpenAuth.Domain; -using OpenAuth.Mvc.Models; - -namespace OpenAuth.Mvc.Controllers -{ - public class ModuleElementManagerController : Controller - { - private readonly BjuiResponse _bjuiResponse = new BjuiResponse(); - private ModuleElementManagerApp _app; - - public ModuleElementManagerController() - { - _app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp)); - } - - public ActionResult Index(int id = 0) - { - ViewBag.ModuleId = id; - return View(_app.LoadByModuleId(id)); - } - - [HttpPost] - public string AddOrEditButton(ModuleElement button) - { - try - { - _app.AddOrUpdate(button); - } - catch (Exception e) - { - _bjuiResponse.statusCode = "300"; - _bjuiResponse.message = e.Message; - } - return JsonHelper.Instance.Serialize(_bjuiResponse); - } - - public string DelButton(int id) - { - try - { - _app.Delete(id); - } - catch (Exception e) - { - _bjuiResponse.statusCode = "300"; - _bjuiResponse.message = e.Message; - } - return JsonHelper.Instance.Serialize(_bjuiResponse); - } - } +// *********************************************************************** +// Assembly : OpenAuth.Mvc +// Author : Yubao Li +// Created : 12-02-2015 +// +// Last Modified By : Yubao Li +// Last Modified On : 12-02-2015 +// *********************************************************************** +// +// Copyright (c) . All rights reserved. +// +// 模块元素管理,无需权限控制 +// *********************************************************************** + +using System; +using System.Data.Entity.Validation; +using System.Web.Mvc; +using Infrastructure; +using OpenAuth.App; +using OpenAuth.Domain; +using OpenAuth.Mvc.Models; + +namespace OpenAuth.Mvc.Controllers +{ + public class ModuleElementManagerController : Controller + { + private readonly BjuiResponse _bjuiResponse = new BjuiResponse(); + private ModuleElementManagerApp _app; + + public ModuleElementManagerController() + { + _app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp)); + } + + public ActionResult Index(int id = 0) + { + ViewBag.ModuleId = id; + return View(_app.LoadByModuleId(id)); + } + + [HttpPost] + public string AddOrEditButton(ModuleElement button) + { + try + { + var newbtn = new ModuleElement(); + button.CopyTo(newbtn); + _app.AddOrUpdate(newbtn); + } + catch (DbEntityValidationException e) + { + _bjuiResponse.statusCode = "300"; + _bjuiResponse.message = e.Message; + } + return JsonHelper.Instance.Serialize(_bjuiResponse); + } + + public string DelButton(int id) + { + try + { + _app.Delete(id); + } + catch (Exception e) + { + _bjuiResponse.statusCode = "300"; + _bjuiResponse.message = e.Message; + } + return JsonHelper.Instance.Serialize(_bjuiResponse); + } + } } \ No newline at end of file diff --git a/OpenAuth.Mvc/Views/ModuleElementManager/Index.cshtml b/OpenAuth.Mvc/Views/ModuleElementManager/Index.cshtml index f8296054..f5af361f 100644 --- a/OpenAuth.Mvc/Views/ModuleElementManager/Index.cshtml +++ b/OpenAuth.Mvc/Views/ModuleElementManager/Index.cshtml @@ -1,61 +1,69 @@ -@model IEnumerable - - -
- -
-
-
- - - - - - - - - - - - @foreach (var element in Model) - { - - - - - - - - - } - - -
- 增加 - 取消 -
@element.DomId@element.Name@element.Remark@ViewBag.ModuleId - - - -
-
-
-