• 小菜的系统框架界面设计-小菜用户权限管理软件开源大放送


    为什么要开源?

    有句:“赠人玫瑰,手有余香。”,在园子里学习有些一时间了,得到了很多人的帮助,我自已练习做了一套基于Winform的管理类小软件《小菜用户权限管理软件》,只当学习用,今天汇总一下开源分享给大家。

    我这个框架集成了好几个有用的框架:WeifenLuo.WinFormsUI.Docking.dll布局组件,分页组件,皮肤套件等,我在整体色调等方面做了些优化,让整个系统看起来比较协调。

    当然,还有很多不足的,毕竟这是练习嘛~~如投入商业使用还是有很多限制的。

    现在开始描述一下这个系统的具体情况,给有兴趣的朋友研究带来便利。

    软件整体架构

    软件分为四个模块:用户管理,部门管理,角色管理,功能管理。平台主要是基于Winform,.Net FrameWork 4.0,支持SQL Server,Oracle,MySql,只要在配置文件中切换就可以。

    操作数据层集成了NHibernate框架组件:XiaoCai.ORM.dll,软件框架集成多功能组件XiaoCai.WinformUI.dll:涉及的有用功能有分页控件,多文档界面布局(像Visual Studio一样的布局效果喔),仿Outlook的OutLookBar导航,界面启动时的闪屏效果增强用户体验,系统托盘效果。

    整体架构,如下图:

    image

    项目结构

    • 引入类库

    image

    • 代码结构

    • image

    软件模块介绍

    用户登录模块:

    image

    用户登录成功后闪屏效果:

    image

    主界面整体效果:

    image

    用户管理模块界面:

    image

    程序配置文件

    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="FMS.Web.Services.INIService" value="http://localhost/OAServices/INIService.asmx"/>
        <!-- Database with WebService -->
        <add key="FMS.Remote" value="N"/>
        <add key="FMS.GlobalSessionFactory" value="XiaoCai.Auth.DAL.Global.SQLServerSessionFactory,XiaoCai.Auth.DAL.Global"/>
        <!--<add key="FMS.GlobalSessionFactory" value="XiaoCai.Auth.DAL.Global.MySQLSessionFactory,XiaoCai.Auth.DAL.Global" />-->
        <!--<add key="FMS.GlobalSessionFactory" value="XiaoCai.Auth.DAL.Global.OracleSessionFactory,XiaoCai.Auth.DAL.Global" />-->
        <!-- Database without WebService -->
        <add key="FMS.Database.MySQLConn" value="server=localhost;user id=root;password=12345;database=SecurityDB;character set=utf8"/>
        <add key="FMS.Database.SqlServerConn" value="Data Source=localhost,1433;Network Library=DBMSSOCN;Initial Catalog=SecurityDB;User ID=root;Password=12345;"/>
        <add key="FMS.Database.OracleServerConn" value="User Id=AGANQIN;Password=12345;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SID=SecurityDB)(SERVER=DEDICATED)));"/>
      </appSettings>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

    程序源码运行注意

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    
    namespace XiaoCai.SecurityManager
    {
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                Auth.App.Core.AppCore.Startup();//程序序动时,加这么一句
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new LoginForm());
            }
        }
    }

    数据库文件

    • 关于SQL Server,MySql,Oracle数据库文件生成脚本,我放在XiaoCai.Database.rar
    • 导入注意事项:数据库命名为SecurityDB
    • SQL Server:

    image

    • 主要有9张表:其中表T_AUTH_DEPT_ROLE,T_AUTH_DEPT_USER,T_AUTH_FUNCTION_ROLE,T_AUTH_FUNCTION_USER,T_AUTH_USER_ROLE相关ID都要设为栏位联合组件,其他的表ID设为唯一主键。
    • 在其他数据库中,Oracle,MySql中同理,但略有些不同。
    • 注:朋友反馈SQL Server脚本不全,上传SQL Server数据库文件
    • http://files.cnblogs.com/aganqin/SecurityDB.rar
    • http://files.cnblogs.com/aganqin/SecurityDBSQL.rar
    • 数据库脚本:
    • USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_DEPT]    Script Date: 2013/10/21 10:51:55 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_DEPT](
          [ID] [int] IDENTITY(1,1) NOT NULL,
          [NAME] [nvarchar](50) NOT NULL,
          [NOTE] [nvarchar](500) NULL,
          [CREATETIME] [datetime] NOT NULL,
       CONSTRAINT [PK_T_AUTH_DEPT] PRIMARY KEY CLUSTERED 
      (
          [ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_DEPT_ROLE]    Script Date: 2013/10/21 11:08:00 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_DEPT_ROLE](
          [DEPT_ID] [int] NOT NULL,
          [ROLE_ID] [int] NOT NULL,
       CONSTRAINT [PK_T_AUTH_DEPT_ROLE] PRIMARY KEY CLUSTERED 
      (
          [DEPT_ID] ASC,
          [ROLE_ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_DEPT_USER]    Script Date: 2013/10/21 11:08:12 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_DEPT_USER](
          [DEPT_ID] [int] NOT NULL,
          [USER_ID] [int] NOT NULL,
       CONSTRAINT [PK_T_AUTH_DEPT_USER] PRIMARY KEY CLUSTERED 
      (
          [DEPT_ID] ASC,
          [USER_ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_FUNCTION]    Script Date: 2013/10/21 11:08:23 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_FUNCTION](
          [ID] [int] IDENTITY(1,1) NOT NULL,
          [NAME] [nvarchar](50) NULL,
          [DESCRIPTION] [nvarchar](500) NULL,
          [PARENTFUNC_ID] [int] NULL,
          [CONTROL_ID] [nvarchar](255) NULL,
          [VERSION] [nvarchar](20) NULL,
          [ISEXPIRE] [int] NULL,
          [DIRECTORYNAME] [nvarchar](200) NULL,
          [SYSTEM_TYPE_ID] [nvarchar](255) NULL,
          [CREATETIME] [datetime] NOT NULL,
       CONSTRAINT [PK_T_AUTH_FUNCTION] PRIMARY KEY CLUSTERED 
      (
          [ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_FUNCTION_ROLE]    Script Date: 2013/10/21 11:08:40 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_FUNCTION_ROLE](
          [FUNCTION_ID] [int] NOT NULL,
          [ROLE_ID] [int] NOT NULL,
       CONSTRAINT [PK_T_AUTH_FUNCTION_ROLE] PRIMARY KEY CLUSTERED 
      (
          [FUNCTION_ID] ASC,
          [ROLE_ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_FUNCTION_USER]    Script Date: 2013/10/21 11:08:53 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_FUNCTION_USER](
          [FUNCTION_ID] [int] NOT NULL,
          [USER_ID] [int] NOT NULL,
       CONSTRAINT [PK_T_AUTH_FUNCTION_USER] PRIMARY KEY CLUSTERED 
      (
          [FUNCTION_ID] ASC,
          [USER_ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_ROLE]    Script Date: 2013/10/21 11:09:06 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_ROLE](
          [ID] [int] IDENTITY(1,1) NOT NULL,
          [NAME] [nvarchar](200) NOT NULL,
          [NOTE] [nvarchar](500) NULL,
          [CREATETIME] [datetime] NOT NULL,
       CONSTRAINT [PK_T_AUTH_ROLE] PRIMARY KEY CLUSTERED 
      (
          [ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_USER]    Script Date: 2013/10/21 11:09:17 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_USER](
          [ID] [int] IDENTITY(1,1) NOT NULL,
          [USERID] [nvarchar](255) NOT NULL,
          [PASSWORD] [nvarchar](255) NOT NULL,
          [NAME] [nvarchar](255) NOT NULL,
          [IDENTITYCARD] [nvarchar](255) NULL,
          [OFFICEPTELHONE] [nvarchar](255) NULL,
          [MOBILEPHONE] [nvarchar](255) NULL,
          [EMAIL] [nvarchar](255) NULL,
          [ADDRESS] [nvarchar](255) NULL,
          [POSITION] [nvarchar](255) NULL,
          [ISEXPIRE] [int] NULL,
          [CREATETIME] [datetime] NOT NULL,
       CONSTRAINT [PK_T_AUTH_USER] PRIMARY KEY CLUSTERED 
      (
          [ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO
      
      USE [SecurityDB]
      GO
      
      /****** Object:  Table [dbo].[T_AUTH_USER_ROLE]    Script Date: 2013/10/21 11:09:29 ******/
      SET ANSI_NULLS ON
      GO
      
      SET QUOTED_IDENTIFIER ON
      GO
      
      CREATE TABLE [dbo].[T_AUTH_USER_ROLE](
          [USER_ID] [int] NOT NULL,
          [ROLE_ID] [int] NOT NULL,
       CONSTRAINT [PK_T_AUTH_USER_ROLE] PRIMARY KEY CLUSTERED 
      (
          [USER_ID] ASC,
          [ROLE_ID] ASC
      )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY]
      
      GO

    源码

      尽管有很多不如意,但在开源分享过程中能学到一点东西,希望也对你有所帮助,谢谢!

    致歉

    可能我导出数据脚本有问题,造成很多想研究的朋友数据库不成功,浪费大家时间,对IT人来说,浪费时间等于浪费金钱,生命啊,在此抱歉。

    现在添加上生成表的数据库脚本。

  • 相关阅读:
    shell color
    mac os develop
    git 实用命令
    FlexSlider插件的详细设置参数 http://www.woothemes.com/flexslider/
    å∫ç∂´ƒ©˙ˆ∆˚¬µ˜øπœ®ß†¨√∑≈¥Ω who know?
    apple mac 下使用机械键盘的办法,键盘映射工具软件,apple mac Mechanical keyboard
    地图比例尺与高德地图中的缩放级别(0-20)的映射关系与转换方法
    【转】ViewPager 一屏显示多个子页面
    Android中解析XML格式数据的方法
    Linux 中的 Service
  • 原文地址:https://www.cnblogs.com/aganqin/p/3377850.html
Copyright © 2020-2023  润新知