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。

  以上都是准备工作,由于篇幅,看下一篇。



  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 29
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 29
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值