">
" TITLE="Return to Exploration Air Benefits">
B A C K
|
How The Benefit Component Works
The Big Picture
The Exploration Air Employee Benefits application uses the component Benefit,
which has two classes; BenefitList and
Employee.
The purpose of the methods is to encapsulate a specific function
so that the ASP pages can have a defined interface to accomplish work, without concern
for the details of how the work is done.
Why Benefits Uses Components
The use of components has two advantages for the
application developer. First, as changes to the ASP pages are made, the method calls
to the components do not change (unless different functionality is required
from the component). This reduces the complexity of the ASP page and reduces
the likelihood of introducing new bugs through modification of the existing ASP pages.
The second advantage is that the methods can be called by
other applications. For example, the Benefits
application calls the NewBenefits
method of the Employee
component to create the default benefit records for a specified employee. If you had
another application that you wanted to use to set up new employees,
you could have the other application call the NewBenefits
method
to add default benefits.
Design Goals
The design goal of the component was to create methods that encapsulate a single logical
function, such as add a new employee, or return a list of an employee's dependents. Some
methods call other methods in order to accomplish their function, as when the
Employee.AddNew method calls the
Employee.NewBenefits
method to add the benefit records.
All of the methods in the Benefit component require passing the name
of the file DSN to be used
by the method. This makes it easier to use different databases from the same set of ASP pages.
Architectural Details
Both of the classes in the Benefit component are contained in the
Microsoft Transaction Server (MTS) package called Benefit, and are run
by Benefit.dll.
This component was created in Visual Basic 5.0, and can be modified to work with
other database structures because it performs a defined role of application layer
between the presentation layer (in ASP pages) and the database layer (in the SQL
Server database).
The BenefitList Class
The primary focus of the BenefitList class is maintaining the benefits
information in the Benefits database. The component has 21 methods, which are called as needed
by the ASP pages in Benefits, but could also be called by other applications.
AddBenefit
Overview
The AddBenefit method creates a record in EmployeeBenefit for the
specified benefit Id and
employee, and a record in EmployeeBenefitDependent for each dependent of the employee.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being added
lngBenefitId: Benefit Id being added, as defined in the Benefit table
Methods Called
BenefitList.AddEBD
Stored Procedures Called
sp_AddBenefitSelect1
sp_AddBenefitInsert
sp_AddBenefitSelect2
Tables Affected
EmployeeBenefit
EmployeeBenefitDependent
Return Value
No value returned
AddEBD
Overview
The AddEBD method adds a record to the EmployeeBenefitDependent table for the dependent specified,
for every benefit the employee has. Only records for the employee are created as active status
records. All other dependents' records for the employee are created as inactive, and may be activated
by an employee while a change qualifier is in effect.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being added
lngBenefitId: Benefit Id being added, as defined in the Benefit table
lngDependentId: The dependent Id of the dependent who records are to be added for
lngDependentTypeId: The type of dependent for whom records are being
created, as defined in the DependentType table
Methods Called
No methods called
Stored Procedures Called
sp_AddEBD
Tables Affected
EmployeeBenefitDependent
Return Value
No value returned
AddQualifier
Overview
The AddQualifier method adds a record to the EmployeeQualifier table to record that a
qualifying event has occurred that qualifies the employee to change benefit options
as needed, during a period defined in the BenefitQualifier table.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being added
lngQualifierId: Qualifier Id being added, as defined in the Qualifier table
datQualifierDate: The date the qualifying event occurred
Methods Called
No methods called
Stored Procedures Called
sp_AddQualifier
Tables Affected
EmployeeQualifier
Return Value
No value returned
BenefitsForId
Overview
The BenefitsForId method returns a Recordset listing all the benefits the employee has
for the specified year.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being added
intBenefitYear: Benefit year for which benefits are to be created
Methods Called
No methods called
Stored Procedures Called
sp_BenefitsForId
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
BenefitId
ChangeQualifierList
Overview
The ChangeQualifierList method returns a Recordset listing all change qualifiers that apply
to the qualifier class, and to the benefit if specified.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngBenefitId: The benefit Id for which to return the qualifier Ids
lngQualifierClassId: Qualifier class Id for which to return the qualifier Ids
Methods Called
No methods called
Stored Procedures Called
sp_ChangeQualifierList1
-OR-
sp_ChangeQualifierList2
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
If the benefit is specified (causing sp_ChangeQualifierList1 to run)
QualifierId
QualifierLabel
QualifierRank
ChangeDays
If the benefit is not specified (causing sp_ChangeQualifierList2 to run)
QualifierId
QualifierLabel
QualifierRank
CheckQualifier
Overview
The CheckQualifier method returns a Recordset listing all the qualifiers in effect for the
employee and benefit specified. A valid change qualifier is required before changes can
be made to the employee's benefit choices.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which a qualifier is sought
lngBenefitId: Benefit Id for which a qualifier is sought
Methods Called
No methods called
Stored Procedures Called
sp_CheckQualifier
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
QualifierId
CurrentPlan
Overview
The CurrentPlan method returns a Recordset listing the current options selected for the
specified employee and benefit.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the plan information is sought
lngBenefitId: Benefit Id for which the plan information is sought
Methods Called
No methods called
Stored Procedures Called
sp_CurrentPlan
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
BenefitLabel
PlanId
DependentCovered
TaxStatusId
TaxStatusLabel
DependentTypeList
Overview
The DependentTypeList method returns a Recordset listing the dependent types.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
Methods Called
No methods called
Stored Procedures Called
sp_DependentTypeList
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
DependentTypeId
DependentTypeLabel
DependentTypeRank
GenderList
Overview
The GenderList method returns a Recordset listing the gender types.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
Methods Called
No methods called
Stored Procedures Called
sp_GenderList
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
GenderId
GenderLabel
GenderRank
GetTotalCost
Overview
The GetTotalCost method returns a Recordset listing the total cost of the benefits options
currently selected, summing the cost of either benefits paid for with pre-tax or benefits
paid for with after-tax dollars.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the total cost is sought
intBenefitYear: Benefit year for which the total cost is sought
lngTaxStatusId: Tax status Id for which the total cost is sought
Methods Called
No methods called
Stored Procedures Called
sp_GetTotalCost
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
TotalCost
GetTotalCredits
Overview
The GetTotalCredits method returns a Recordset listing the total credits available for
purchase of benefits. Any costs beyond the credit amount are deducted from the
employee's pay.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the total credits are sought
intBenefitYear: Benefit year for which the total credits are sought
Methods Called
No methods called
Stored Procedures Called
sp_GetTotalCredits
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
TotalCredits
GetTotalPaycheck
Overview
The GetTotalPaycheck method returns a Recordset listing the total paycheck after
benefit costs, credits, exemptions, and tax withholding are considered.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the total paycheck is sought
intBenefitYear: Benefit year for which the total paycheck is sought
Methods Called
BenefitList.GetTotalCost
BenefitList.GetTotalCredits
Stored Procedures Called
sp_GetTotalPaycheck
Tables Affected
No tables affected
Return Value
The value of the function is set to the value of curTotalPaycheck
InactivateDependents
Overview
The InactivateDependents method sets the record status to "inactive" for all
the dependents for the specified employee and benefit.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the depenents are inactivated
lngBenefitId: Benefit year for which the depenents are inactivated
Methods Called
No methods called
Stored Procedures Called
sp_InactivateDependents
Tables Affected
EmployeeBenefitDependent
Return Value
No value returned
ListCoveredPersons
Overview
The ListCoveredPersons method returns a Recordset listing all the persons who are covered
under the specified employee and benefit.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The benefit Id for which to list the covered persons
lngBenefitId: Benefit Id for which to list the covered persons
Methods Called
No methods called
Stored Procedures Called
sp_ListCoveredPersons
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
DependentTypeLabel
FirstName
LastName
PhysicianLabel
ListDependents
Overview
The ListDependents method returns a Recordset listing all the persons who are dependents of
the specified employee along with information about their coverage under the specified benefit.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The benefit Id for which to list the dependents
lngBenefitId: Benefit Id for which to list the dependents
Methods Called
No methods called
Stored Procedures Called
sp_ListDependents
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
DependentId
EBDStatus
DependentTypeLabel
LastName
FirstName
PhysicianId
PhysicianList
Overview
The PhysicianList method returns a Recordset listing all the physicians.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
Methods Called
No methods called
Stored Procedures Called
sp_PhysicianList
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
PhysicianId
PhysicianLabel
PlanField
Overview
The PlanField method returns a Recordset listing all the physicians.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngPlanId: The plan Id for which the plan field records should be returned
Methods Called
No methods called
Stored Procedures Called
sp_PlanField
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
FieldLabel
FieldValue
PlanInfo
Overview
The PlanInfo method returns a Recordset listing information about the specified plan.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngBenefitId: The benefit Id for which the plan records should be returned
lngPlanId: The plan Id for which the plan records should be returned
Methods Called
No methods called
Stored Procedures Called
sp_PlanInfo
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
PlanLabel
PlanDesc
PlanCost
PhysicianRequired
PlanRank
PlanList
Overview
The PlanList method returns a Recordset listing plans that fall under the specified benefit Id.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngBenefitId: The benefit Id for which the plan records should be returned
Methods Called
No methods called
Stored Procedures Called
sp_PlanList
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
PlanId
PlanLabel
PlanRank
SaveDependents
Overview
The SaveDependents method changes to "Active" the record status of all the specified records,
and saves the physician Id as needed.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the dependent records should be saved
lngBenefitId: The benefit Id for which the dependent records should be saved
lngDependentId: The benefit Id for which the dependent records should be saved
lngPhysicianId: The benefit Id for which the dependent records should be saved
Methods Called
No methods called
Stored Procedures Called
sp_SaveDependents
Tables Affected
EmployeeBenefitDependent
Return Value
No value returned
SummaryForId
Overview
The SummaryForId method returns a Recordset containing all of the benefit records for the
specified employee and benefit year.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the benefit records should be returned
intBenefitYear: The benefit year for which the benefit records should be returned
Methods Called
No methods called
Stored Procedures Called
sp_SummaryForId
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
BenefitId
BenefitLabel
DetailTemplate
PlanLabel
PlanCost
TaxStatusLabel
TaxStatusList
Overview
The TaxStatusList method returns a Recordset containing all of the tax status records that apply
to the specified benefit Id.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngBenefitId: The benefit Id for which the tax status records should be returned
Methods Called
No methods called
Stored Procedures Called
sp_TaxStatusList
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
TaxStatusId
TaxStatusLabel
TaxDefault
Update
Overview
The Update method updates the EmployeeBenefit table with the specified
plan Id and tax status Id for the specified employee and benefit. Note that this is
the BenefitList.Update method; there is also an
Employee.Update method.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id for which the information should be updated
lngBenefitId: The benefit Id for which the information should be updated
lngPlanId: The plan Id selected under the benefit
lngTaxStatusId: The tax status Id to be applied to the benefit
Methods Called
No methods called
Stored Procedures Called
sp_Update
Tables Affected
EmployeeBenefit
Return Value
No value returned
The Employee Class
The primary focus of the Employee class is maintaining the employee information
in the Benefits database. The class has nine methods, which are called as needed
by the ASP pages in Benefits, but could also be called by other applications.
AddDependent
Overview
The AddDependent method adds a dependent's information to the Benefits database.
It inserts records into the Dependent and EmployeeDependent tables, and calls
BenefitList.AddEBD
to add records to the EmployeeBenefitDependent table.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being added
lngDependentTypeId: The type of dependent being added, as defined in the DependentType table
strFirstName: The first name of the dependent
strLastName: The last name of the dependent
strMiddleName: The middle name of the dependent
strDependentSSN: The Social Security Number of the dependent
lngDependentGenderId: The gender of the dependent, as defined in the Gender table
datDependentBirthdate: The birthdate of the dependent
Methods Called
BenefitList.AddEBD
Stored Procedures Called
No stored procedures called
Tables Affected
Dependent
EmployeeDependent
EmployeeBenefitDependent
Return Value
No value returned
AddEmployeeDependent
Overview
The AddEmployeeDependent method creates a record for the employee in the Dependent table
and in the EmployeeDependent table.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
Dependent
EmployeeDependent
Return Value
No value returned
AddNew
Overview
The AddNew method creates a new record for the specified Windows NT
user name. It inserts a record
into the Employee table with the Windows NT user name set to the value passed in, which was
retrieved from the server variables by the ASP page. It then calls other methods to add the
employee dependent record, new benefits records, and a change qualifier that will allow the
new employee to change benefit choices.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
strNTUserName: The Windows NT user name retrieved from the server variables by the ASP page
intBenefitYear : The benefit year currently in effect
lngQualifierId : The Id of the qualifier that represents adding a new employee
datQualifierDate : The date the new employee was added
Methods Called
Employee.AddEmployeeDependent
Employee.NewBenefits
BenefitList.AddQualifier
Stored Procedures Called
No stored procedures called
Tables Affected
Employee
Dependent
EmployeeDependent
EmployeeBenefitDependent
EmployeeQualifier
Return Value
No value returned
GetDependents
Overview
The GetDependents method returns a Recordset containing information on the specified
employee's dependents.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
DependentId
DependentTypeLabel
LastName
FirstName
MiddleName
DependentBirthdate
GenderLabel
DependentSSN
GetForId
Overview
The GetForId method returns a Recordset containing information on the specified
employee.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
DependentId
FirstName
LastName
MiddleName
KnownAs
NTUserName
DependentSSN
DependentGenderId
DependentBirthdate
Address1
Address2
City
State
PostCode
Country
HomePhone
BusinessPhone
Fax
Email
PeriodEarnings
Exemptions
LookupEmployee
Overview
The LookupEmployee method returns a Recordset containing
the EmployeeId of the current user.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
strLogonUser: The Logon_User value returned by the browser, containing
the Windows NT user name of the current user
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
No tables affected
Return Value
A Recordset is returned containing:
EmployeeId
NewBenefits
Overview
The NewBenefits method creates a new record for each benefit for the
year specified, for the specified employee.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee
intBenefitYear : The benefit year currently in effect
Methods Called
BenefitList.AddBenefit
Stored Procedures Called
No stored procedures called
Tables Affected
EmployeeBenefit
Return Value
No value returned
RemoveDependent
Overview
The RemoveDependent method marks a dependent's records as status
"Delete". This method is used in removing a dependent from an employee's records.
Input Parameters
strFileDSN: The file DSN that should be used in executing this method
lngEmployeeId: The employee Id of the employee whose dependent is being removed
lngDependentId: The dependent Id of the dependent who is being removed
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
EmployeeDependent
EmployeeBenefitDependent
Return Value
No value returned
Update
Overview
The Update method updates demographic information for the specified employee, setting fields
to the specified values. Note that this is the Employee.Update method; there is also a
BenefitList.Update method.
Input Parameters
strFileDSN: File DSN that should be used in executing this method
lngEmployeeId: Employee Id of the employee whose record is being updated
lngDependentId: Dependent Id of the employee's dependent record
strFirstName: Employee first name
strLastName: Employee last name
strMiddleName: Employee middle name
strKnownAs: Employee nickname
strDependentSSN: Employee SSN
lngDependentGenderId: Employee Gender Id
datDependentBirthdate: Employee birthdate
strAddress1: Employee address line 1
strAddress2: Employee address line 2
strCity: Employee city
strState: Employee state
strPostCode: Employee postal code
strCountry: Employee country
strHomePhone: Employee home phone
strBusinessPhone: Employee business phone
strFax: Employee fax number
strEmail: Employee email address
lngExemptions: Employee number of exemptions
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
Employee
Dependent
Return Value
No value returned
UpdateDependent
Overview
The UpdateDependent method updates demographic information for the specified dependent,
setting fields to the specified values.
Input Parameters
strFileDSN: File DSN that should be used in executing this method
lngDependentId: Dependent Id of the dependent record being updated
strDependentSSN: Dependent SSN
lngDependentGenderId: Dependent Gender Id
datDependentBirthdate: Dependent birthdate
Methods Called
No methods called
Stored Procedures Called
No stored procedures called
Tables Affected
Dependent
Return Value
No value returned
|
|