advanced vision application in 3 tiers. vb app.e xe web page? bus object 1 bus object 2 bus object 3...

Post on 04-Jan-2016

226 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Advanced Vision Application in 3 Tiers

Vb app.exe

Vb app.exe

web page?

Bus Object 1

Bus Object 2

Bus Object 3

Business layer

ActiveX DLL (COM DLL)

Presentation Layer Data Layer

ActiveX DLL (COM DLL)

Data Object 1

Data Object 2

Data Object 3

Three Tier Logical Model

Presentation Services provides the interface to the end user of the system  

 Business Services

takes care of business logic or business tasks, validation and computations.

Data Servicesprovides the capability and security required to retrieve, insert, update and delete data that is required by the business service

 UML (Unified Modeling Language) -- a graphical language for visualizing, specifying, constructing, and documenting software systems.   A class diagram shows

•all the classes in your application•what tier each class is in •the relationships between the classes.

UML Class Diagram

Order Order

Method1()Method2()<Get>Property 1<Get>Property 2<Let>Property 3

Order ClassOrder Class (Expanded)

Sample Class Diagram

Designing 3 Tier Systems

Most Important Guidelines

Presentation layer

•should not contain any information or names that directly relate to the data source or data schema.

•should not require a reference to ADO library

•should not contain any business logic

Business layer

•should contain all calculations and validation.

•should not query the database directly

•should not communicate directly with the user

Data layer

•should not contain business logic

•should not communicate directly with the user

User Services Business Services Data Services

<<Form>>frmPatient

<<Class Module>>clsPatient

<<Class Module>>clsInsurance

<<Class Module>>clsPatientData

<<Class Module>>clsInsuranceData

Name Data Type Description

City string patient’s city

FirstName string patient’s first name

Insurance Code Integer patient’s insurance code

LastName string patient’s last name

Patient Number integer patient’s ID number

Phone string patients’s phone

Policy Number string patient’s policy number

State string patient’s state

ZipCode string patient’s zip code

Properties

clsPatient

Name Description Return Value Arguments

Absolute Position Returns position in recordset

Integer None

Add adds a new patient record

None None

CancelUpdate Cancels a new record

None None

Delete deletes a record None None

Filter Filters data boolean FieldName:string

Searchvalue:string

MoveFirst Moves to first record

none none

MoveNext Moves to next record

none none

MoveLast Moves to last record

none none

MovePrevious moves to previous record

none none

Methods

clsPatient

Name Description Arguments

PropertyChange Notification that a property value has changed

propertyname:string

Events

clsPatient

Name Description Return Value Arguments

RecordCount returns count of records

integer none

Save saves updates none none

ShowAllRecords removes filters none none

Sort sorts the records none SortString:string

Methods

clsInsurance

Name Data Type Description

none

Properties

Name Description Return Value Arguments

GetInsuranceList Fills an array with the codes and names of the insurance companies

None None

NumberOfInsuranceCompanies Returns the number of companies in list

List():Variant List():Variant

Methods

Name Description Arguments

none

Events

clsInsurance

Name Data Type Description

City string patient’s city

FirstName string patient’s first name

Insurance Code Integer patient’s insurance code

LastName string patient’s last name

Patient Number integer patient’s ID number

Phone string patients’s phone

Policy Number string patient’s policy number

State string patient’s state

ZipCode string patient’s zip code

Properties

clsPatientData

Name Description Return Value

Arguments

Absolute Position Returns position in recordset

Integer None

Add adds a new patient record None None

CancelUpdate Cancels a new record None None

Filter Filters data boolean FieldName:string

MoveFirst Moves to first record none Searchvalue:string

MoveNext Moves to next record none  

MoveLast Moves to last record none none

MovePrevious moves to previous record none none

RecordCount returns count of records integer none

MethodsclsPatientData

Name Description Arguments

DataChange Notification that data for the patient record has changed

none

Events

clsPatientData

Name Description Return Value

Arguments

Save saves updates none none

ShowAllRecords removes filters none none

Sort sorts the records none SortString:string

MoveLast Moves to last record none none

MovePrevious moves to previous record none none

Methods

Name Data Type Description

InsuranceRecords Recordset Holds Recordset of Insurance Companies

Properties

clsInsuranceData

Name Description Return Value Arguments

RecordCount Returns number of records Integer None

Methods

Name Description Arguments

none

Events

Form Load

Required Tasks•Create connection•Create patient recordset•Create insurance recordset

•Set Connection String•Open the Connection •Open Patient Recordset•Open Insurance Recordset •Fill Insurance Combo box •Close Insurance Recordset

•Set Sort Order •Set Form Values

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Create clsPatient object

1. Create clsPatientData object

1. Create Conn2. Create Patient

RecordSet3. Set Conn

String4. Open Conn5. Open Patient

Recordset6. Move First

clsPatient Class_InitializeclsPatientData Class_InitializeSet mobjPatient = New

clsPatient

2. UpdateProperties 1. Properties return values of current record

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset •Fill Insurance Combo box •Close Insurance Recordset

•Set Sort Order •Set Form Values

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Create clsInsurance object

1. Create clsInsuranceData object

1. Create Conn2. Create

Insurance RecordSet

3. Set Conn String

4. Open Conn5. Open

Insurance Recordset

clsInsurance Class_Initialize

clsInsuranceData Class_InitializeSet mobjInsurance = New

clsInsurance

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset-DONE

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset - DONE •Fill Insurance Combo box •Close Insurance Recordset

•Set Sort Order •Set Form Values

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Call GetInsurance List Method, Pass the array Ins to hold list

1. Calls GetRows method of clsInsuranceData.

InsuranceRecords

2. Sets ByRef array equal to result of GetRows

1. Returns Insurance Recordset

clsInsurance GetInsuranceList Method

clsInsuranceData InsuranceRecords PropertymobjInsurance.

GetInsuranceList Ins

2. Fill combobox with contents of Ins Array

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset-DONE

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset - DONE •Fill Insurance Combo box - DONE

•Close Insurance Recordset

•Set Sort Order •Set Form Values

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Terminate Insurance Object

1. Set mobjInsData = Nothing

1. Close Insurance Recordset

2. Close Conn3. Terminate

Insurance Recordset

4. Terminate Connection

clsInsurance Class_Terminate

clsInsuranceData Class_TerminateSet mobjInsurance

= Nothing

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset-DONE

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset - DONE •Fill Insurance Combo box - DONE

•Close Insurance Recordset- DONE

•Set Sort Order •Set Form Values

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Calls Sort Method of clsPatient

1. Calls Sort Method of clsPatientData

1. Selects Field Name based on string that is passed

2. Calls sort method of patient recordset

3. Raises DataChange Event

clsPatient.SortclsPatientData.SortmobjPatient.Sort "Patient

Number"

1. UpdatesProperties

2. Raises Property Change Event

mobjPatientData_DataChange()

1. Properties return values of current record

1. Assigns Form Values

mobjPatient_PropertyChange

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset-DONE

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset - DONE •Fill Insurance Combo box - DONE

•Close Insurance Recordset- DONE

•Set Sort Order- DONE•Set Form Values- DONE

•DisplayRecordCount

Form Load

Presentation Business Data

AVB.mdb

1. Calls absolute position method of mobjPatient

1. Calls clsPatientData.AbsolutePosition

1. mrsPatient.AbsolutePosition

clsPatient.AbsolutePositionclsPatientData.AbsolutePosition

mobjPatient.AbsolutePosition

1. Calls RecordCount Method of mobjPatient

mobjPatient.RecordCount

1. Calls clsPatientData.RecordCount

clsPatient.RecordCount

1. mrsPatient. RecordCount

clsPatientData.RecordCount

Form Load

Required Tasks•Create connection - DONE•Create patient recordset- DONE•Create insurance recordset-DONE

•Set Connection String - DONE•Open the Connection- DONE •Open Patient Recordset - DONE•Open Insurance Recordset - DONE •Fill Insurance Combo box - DONE

•Close Insurance Recordset- DONE

•Set Sort Order- DONE•Set Form Values- DONE

•DisplayRecordCount- DONE

MoveLast

Required Tasks•mrsPatient.MoveLast•DisplayRecordCount•Set Form Elements

MoveLast

Presentation Business Data

AVB.mdb

1. Calls clsPatientData.MoveLast

clsPatient.MoveLast

1. mrsPatient.MoveLast

2. Raise DataChange Event

clsPatientData.MoveLast

1. Calls MoveLast method of mobjPatient

mobjPatient.MoveLast

1. UpdatesProperties

2. Raises Property Change Event

mobjPatientData_DataChange()

1. Properties return values of current record

1. Assigns Form Values

mobjPatient_PropertyChange

Delete

Required Tasks•Create Command object•Set Connection String•Set Command String•Execute Command•Requery Recordset•Check to see if deleted last record•Update form elements

Delete

Presentation Business Data

AVB.mdb

1. Calls clsPatientData.Delete (passes Patient ID)

clsPatient.Delete

1. Calls Delete method of mobjPatient

mobjPatient.Delete

1. UpdatesProperties

2. Raises Property Change Event

mobjPatientData_DataChange()

1. Properties return values of current record

1. Assigns Form Values

mobjPatient_PropertyChange

1. Creates Command

2. Sets Conn3. Sets Command

Text4. Executes5. Requeries6. Raises

DataChange Event

clsPatientData.Delete

Form Unload

Required Tasks•Close Patient RecordSet•Close Connection•Set Recordset = nothing•Set Connection = nothing

Form Unload

Presentation Business Data

AVB.mdb

1. Set mobjPatientData= Nothing

clsPatient Class_Terminate

1. Set mobjPatient to Nothing

Set mobjPatient = Nothing

1. Close Recordset2. Close Conn3. Set RS = nothing4. Set Conn =

nothing

clsPatientData class_Terminate

top related