vb.net版机房收费——助你学会七层架构(一)

   我自己写机房的时候,看非常多高人的博客,各种的借鉴,当初务必的纠结,如今整个机房敲完了,写这篇博客给大家一个总体上的、简单理解的七层,期望大家看完这篇文章之后,不会这个纠结了。

  首先大家得看了我的上一篇博客:

  http://blog.csdn.net/qiumuxia0921/article/details/33738319

  我再说就会好说一点,大家仅仅要理解了那张包图之后就能够了。

  首先我还是拿最老套、最简单、最先開始的样例Login開始:

  1、我们要知道Login须要那几步:查询user表,推断用户是否存在;在worklog中加入用户日志。

  2、须要的数据库设计:

  这里我就不另外建表,这样大家看的更熟悉,是吧?


  

  

  3、建立Entity

  实体是依据表来建立的,也就是说,表中有几个字段,Entity的LoginEntity和WorklogEntity类就有几个property。

  本着面面俱到的原则,我就晒晒代码,大家别嫌我麻烦:


  

'**************************
'文 件 名:UserLogin
'命名空间:Entity
'内    容:
'功    能:
'文件关系:
'作    者:邱慕夏
'小    组:邱慕夏
'生成日期:2014-06-07 17:27:28
'版 本 号:V1.0.0.0
'改动日志:
'版权说明:
'***************************
Public Class LoginEntity
#Region "定义变量"
    Private _userID As String
    Private _level As String
    Private _Head As String
    Private _password As String
    Private _oldpassword As String
    Private _userName As String
    Private _computer As String

#End Region
    Public Shared UserHead As String              '设置全局变量
    Public Shared UserLevel As String
    Public Property UserID() As String            '将T_User_DAL表中的每个实体都传上去,实体是依据表来建的,不是功能
        Get
            Return _userID
        End Get
        Set(ByVal value As String)
            _userID = value
        End Set
    End Property
    Public Property Level() As String
        Get
            Return _level
        End Get
        Set(ByVal value As String)
            _level = value
        End Set
    End Property
    Public Property Head() As String
        Get
            Return _Head
        End Get
        Set(ByVal value As String)
            _Head = value
        End Set
    End Property
    Public Property Password() As String
        Get
            Return _password
        End Get
        Set(ByVal value As String)
            _password = value
        End Set
    End Property
    Public Property OldPassword() As String
        Get
            Return _oldpassword
        End Get
        Set(ByVal value As String)
            _oldpassword = value
        End Set
    End Property
    Public Property UserName() As String
        Get
            Return _userName
        End Get
        Set(ByVal value As String)
            _userName = value
        End Set
    End Property
    Public Property computer() As String
        Get
            Return _computer
        End Get
        Set(ByVal value As String)
            _computer = value
        End Set
    End Property

End Class
  

  上面是LoginEntity的,以下是Worklog的:


'**************************
'文 件 名:WorkLogEntity
'命名空间:Entity
'内    容:
'功    能:
'文件关系:
'作    者:邱慕夏
'小    组:邱慕夏
'生成日期:2014/6/15 11:07:47
'版 本 号:V1.0.0.0
'改动日志:
'版权说明:
'***************************
Public Class WorkLogEntity
    Private _userid As String
    Private _level As String
    Private _loginDateTime As String
    Private _LogoutDateTime As String
    Private _computer As String
    Private _status As String
    Public Shared Property Login_DateTime As String


    Public Property UserID() As String
        Get
            Return _userid
        End Get
        Set(ByVal value As String)
            _userid = value
        End Set
    End Property
    Public Property Level() As String
        Get
            Return _level
        End Get
        Set(ByVal value As String)
            _level = value
        End Set
    End Property
    Public Property LoginDateTime() As String
        Get
            Return _loginDateTime
        End Get
        Set(ByVal value As String)
            _loginDateTime = value
        End Set
    End Property
    Public Property LogoutDateTime() As String
        Get
            Return _LogoutDateTime
        End Get
        Set(ByVal value As String)
            _LogoutDateTime = value
        End Set
    End Property
    Public Property Computer() As String
        Get
            Return _computer
        End Get
        Set(ByVal value As String)
            _computer = value
        End Set
    End Property
    Public Property Status() As String
        Get
            Return _status
        End Get
        Set(ByVal value As String)
            _status = value
        End Set
    End Property
End Class

   这里我要说的是LoginEntity中的全局变量,全局变量是系统仅仅要赋给它值,他就会随程序共存亡,所以不须要操心用的时候会为nothing。

  以上都是准备工作,因为篇幅,看下一篇。



郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。