Aircoinst 三层架构ASP.NET开源

一、结构&环境介绍

<数据结构> 如下

BLL 业务逻辑层

DAL 数据交换层

FULL 全局变量

Model 实体类

UI 层为 WebApp

数据库为:SQL SERVER 2008 R2

IDE为:Visual Studio 2019 Pro

层的引用如下所示

BLL →DAL

BLL → Model

DAL → Model

FULL  → BLL

FULL → Model

UI → 全部层

这几个层是什么意思想必大家都知道

[FULL]层负责控制全局的用户ID 和用户名

2、ASP.NET 版本为.NET farmworker 4.6版本  服务器为 IIS7.0版本 数据库为 SQL SERVER 2008R2

二、目录介绍

1、BLL 业务逻辑层

(1)inquire.cs类

验证登录是否成功

源码如下:

 1 #region << 版 本 注 释 >>
 2 /*----------------------------------------------------------------
 3 * 项目名称 :BLL
 4 * 项目描述 :
 5 * 类 名 称 :Inquire
 6 * 类 描 述 :
 7 * 所在的域 :AIRCOINST
 8 * 命名空间 :BLL
 9 * 机器名称 :AIRCOINST 
10 * CLR 版本 :4.0.30319.42000
11 * 作    者 :RenZe
12 * 创建时间 :2019/5/12 11:50:38
13 * 更新时间 :2019/5/12 11:50:38
14 * 版 本 号 :v1.0.0.0
15 *******************************************************************
16 * Copyright @ RenZe 2019. All rights reserved.
17 *******************************************************************
18 //----------------------------------------------------------------*/
19 #endregion
20 using System.Collections.Generic;
21 using System.Linq;
22 using System.Text;
23 using DAL;
24 using Model;
25 using System.Threading.Tasks;
26 using System.Windows.Forms;
27 using System;
28 
29 namespace BLL
30 {
31     public class Inquire
32     {
33 
34     }
35     public class Inquire_Sign
36     {
37         public User_Table user_Login(string NickName, string Password)
38         {
39             InquireData inquireData = new InquireData();
40             User_Table user_Table = inquireData.select_Usert(NickName, Password);
41             if (user_Table != null)
42             {
43                 return user_Table;
44             }
45             else
46             {
47                 throw new Exception("登陆失败");
48             }
49         }
50 
51     }  //用户登陆
52     public class Inquire_Query_User 
53     {
54         public User_Table user_Query(string UserID,string UserName)
55         {
56             InquireData inquireData = new InquireData();
57             User_Table user_Table = inquireData.select_Userts(UserID, UserName);
58             if (user_Table != null)
59             {
60                 return user_Table;
61             }
62             else
63             {
64                 throw new Exception("查询失败");
65             }
66         }
67     }  //查询个人信息
68     public class Inquire_Query_User_Login_record
69     {
70         public User_Table user_Query(string UserID,string Login_record)
71         {
72             InquireData inquireData = new InquireData();
73             User_Table user_Table = inquireData.SelectLogin_record(UserID, Login_record);
74             if (user_Table != null)
75             {
76                 return user_Table;
77             }
78             else
79             {
80                 throw new Exception("查询失败");
81             }
82         }
83     }   //查询登陆次数
84 
85 }
View Code

-----------inquire.cs类-----------

(2)LoginManger.cs类 

用于登录验证

源码如下

  1 #region << 版 本 注 释 >>
  2 /*----------------------------------------------------------------
  3 * 项目名称 :BLL
  4 * 项目描述 :
  5 * 类 名 称 :LoginManger
  6 * 类 描 述 :
  7 * 所在的域 :AIRCOINST
  8 * 命名空间 :BLL
  9 * 机器名称 :AIRCOINST 
 10 * CLR 版本 :4.0.30319.42000
 11 * 作    者 :RenZe
 12 * 创建时间 :2019/5/11 23:45:13
 13 * 更新时间 :2019/5/11 23:45:13
 14 * 版 本 号 :v1.0.0.0
 15 *******************************************************************
 16 * Copyright @ RenZe 2019. All rights reserved.
 17 *******************************************************************
 18 //----------------------------------------------------------------*/
 19 #endregion
 20 using System;
 21 using System.Collections.Generic;
 22 using System.Linq;
 23 using System.Text;
 24 using System.Threading.Tasks;
 25 using DAL;
 26 using Model;
 27 
 28 namespace BLL
 29 {
 30     public class LoginManger
 31     {
 32         private DataWrite dataWrite = new DataWrite();
 33         public bool Add(User_Table user_Table, out string messageStr)
 34         {
 35             messageStr = "";
 36             bool isSuccess = false;
 37             if (user_Table.UserName.Trim().Length != 0)
 38             {
 39                 dataWrite.AddUser(user_Table);
 40                 isSuccess = true;
 41                 //if (userDB.Equals(userInfo))
 42                 //{
 43                 //    userDB.AddUser(userInfo);
 44                 //    isSuccess = true;
 45                 //}
 46                 //else
 47                 //{
 48                 //    messageStr = "有相同的值";
 49                 //}
 50             }
 51             else
 52             {
 53                 messageStr = "不能为空";
 54             }
 55             return isSuccess;
 56         }
 57     }    //用户注册验证
 58     
 59     public class Login_record
 60     {
 61         private DataWrite dataWrite = new DataWrite();
 62         public bool Add(User_Table user_Table, out string messageStr)
 63         {
 64             messageStr = "";
 65             bool isSuccess = false;
 66             if (user_Table.Login_record != 0)
 67             {
 68                 dataWrite.AddLogin_record(user_Table);
 69                 isSuccess = true;
 70                 //if (userDB.Equals(userInfo))
 71                 //{
 72                 //    userDB.AddUser(userInfo);
 73                 //    isSuccess = true;
 74                 //}
 75                 //else
 76                 //{
 77                 //    messageStr = "有相同的值";
 78                 //}
 79             }
 80             else
 81             {
 82                 messageStr = "不能为空";
 83             }
 84             return isSuccess;
 85         }
 86     }    //写入登陆次数验证
 87     public class AddUser_document
 88     {
 89         private DataWrite dataWrite = new DataWrite();
 90         public bool Add(User_Document user_Document,out string messageStr)
 91         {
 92             messageStr = "";
 93             bool isSuccess = false;
 94             if (user_Document.Doc_head.Trim().Length != 0)
 95             {
 96                 dataWrite.AddDocument(user_Document);
 97                 isSuccess = true;
 98             }
 99             else
100             {
101                 messageStr = "不能为空";
102             }
103             return isSuccess;
104         }
105     }
106 }
View Code
 

-----------LoginManger.cs类----------- 

2、DAL 数据交换层

(1)AEScook.cs类

用于登录密码加密解密数

源码如下:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Security.Cryptography;
 6 using System.Threading.Tasks;
 7 
 8 namespace DAL { 
 9 
10     public class AEScook
11     {
12         /// <summary>
13         /// AES加密
14         /// </summary>
15         /// <param name="text">加密字符</param>
16         /// <param name="password">加密的密码</param>
17         /// <param name="iv">密钥</param>
18         /// <returns></returns>
19         public string AESEncrypt(string text, string password, string iv)
20         {
21             RijndaelManaged rijndaelCipher = new RijndaelManaged();
22             rijndaelCipher.Mode = CipherMode.CBC;
23             rijndaelCipher.Padding = PaddingMode.PKCS7;
24             rijndaelCipher.KeySize = 128;
25             rijndaelCipher.BlockSize = 128;
26             byte[] pwdBytes = System.Text.Encoding.UTF8.GetBytes(password);
27             byte[] keyBytes = new byte[16];
28             int len = pwdBytes.Length;
29             if (len > keyBytes.Length) len = keyBytes.Length;
30             System.Array.Copy(pwdBytes, keyBytes, len);
31             rijndaelCipher.Key = keyBytes;
32             byte[] ivBytes = System.Text.Encoding.UTF8.GetBytes(iv);
33             rijndaelCipher.IV = new byte[16];
34             ICryptoTransform transform = rijndaelCipher.CreateEncryptor();
35             byte[] plainText = Encoding.UTF8.GetBytes(text);
36             byte[] cipherBytes = transform.TransformFinalBlock(plainText, 0, plainText.Length);
37             return Convert.ToBase64String(cipherBytes);
38         }
39         /// <summary>
40         /// AES解密
41         /// </summary>
42         /// <param name="text"></param>
43         /// <param name="password"></param>
44         /// <param name="iv"></param>
45         /// <returns></returns>
46         public string AESDecrypt(string text, string password, string iv)
47         {
48             RijndaelManaged rijndaelCipher = new RijndaelManaged();
49             rijndaelCipher.Mode = CipherMode.CBC;
50             rijndaelCipher.Padding = PaddingMode.PKCS7;
51             rijndaelCipher.KeySize = 128;
52             rijndaelCipher.BlockSize = 128;
53             byte[] encryptedData = Convert.FromBase64String(text);
54             byte[] pwdBytes = System.Text.Encoding.UTF8.GetBytes(password);
55             byte[] keyBytes = new byte[16];
56             int len = pwdBytes.Length;
57             if (len > keyBytes.Length) len = keyBytes.Length;
58             System.Array.Copy(pwdBytes, keyBytes, len);
59             rijndaelCipher.Key = keyBytes;
60             byte[] ivBytes = System.Text.Encoding.UTF8.GetBytes(iv);
61             rijndaelCipher.IV = ivBytes;
62             ICryptoTransform transform = rijndaelCipher.CreateDecryptor();
63             byte[] plainText = transform.TransformFinalBlock(encryptedData, 0, encryptedData.Length);
64             return Encoding.UTF8.GetString(plainText);
65         }
66     }
67 }
View Code
 

-----------AEScook.cs类-----------

(2)DataWrite.cs类

数据库写入类,主要负责数据库的insert 和 Update 操作

  1 #region << 版 本 注 释 >>
  2 /*----------------------------------------------------------------
  3 * 项目名称 :DAL
  4 * 项目描述 :
  5 * 类 名 称 :DataWrite
  6 * 类 描 述 :
  7 * 所在的域 :AIRCOINST
  8 * 命名空间 :DAL
  9 * 机器名称 :AIRCOINST 
 10 * CLR 版本 :4.0.30319.42000
 11 * 作    者 :RenZe
 12 * 创建时间 :2019/5/11 23:29:17
 13 * 更新时间 :2019/5/11 23:29:17
 14 * 版 本 号 :v1.0.0.0
 15 *******************************************************************
 16 * Copyright @ RenZe 2019. All rights reserved.
 17 *******************************************************************
 18 //----------------------------------------------------------------*/
 19 #endregion
 20 using System;
 21 using System.Collections.Generic;
 22 using System.Linq;
 23 using System.Text;
 24 using System.Threading.Tasks;
 25 using System.Data;
 26 using System.Data.SqlClient;
 27 using Model;
 28 using DAL;
 29 using System.Configuration;
 30 using Microsoft.ApplicationBlocks.Data;
 31 
 32 namespace DAL
 33 {
 34     public class DataWrite
 35     {
 36         AEScook eScook = new AEScook();
 37 
 38 
 39         private string connString = ConfigurationManager.ConnectionStrings["connString"].ToString();
 40 
 41         /// <summary>
 42         /// 数据库写入
 43         /// </summary>
 44         /// <param name="user_Table">用户表</param>
 45         /// <returns></returns>
 46         public int AddUser(User_Table user_Table)
 47         //用户注册
 48         {
 49 
 50             string commandText = "insert into User_Table (UserName,NickName,Password,CreateDate,PwdDeed,Permission,Date_Of_Birth,Age,Sex,IDCard)values(@UserName,@NickName,@Password,@CreateDate,@PwdDeed,@Permission,@Date_Of_Birth,@Age,@Sex,@IDCard)"; //数据库写入
 51             SqlParameter[] paras = new SqlParameter[]
 52             {
 53                 #region 数据传值
 54                 new SqlParameter("@UserName",user_Table.UserName),
 55                 new SqlParameter("@NickName",user_Table.NickName),
 56                 new SqlParameter("@Password",user_Table.Password),
 57                 new SqlParameter("@CreateDate",user_Table.CreateDate),
 58                 new SqlParameter("@PwdDeed",user_Table.PwdDeed),
 59                 new SqlParameter("@Permission",user_Table.Permission),
 60                 new SqlParameter("@Date_Of_Birth",user_Table.Date_Of_Birth),
 61                 new SqlParameter("@Age",user_Table.Age),
 62                 new SqlParameter("@Sex",user_Table.Sex),
 63                 new SqlParameter("@IDCard",user_Table.IDCard)
 64                 #endregion 数据传值
 65             };
 66             return SqlHelper.ExecuteNonQuery(connString, CommandType.Text, commandText, paras);
 67         }
 68         /// <summary>
 69         /// 数据库写入
 70         /// </summary>
 71         /// <param name="user_Table">用户表</param>
 72         /// <returns></returns>
 73         public int AddLogin_record(User_Table user_Table)
 74         //升级插入每个用户登陆的次数
 75         {
 76             string commandText = "UPDATE User_Table SET  Login_record = @Login_record WHERE UserID = @UserID";
 77             SqlParameter[] paras = new SqlParameter[]
 78             {
 79                 #region 数据传值
 80                 new SqlParameter("@Login_record",user_Table.Login_record),
 81                 new SqlParameter("@UserID",user_Table.UserID)
 82                 #endregion 数据传值
 83             };
 84             return SqlHelper.ExecuteNonQuery(connString, CommandType.Text, commandText, paras);
 85         }
 86 
 87         /// <summary>
 88         /// 数据库写入
 89         /// </summary>
 90         /// <param name="user_Document">用户文档表</param>
 91         /// <returns></returns>
 92         public int AddDocument(User_Document user_Document)
 93         {
 94             string commandText = "insert into User_Document (Doc_head,Doc_brief_head,Doc_column,Doc_type,Doc_array,Doc_key,Doc_summary,Doc_author,Doc_source,Doc_Date,UserName,UserID)values(@Doc_head,@Doc_brief_head,@Doc_column,@Doc_type,@Doc_array,@Doc_key,@Doc_summary,@Doc_author,@Doc_source,@Doc_Date,@UserName,@UserID)";
 95             SqlParameter[] paras = new SqlParameter[]
 96             {
 97                 new SqlParameter("@Doc_head",user_Document.Doc_head),
 98                 new SqlParameter("@Doc_brief_head",user_Document.Doc_brief_head),
 99                 new SqlParameter("@Doc_column",user_Document.Doc_column),
100                 new SqlParameter("@Doc_type",user_Document.Doc_type),
101                 new SqlParameter("@Doc_array",user_Document.Doc_array),
102                 new SqlParameter("@Doc_key",user_Document.Doc_key),
103                 new SqlParameter("@Doc_summary",user_Document.Doc_summary),
104                 new SqlParameter("@Doc_author",user_Document.Doc_author),
105                 new SqlParameter("@Doc_source",user_Document.Doc_source),
106                 new SqlParameter("@Doc_Date",user_Document.Doc_Date),
107                 new SqlParameter("@UserName",user_Document.UserName),
108                 new SqlParameter("@UserID",user_Document.UserID)
109             };
110             return SqlHelper.ExecuteNonQuery(connString, CommandType.Text, commandText, paras);
111         }
112     }
113 }
View Code
 

-----------DataWrite.cs类-----------

(3)InquireData.cs类

主要用于数据库的select条件查询

源码如下:

  1 #region << 版 本 注 释 >>
  2 /*----------------------------------------------------------------
  3 * 项目名称 :DAL
  4 * 项目描述 :
  5 * 类 名 称 :InquireData
  6 * 类 描 述 :
  7 * 所在的域 :AIRCOINST
  8 * 命名空间 :DAL
  9 * 机器名称 :AIRCOINST 
 10 * CLR 版本 :4.0.30319.42000
 11 * 作    者 :RenZe
 12 * 创建时间 :2019/5/12 12:13:48
 13 * 更新时间 :2019/5/12 12:13:48
 14 * 版 本 号 :v1.0.0.0
 15 *******************************************************************
 16 * Copyright @ RenZe 2019. All rights reserved.
 17 *******************************************************************
 18 //----------------------------------------------------------------*/
 19 #endregion
 20 using System.Collections.Generic;
 21 using System.Linq;
 22 using System.Text;
 23 using System.Threading.Tasks;
 24 using System.Data;
 25 using System.Data.SqlClient;
 26 using System.Configuration;
 27 using System;
 28 
 29 namespace DAL
 30 {
 31     public class InquireData
 32     {
 33         private string connString = ConfigurationManager.ConnectionStrings["connString"].ToString();
 34 
 35         /// <summary>
 36         ///  登陆验证并查询
 37         /// </summary>
 38         /// <param name="NickName">用户名</param>
 39         /// <param name="Password">密 码</param>
 40         /// <returns></returns>
 41         public Model.User_Table select_Usert(string NickName, string Password)
 42         {
 43             using (SqlConnection conn = new SqlConnection(connString))
 44             {
 45                 SqlCommand cmd = conn.CreateCommand();
 46                 cmd.CommandText = @"select UserID,UserName,NickName,Password from User_Table where NickName=@NickName and Password=@Password";
 47                 cmd.CommandType = CommandType.Text;
 48                 cmd.Parameters.Add(new SqlParameter(@"NickName", NickName));
 49                 cmd.Parameters.Add(new SqlParameter(@"Password", Password));
 50                 conn.Open();
 51                 SqlDataReader reader = cmd.ExecuteReader();
 52                 Model.User_Table user_Table = null;
 53                 while (reader.Read())
 54                 {
 55                     if (user_Table == null)
 56                     {
 57                         user_Table = new Model.User_Table();
 58                     }
 59                     user_Table.UserID = reader.GetInt32(0);
 60                     user_Table.UserName = reader.GetString(1).ToString();
 61                     user_Table.NickName = reader.GetString(2).ToString();
 62                     user_Table.Password = reader.GetString(3).ToString();
 63                 }
 64                 return user_Table;
 65             }
 66         } //用户登陆
 67         public Model.User_Table select_Userts(string UserID, string UserName)
 68         {
 69 
 70             using (SqlConnection conn = new SqlConnection(connString))
 71             {
 72                 SqlCommand cmd = conn.CreateCommand();
 73                 cmd.CommandText = "select UserID,UserName,NickName,Sex,IDCard,Date_Of_Birth from User_Table where UserID=@UserID and UserName=@UserName";
 74                 cmd.CommandType = CommandType.Text;
 75                 cmd.Parameters.Add(new SqlParameter(@"UserID", UserID));
 76                 cmd.Parameters.Add(new SqlParameter(@"UserName", UserName));
 77                 conn.Open();
 78                 SqlDataReader reader = cmd.ExecuteReader();
 79                 Model.User_Table user_Table = null;
 80                 while (reader.Read())
 81                 {
 82                     if (user_Table == null)
 83                     {
 84                         user_Table = new Model.User_Table();
 85                     }
 86                     user_Table.UserID = reader.GetInt32(0);
 87                     user_Table.UserName = reader.GetString(1).ToString();
 88                     user_Table.NickName = reader.GetString(2).ToString();
 89                     user_Table.Sex = reader.GetString(3).ToString();
 90                     user_Table.IDCard = reader.GetString(4).ToString();
 91                     user_Table.Date_Of_Birth = reader.GetDateTime(5);
 92                 }
 93                 return user_Table;
 94             }
 95         }  //获取个人信息
 96         public Model.Menu_Table Select_Menu(string 次级, string 应用程序ID, string 顺序)
 97         {
 98             using (SqlConnection conn = new SqlConnection(connString))
 99             {
100                 SqlCommand cmd = conn.CreateCommand();
101                 cmd.CommandText = @"select * from 菜单项 where @级次 = 2 and @应用程序ID=-1 order by 顺序";
102                 cmd.CommandType = CommandType.Text;
103                 cmd.Parameters.Add(new SqlParameter(@"次级", 次级));
104                 cmd.Parameters.Add(new SqlParameter(@"应用程序ID", 应用程序ID));
105                 cmd.Parameters.Add(new SqlParameter("顺序", 顺序));
106                 conn.Open();
107                 SqlDataReader reader = cmd.ExecuteReader();
108                 Model.Menu_Table menu_Table = null;
109                 while (reader.Read())
110                 {
111                     if (menu_Table == null)
112                     {
113                         menu_Table = new Model.Menu_Table();
114                     }
115                     menu_Table.菜单项ID = reader.GetInt32(0);
116                     menu_Table.级次 = reader.GetInt32(1);
117                     menu_Table.顺序 = reader.GetInt32(1);
118                 }
119                 return menu_Table;
120             }
121         } //菜单项
122         public Model.User_Table SelectLogin_record(string UserID,string Login_record)
123         {
124             using (SqlConnection conn = new SqlConnection(connString))
125             {
126                 SqlCommand cmd = conn.CreateCommand();
127                 cmd.CommandText = @"select UserID,Login_record from User_Table where Login_record=@Login_record";
128                 cmd.CommandType = CommandType.Text;
129                 cmd.Parameters.Add(new SqlParameter(@"Login_record", Login_record));
130                 conn.Open();
131                 SqlDataReader reader = cmd.ExecuteReader();
132                 Model.User_Table user_Table = null;
133                 while (reader.Read())
134                 {
135                     if (user_Table == null)
136                     {
137                         user_Table = new Model.User_Table();
138                     }
139                     user_Table.UserID = reader.GetInt32(0);
140                     user_Table.Login_record = reader.GetInt32(1);
141                 }
142                 return user_Table;
143             }
144         } //获取登陆次数
145     }
146 }

-----------InquireData.cs类-----------

(4)SQLHelper.cs类 

此类是MSDN官方类,里面包含数十种数据库操作<本人已经成功汉化,部分未汉化>

源码如下:

   1 下载链接: 链接: https://pan.baidu.com/s/12G-QBID7Pyyl4-Rs1z59ag 提取码: ck8w 

-----------SLQHelp.cs-----------

 3、Model 实体类

  Model是什么?它什么也不是!它在三层架构中是可有可无的。它其实就是面向对象编程中最基本的东西:类。一个桌子是一个类,一条新闻也是一个类,int、string、doublie等也是类,它仅仅是一个类而已。
这样,Model在三层架构中的位置,和int,string等变量的地位就一样了,没有其它的目的,仅用于数据的存储而已,只不过它存储的是复杂的数据。所以如果你的项目中对象都非常简单,那么不用Model而直接传递多个参数也能做成三层架构。
那为什么还要有Model呢,它的好处是什么呢。下面是思考一个问题时想到的,插在这里:
Model在各层参数传递时到底能起到做大的作用?
在各层间传递参数时,可以这样:
AddUser(userId,userName,userPassword,…,)
也可以这样:
AddUser(userInfo)
这两种方法那个好呢。一目了然,肯定是第二种要好很多。
什么时候用普通变量类型(int,string,guid,double)在各层之间传递参数,什么使用Model传递?下面几个方法:
SelectUser(int UserId)
SelectUserByName(string username)
SelectUserByName(string username,string password)
SelectUserByEmail(string email)
SelectUserByEmail(string email,string password)
可以概括为:
SelectUser(userId)
SelectUser(user)
这里用user这个Model对象囊括了username,password,email这三个参数的四种组合模式。UserId其实也可以合并到user中,但项目中其它BLL都实现了带有id参数的接口,所以这里也保留这一项。
传入了userInfo,那如何处理呢,这个就需要按照先后的顺序了,有具体代码决定。
这里按这个顺序处理
首先看是否同时具有username和password,然后看是否同时具有email和password,然后看是否有username,然后看是否有email。依次处理。
这样,如果以后增加一个新内容,会员卡(number),则无需更改接口,只要在DAL的代码中增加对number的支持就行,然后前台增加会员卡一项内容的表现与处理即可。

(1)Sql_Datatable.cs类:

源码如下:

#region << 版 本 注 释 >>
/*----------------------------------------------------------------
* 项目名称 :Model
* 项目描述 :
* 类 名 称 :Sql_Datatable
* 类 描 述 :
* 所在的域 :AIRCOINST
* 命名空间 :Model
* 机器名称 :AIRCOINST 
* CLR 版本 :4.0.30319.42000
* 作    者 :RenZe
* 创建时间 :2019/5/11 23:08:16
* 更新时间 :2019/5/11 23:08:16
* 版 本 号 :v1.0.0.0
*******************************************************************
* Copyright @ RenZe 2019. All rights reserved.
*******************************************************************
//----------------------------------------------------------------*/
#endregion
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 菜单项
    /// </summary>
    public class Menu_Table
    {
        public int 菜单项ID { get; set; }
        public string 菜单项名称 { get; set; }
        public string 操作集合 { get; set; }
        public string 菜单项编号 { get; set; }
        public string 角色ID { get; set; }
        public string 窗体路径 { get; set; }
        public bool 是否无权时隐藏 { get; set; }
        public int 级次 { get; set; }
        public int 顺序 { get; set; }
        public string 进入时图标 { get; set; }
        public string 离开时图标 { get; set; }
        public int 应用程序ID { get; set; }
        public int 所属菜单项ID { get; set; }
    }
    /// <summary>
    /// 用户
    /// </summary>
    public class User_Table
    {
        //用户ID (用于其他关联)
        public int UserID { get; set; } 

        //用户名
        public string UserName { get; set; } 

        //姓名
        public string NickName { get; set; } 

        //身份证
        public string IDCard { get; set; } 

        //密码
        public string Password { get; set; } 

        //注册日期
        public DateTime CreateDate { get; set; } 

        //密码种子(用于找回密码)
        public string PwdDeed { get; set; } 

        //用户权限 (其中1为管理员,其中2为领导,其中3为职员) (用于其他关联)
        public string Permission { get; set; } 

        //出生日期
        public DateTime Date_Of_B { get; set; }  

        //年龄
        public string Age { get; set; } 

        //性别
        public string Sex { get; set; } 

        //登陆记录
        public int Login_record { get; set; } 
    }

    /// <summary>
    /// 文件上传
    /// </summary>
    public class User_UpFile
    {
        //上传文件ID
        public int UpFileID { get; set; }

        //文件名
        public string File_Name { get; set; }

        //文件路径
        public string File_Path { get; set; }

        //用户名  ---  关联用户名
        public string UserName { get; set; }

        //用户ID  ---  关联用户ID
        public string UserID { get; set; } 
    }
    /// <summary>
    /// 文档记录
    /// </summary>
    public class User_Document
    {
        //文档ID
        public int DocID { get; set; }

        //文章标题
        public string Doc_head { get; set; }

        //文章简略标题
        public string Doc_brief_head { get; set; }

        //分类栏目
        public string Doc_column { get; set; }

        //文章类型
        public string Doc_type { get; set; }

        //文档排序
        public string Doc_array { get; set; }

        //文档关键字
        public string Doc_key { get; set; }

        //文档摘要
        public string Doc_summary { get; set; }

        //作者
        public string Doc_author { get; set; }

        // 文档来源
        public string Doc_source { get; set; }

        //创建日期
        public DateTime Doc_Date { get; set; }

        //用户名   ---  关联用户名
        public string UserName { get; set; }

        //用户ID  ---  关联用户ID
        public string UserID { get; set; } 


    }
}

--------Sql_Datatable.cs---------

4、UI层 显示层

UI层就是网站的根目录,包含网页,及网页根目录

目录如图上图所示↑

其中重要的为Web.Config文件

对于我而言主要用来链接数据库使用

链接数据库命令如下:

1 <connectionStrings>
2     <add name="connString" connectionString="Data Source=.;Initial Catalog=你的数据库名称;uid=你的数据库用户名;pwd=你的密码;" providerName="System.Data.SqlClient" />
3   </connectionStrings>

本人开发数据库版本为SQL 2008 R2  

解释如下:connString 为DAL 操作层链接数据库模块的字段 

Data Source = . 为数据库服务器 默认本机数据库为"."

Initial Catalog =WebDate 链接的数据名

uid=sa 链接数据库用户名

pwd=rzt123!@#; 链接数据库密码

原文地址:https://www.cnblogs.com/MineLSG/p/11110934.html