. Net data center charging system instance-three-tier + Design Mode

Source: Internet
Author: User

I recently worked on a. net data center charging system, which is compared with a simple three-tier system. Now I will post it to share with you! Package diagram: The design mode (Abstract Factory) is applied, so that there is no need to have a relationship (application interface) between layer B and layer D, and the abstract factory + reflection + configuration file is applied, the relationship between the factory and the D layer disappears, so that the B layer and the factory only need to know the interface of the D layer, and the D layer is decoupled. The class diagram is omitted here! Timing Diagram: The following is the implementation code. Of course, the login function is implemented in a simple architecture, and some logic processing in the timing diagram has not been applied. U layer: [vb] Public Class Form Private Sub butExit_Click (ByVal sender As System. object, ByVal e As System. eventArgs) Handles butExit. click End Sub Private Sub butLogin_Click (ByVal sender As System. object, ByVal e As System. eventArgs) Handles butLogin. click' defines an object class object and assigns the content in the text box to the object class Object Dim user As Model. teacher = New Model. teacher user. user_ID = txt UserID. text. toString () user. user_PWD = txtUserPWD. text. toString () 'defines a business logic layer object, and notifies the user of the information Dim fd As Facade based on the results returned by the business logic layer. userF = New Facade. userF If fd. query (user) Then MsgBox (True) Else MsgBox (False) End If End Sub End Class Facede layer: [vb] Public Class UserF Dim uB As BLL. userBLL = New BLL. userBLL Function Query (ByVal user As Model. teacher) As Boolean If uB. queryUser (user) Then Return (True) Else Return (False) End If End Function End Class B layer [vb] Public Class UserBLL Dim factory As Factory. userFactory = New Factory. userFactory Dim IUserDAL As IDAL. IUserIDAL Public Function QueryUser (ByVal user As Model. teacher) As Boolean IUserDAL = factory. createUserDAL () If IUserDAL. query_user (user) Then Return (True) Else Return (False) End If End Function End Class Factory layer [vb] Imports System. reflection Imp Orts System. configuration Public Class UserFactory Public Function CreateUserDAL () As IDAL. IUserIDAL Dim AssemblyName = "DAL" 'dim create = "User" Dim create As String = ConfigurationManager. deleetask( "create") Dim className As String 'dim user As DAL. userDAL = New DAL. userDAL 'Return user className = AssemblyName + ". "+ create +" DAL "Return CType (Assembly. load (AssemblyName ). createInstance (FIG) SsName), IDAL. IUserIDAL) End Function End Class IDAL layer [vb] Imports Model Public Interface IUserIDAL Function Query_user (ByVal user As Teacher) As Boolean End Interface, we are also growing up with continuous stumbling lines. It is such a growth that allows us to gradually understand new things and learn about it so that we can grasp it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.