Fulltext01 Removed
Fulltext01 Removed
1. Introduction…………………………………………………………4
1.1 Background……………………………………………………....................4
1.2 Problem statement ...…………………………………………………….....5
1.3 Problem discussion………………………………………………………....5
1.4 Report Overview…………………………………………………………...5
2. Problem’s solution……………………………………………….....6
2.1 Method...…………………………………………………………………...6
2.2 Programming environments………………………………………………..7
2.3 Database analyzing, design and implementation…………………………10
2.4 Program’s structure analyzing and GUI constructing…………………….12
2.5 Database connections and code implementation………………………….14
2.5.1 Retrieving data from the database………………………………....19
2.5.2 Saving data into the database……………………………………...22
2.5.3 Updating records into the database………………………………..24
2.5.4 Deleting data from the database…………………………………...26
3. Conclusion………………………………………………………....27
4. References………………………………………………………...28
Appendix A: Programming environments and database content….29
Appendix B: Program’s structure and code Implementation……...35
Appendix C: Test Performance…………………………………....56
-3-
1. Introduction
This chapter gives a brief theoretical preview upon the database information systems
and goes through the essence of the problem that should be resolved.
1.1 Background
Most of the contemporary Information systems are based on the Database technology
as a collection of logically related data, and DBMS as a software system allowing the
users to define, create, maintain and control access to the database.
The process of constructing such kind of systems is not so simple. It involves a
mutual development of application program and database. The application program is
actually the bridge between the users and the database, where the data is stored. Thus,
the well-developed application program and database are very important for the
reliability, flexibility and functionality of the system.
The so defined systems differentiate to each other and their development comprises
a great variety of tasks to be resolved and implemented.
The basic idea can be depicted on Figure 1.1 below:
Information System
Dbase Queries
Retrieve
U
S
E Insert Application DBMS Database
R Program
S
Update
Database System
Delete
-4-
Such kind of system could be integrated with other Information systems or modules:
Accounting Information System (AIS) – designed to transform financial data into
information, or Management Information System (MIS) that provides decision-oriented
information to managers, and so on…
“Organizations depend on Information Systems in order to stay competitive.
Productivity, which is crucial to staying competitive, can be increased through better
Information Systems.” [2].
-5-
2. Problem’s Solution
This chapter involves some subsections that concern the basic scheme of resolving the
given task and comprise both the methods and tools of its development as well.
2.1 Method
At the very commencement, I proceeded to a decision to carry out the development of
my task into the following steps:
1. Exploring the available development environments and techniques.
2. Database Analyzing.
3. Database design and Implementation.
4. Program’s Structure Analyzing.
5. GUI (Graphical User Interface) constructing.
6. Bringing all the stuff together (controls data binding and functions
implementation).
7. Tests.
Each one of these steps could be explained in some brief details as follows:
1. Exploring the available development environments and techniques
There is a lot of programming environments available to be used for such kind of
elaborations. The point is to choose such an environment that we will be able to operate
with in a convenient and easy way. This is more or less optional and individual process,
that depends on the developer’s experience as well.
2. Database Analyzing
It concerns all of the demands, put upon the database content and its functionality.
The database should be designed and implemented in a way that the user would expect
it to be.
3. Database design and Implementation
This step is tightly related with the previous one as it is completely determined by
the requirements, analyzed and discussed in step2.
4. Program’s Structure Analyzing
The application program as an interface between the users and the database should
be an accurate “reflection” of the database on the screen; hence a well analyzed and
defined structure is needed.
5. GUI Constructing
After analyzing the program’s structure and defining what it should consist of, a
graphical representation of this stuff is needed in order to enable the user to interact
with the data.
6. Bringing all the stuff together
The next step that should be taken is connecting the program with the database and
performing the necessary functionality upon all of the controls.
7. Tests
To ensure that everything works properly and as it has been expected, test
performance has to be done upon the system’s functionality.
-6-
2.2 Programming Environments
The given task concerns a small company (organization). For instance, for the needs of
a small company, we could use one set of tools, but for the needs of a larger one, it
would be much better if we apply our approach by using some different, that could be
more appropriate and would fit much better the requirements we have to satisfy.
I decided to use the Access Database Environment as a Database Management
System and C# as a programming language for developing my project.
Before proceeding to the explanatory notes of how I have developed the software, I
would like to take a preview upon the programming tools (environments) that have
been used during this project’s development course.
• Database Environment: Access is a typical environment for constructing
relational databases.
The database is the skeleton and the underlying framework of most of the
contemporary Information Systems. The evolution of the Database systems could be
divided into three phases: the Manual-filing System, the File-based systems, and the
Database and the Database Management systems (DBMS).
o The manual-filing system contains files of information, related to a
project, product, task, client, or employee and they are usually labeled
and stored in one or more cabinets. The cabinets may be located in the
secure area of the building, for safety. To facilitate the process of
searching and to find out what we want, more quickly, the different
types of item can be put in separate folders and they remain logically
related.
Actually, the needs of the contemporary industrial world could not be
covered or satisfied by using such kind of systems, and especially what
concerns their reliability and efficiency.
o Thus, we historically reach to the second phase of the Database
systems evolution – the File-based systems. This kind of systems had
been developed in response to the needs and demands of industry for a
more efficient data access [1]. The basic idea into the development of
this type of systems, is that each Department in an organization (for
instance) has an access to its own data (files) through application
programs. (Figure 2.1):
-7-
The primary key fields could be set to Auto-number data type as Access creates these
values in an ascending order to ensure that they are unique within a table. Some of the
fields should be “adjusted” to accept null-values. It is quite important to be done as it is
tightly related to the input fields of the application program. I decided to perform it in
the following way: those fields that are compulsory to be filled by the user I have set
not to accept any null-values of data and on the other hand, those ones, that can be left
blank, are set to accept null-values. It is easy to be performed by changing the Allow
Zero Length setting (Appendix A: Figure 11 – Setting a data-field to accept null-
values).
It is just needed to go to the desired field that has to be set, and switch between the
two options, offered into the “Allow Zero Length” field. In the example, shown above,
the Personal_ID_Number field is set not to allow any null-values thus its field’s length
can not be zero as its value is quite essential for identifying an employee as an
individual and distinctive person.
That has been considered and done for a kind of convenience as the user would wish
not to enter all of the data at the moment, and come back later.
- 12 -
2.5.1 Retrieving data from the database
Retrieving data from a database is less or more tightly related to dealing with the
SELECT query that should be applied to the database in order to extract the desirable
result, which one should satisfy certain conditions. This SQL query has the following
structure:
SLECT <column_name>
FROM <table_name>
WHERE [(condition_1), (condition_2), …..(condition_n)].
Into the WHERE-statement, the following logical and arithmetical operators are
included as well: [AND, OR, <, <=, >, >=, =]. The data from the database is retrieved
in three different ways:
By clicking on the (Load Records) button: It calls the event handler, associated with
this event, and operates as follows – Appendix B: Figure 13 – Load/Edit button click
event and Figure 14 – Trying to establish a connection to the database, evoked by the
Load/Edit button click event. It sets some of the functionality properties of some of the
other buttons, logically related to the eventual operations that may be performed upon
the retrieved data and calls a function that establishes a connection to the database and
performs the desirable SQL query upon it. Its implementation is shown in Appendix B:
Figure 15.
Function ( fnGetDataConnection() ) is implemented in a separate class, located in a
different file. Actually, all of the functions dealing with the data operations in the
program have been put there.
The SELECT query here retrieves all data from Employees_Details data table. This
data is uploaded into the data grid and all text fields of personalDetails and
cWorkingHistory pages, which ones are related to the content of Employees_Details
data table.
• After loading the available records existing into the main table, we can
proceed to upload and other existing records from another table by switching
from one tab-page to another. That performs a SQL query for retrieving data
from the main table plus data from its related (child) table. It is shown in
Appendix B: Figure 16 – Function performing the select query expression.
In this expression, we use the primary and the foreign key values from the parent
and the child tables, as the relationship between them should be explicitly specified. We
also use a WHERE- statement in order to specify and the person these records belong
to. Afterwards, a result table is constructed by joining the records from the child table
to their related record from the parent data table.
The operation performed in this way, is a kind of convenience as the data source is
still Employees_Details and it is not necessary to switch our data-binding process to
another source of data every time, when we go to any other table of the database. It is
very important to know which person (employee) these records belong to. In
accordance with that, the function above takes three input parameters:
fName=First Name, lName=Last Name and idNumber= Personal ID Number, and
applies them to the WHERE-statement’s condition.
- 19 -
These explanatory notes are graphically presented on Figure 2.13:
Value_1 Value_1
Value_2 Value_2
………
……… ………
………
Value_N Value_N
RESULT TABLE
The last way of retrieving data into the program is by the Search field, provided for
seeking certain employee’s data.
Search by certain condition (given values): The search field consists of two
functional buttons and three text fields for giving the input parameters as string values
through which ones the search process will be performed. The first functional button is
located above the data grid and put in a line with other functional buttons. Actually, it
unlocks the search field and enables it for receiving data - Figure 2.14:
- 20 -
Every time, when it’s clicked, its current style and colour properties are changed in
order to show that is in active mode. After clicking upon it, we can proceed to the
Search field, located a bit further below - Figure 2.15:
The search engine operates with the exact values of the First Name, Last Name and
Personal ID Number attributes.
Sufficient and correct information has to be input unless we want zero records to be
found. Four available cases have been considered:
a. First Name and Personal ID Number.
b. Last Name and Personal ID Number.
c. First Name and Last Name.
d. Personal ID Number.
This search conditions are embedded in a SELECT-query as follows - Figure 2.16:
After the search query execution upon the database, we need to populate the data
grid and the relevant text fields with this data – Appendix B: Figure 17 - Uploading
data into the Datagrid, in order to be on disposal of the program’s users.
If no any data record is found, a message box pops up on the screen, telling the user
that such a person doesn’t exists into the database – Appendix B: Figure 18.
- 21 -
To upload the data into the text fields of the form, a data-binding function is called:
The entire function’s body is shown in Appendix B: Figure 19 Search function – code
implementation.
For test samples, see Appendix C: Figure 2.1- successful Search operation and
Figure 2.2-Search failure.
- 22 -
We can see how and the other functions operate. For simplicity, only one of them is
going to be shown - Appendix B: Figure 24 Function, saving data into the child data-
table Working_History, as they are constructed to act almost in the same way.
All of these functions use the Get_Connection(Table_Name, ID) and
Get_Primary_Key(Table_Name, Primary_Key_Value, ID) methods, which ones are
very essential for the purposes, they have been constructed. Get_Connection() Method
is shown in Appendix B: Figure 25. When the method (function) shown in Figure 24 is
called, then the primary key’s value is taken from the parent table and after that the
obtained value is inserted into the relative child table.
Another method is embedded within these functions – Appendix B: Figure 26. This
method extracts the maximum value of the primary key, which has been automatically
generated beforehand and just put it into the condition of the UPDATE statement, in
order to save the data on the appropriate and correct place into the database, as every
next record should be inserted after the last one. The maximum value is easily obtained
by using the SELECT query as all of the primary key values are set to be generated in
an ascending order.
Adding a record to the database: We need to press the “Add a Record” button in
order to enable the “Save a Record” button and to prepare the fields for the input stream
of data - Figure 2.18:
After filling the required information into the text fields, all of the fields are checked
whether sufficient information is given or not. The test-samples are shown in
Appendix C.2.
That’s all concerning the Save-data process as such as it has been implemented into
my program.
- 24 -
2.5.4 Deleting data from the database
This kind of operation, performed upon the database, is subdivided into two parts:
Single Records Deletion and All Records Deletion. Both parts concern only single
employee’s data into the database. Deleting a single record from the database means
moving to a certain child table, selecting the record we want to be deleted and press the
“Delete a Record” button. The result is instantly reflected into the database and back
into the program as well. There is a bit difference between performing single record
deletion into the child tables and performing a delete operation upon the whole amount
of records of an employee. In the second case we need to delete the employee’s record
into the parent table as well, but before proceeding to this final action we have to ensure
that all of his records into the child tables are fully erased. Otherwise, the DBMS will
not allow any data into the parent table to be deleted! I made up as simple approach as
it was possible: I have constructed a delete function for every single child table, erasing
all of the records of the selected employee. These functions go through the child tables
and when all data gets deleted, a function, erasing the record into the parent table, is
called as last.
• Single Record Deletion: means that only the current record we want to delete,
shall be removed from the database. For this purpose, we can use the functional
buttons, related to a record in each data table. The click-event of such a button is
shown in Appendix B: Figure 33 Click-event function and Figure 34 Delete
function, evoked within the click-event’s body.
The test-samples are shown in Appendix C.4.1.
• All Records Deletion: To perform successfully this kind of operation upon the
whole data of an employee, existing into the database, we firstly need to delete
consequently all of his records into the child tables and then proceed to the
parent table. By clicking the “Delete All” button, a click-event is involved as it
is shown in Appendix B: Figure 35. Into the code in Figure 35, we get, or at
least try to obtain the primary key values from every single child table in order
to ensure that there is (are) available record(s) there, because in other way
exception is thrown and the operation crashes down.
To cope with these special cases, a “try-catch” statement has been considered and
put to deal with the emergencies of this kind. In case there is no any record, then the
primary key is automatically initialized to zero (0), unambiguously showing that there
is no any available record into the current child table – Appendix B: Figure 36 Function
obtaining the primary key’s value. If the primary key is not zero, then the delete
function is called to be performed upon the found record(s) – Appendix B: Figure 37
Function, deleting all records of an employee. Afterwards, we go back to the basic
function, in which body all of this stuff is involved, and keep on operating in the same
way with the rest of the child tables until we reach to the parent table’s operative
function, shown in Appendix B: Figure 38 and Figure 39 – Delete function, operating
upon the records into the parent data table.
A test-sample showing this function’s performance is illustrated in Appendix C.4.2.
- 26 -
3. Conclusion
In this report, an information system’s development has been presented. It was
emphasized on the basic steps, consequently taken during the project’s development
course as a particular attention was turned to the basic operative functions performed
upon the data into the database.
The report’s content comprises the whole task solution, starting from the programming
environments have been selected, going through the database, the application’s analyze
and construction, and finishing with the code-implementation and test-samples, shown
separately in Appendix chapters.
As a future work, some additional stuff could be implemented and integrated into the
application code making it much more reliable and flexible; especially what concerns a
pay-roll module, for instance.
Apparently, the role of such systems is basic and essential within each company that
wants to keep a really good control and record concerning its personnel data,
functionality and performance on all levels in its structure. Every organization, in
nowadays, has the necessity of managing its staff on a really good level as the staff has
definitely the greatest merit of building up a company as such as it is. The well-
managed staff means giving the appropriate financial award-ness and all kind of
benefits as such as they have been deserved. That’s why the development of such
systems is not just a programming business – a lot of people are ordinarily involved in
such projects and one of the basic requirements is the reliability of the system,
especially what concerns the storage of data and all of the operations that will be
performed upon it.
- 27 -
4. References
[1] – Begg Carolyn, Connolly Thomas, Database systems (a Practical approach to
Design, Implementation, and Management), Addison-Wesley, an imprint of
Pearson Education, University of Paisley (U.K.), Fourth edition 2005
[2] – Bodnar George /Duquesne University/, Hopwood William /Florida Atlantic
University/, Accounting Information systems, Eighth Edition, Prentice Hall,
Upper Saddle River, New Jersey .
[3] – Andersen Virginia, Access 2000: The Complete Reference, Blacklick, OH, USA:
McGraw-Hill Professional Book Group, 2001,
http://site.ebrary.com/lib/vaxjo/Doc?id=5002842 (2006-05-25).
[4] – Andersson Tobias, [DAB744] C# Course Lectures, School of Mathematics and
System Engineering, Växjö University.
[5] - http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vbcon/html/vboritextboxctltasks.asp (2006-05-25).
- 28 -
• Check-function for the information related to one of the data tables:
Figure B.22
Figure B.23
- 47 -
• Function, saving data into a child table (Working History):
Figure B.24
Figure B.25
- 48 -
• Function, extracting the maximum value of the primary key:
Figure B.26
Figure B.27
- 49 -