Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 131

A COMPUTERIZED DENTAL MANAGEMENT SYSTEM FOR

C.B.M DENTAL CLINIC

A Project

Presented to

the Faculty of STI College Angeles

In Partial Fulfillment

Of the Requirements for the Degree of

Bachelor of Science in Information Technology

by

Aguilar, Aira Shayne M.

Labausa, Archie A.

Torres, Daryll L.

Yosores, Grace G.

Mr. Jade Baldovino


Project Adviser

April 2019
ADVISER’S RECOMMENDATION SHEET

This Project entitled

A Computerized Dental Management System for C.B.M Dental Clinic

by:

Aguilar, Aira Shayne M.


Labausa, Archie A.
Torres, Daryll L.
Yosores, Grace G.

submitted in partial fulfillment of the requirements of the

Bachelor of Science in Information Technology degree

has been examined and is hereby recommended

for acceptance and approval

Mr. Jade Baldovino

Project Adviser

April 2019
PANEL’S APPROVAL SHEET

This Project entitled

A Computerized Dental Management System for C.B.M Dental Clinic

developed by:

Aguilar, Aira Shayne M.


Labausa, Archie A.
Torres, Daryll L.
Yosores, Grace G.

after having been presented is hereby


approved by the following members of the
panel

Mr. Louie A. Ruiz Ms. Liza G. Mananquil


Panelist Panelist

Mr. Mark Anthony M. Mananquil


Lead Panelist

April 2019
PROJECT COORDINATOR AND DEAN’S ACCEPTANCE SHEET

This Project entitled

A Computerized Dental Management System for C.B.M Dental Clinic

After having been recommended and approved is hereby

accepted by the Information Technology Department

of STI College Angeles

Mr. Louie A. Ruiz


Project Coordinator

Mr. Louie A. Ruiz


Dean
Table of Contents
Abstract
Preface
1 Introduction 1-1
1.1 Statement of the Problem 1-1
1.1.1 General Problem 1-2
1.1.2 Specific Problems 1-2
1.2 Current State of the Technology 1-3
1.3 Objectives 1-4
1.3.1 General Objective 1-4
1.3.2 Specific Objectives 1-5
1.3.3 Scope and Limitations 1-6,1-7
2 Theoretical Framework 2-1
2.1 Introduction 2-1
2.2 Iterative Waterfall Model 2-1
2.2.1 Requirements 2-2
2.2.2 Analysis 2-2
2.2.3 Design 2-2
2.2.4 Coding 2-2
2.2.5 Testing 2-3
2.2.6 Acceptance 2-3
2.3 Information System 2-3
2.4 Database Management System 2-3
2.8 Summary 2-4
3 A Computerized Dental Management System 3-1
3.1 Introduction 3-1
3.2 System Design Specification 3-2
3.3 Diagram Used 3-3
3.4 Hardware and Software Requirement 3-3
3.3.1 User Specification 3-3
3.3.2 Development Specification 3-4
3.5 Programming Language 3-4,3-5
3.6 Summary 3-6
4 Performance Analysis 4-1
4.1 Introduction 4-1
4.2 System Testing 4-1
4.2.1 Unit Testing 4-1
4.2.2 AlphaTesting 4-2
4.2.3 Beta Testing 4-2
4.3 Results and Analysis 4-3
4.4 Summary 4-3
5 Conclusion 5-1

Acknowledgment

List of Appendices

Gantt Chart

Request Letter

Bibliography

Screen Shots

Personal Vitae

User’s Manual

Source Code
Abstract

The information of the patient will all be recorded and save in system wherein there a

required user level to protect the system and the database of the dental clinic. In this project

computerize system is much better than the manual it is easy to save data and the safety of the

patient information. The proponents also created a user friendly system so that the dental clinic

staff can use the system easily. Also, dental clinic will now have easy access for the information

in their patient, scheduled patient, computing their payments, reviewing their previous dental

records. Before the patient will have the record in the system, the patient need to fill-up the

patient form giving by the dental staff/receptionist and the receptionist will register it for the

accounts in the dental clinic. For the appointment, the patient will state the date and time so the

secretary will be the one to set the appointment in the new system which will confirm by the

dentist.
Preface

The patient is manually registered, scheduled, monitored, and their payments are being

computed manually. The current system is all done manually and it take a lot of time and effort

and it can cause the patient to wait a long time for their checkup /needed services.

The proponents develop system that will help the dental clinic to have a user friendly,

secured data, fast and reliable services. The security is greatly improve because the user need to

log-in before access the information of their patients. The system will help the dental clinic to

lessen the work load, retrieve the information for the patient easily .This will assist the clinic to

give greater service and compute payment of patients with the minimum error.
Chapter 1 INTRODUCTION

A Dental Clinic is an organization that’s responsible for providing

medication and treatment for all types of dental care. But how can clinic provide a faster

and more efficient service if they are still using the tradition method in their daily

operation which is index cards? The tradition method means the customer needs to fill in

their details on the registration form manually and the information is kept in files. After

the registration, the files will be place in the filling system and this will cause problem

like taking longer time to retrieve the information, mistake during writing or misplaced of

files .Now days, technology has change many aspects of people’s daily lives and the

index cards system is becoming invisible from the network due to the development of the

Internet and ease of access.

1.1 Statement of the Problem

The clinics’ secretary find the situation difficult to browse records when the

patient calls for another appointment and for the dentist to review the patient’s

previous dental records prior to treatment. Dra. Cyril B. Henson is one of those

clinics who use manual system and encounter problems in keeping up the records

of their patient. It takes time for them to find records because it is stored in a

cabinet only. They also have problem in the accuracy and transparency of

payments. Giving solution to the problem, the group decided to design a system

which can easily track, add new patient records, update treatment and prior billing

by the personnel of the clinic.

A Computerized Dental Management System for CBM Dental Clinic


Dental Clinic Management System is a kind of system that will greatly improve

the productivity and efficiency of dental personnel. It provides guidance and

effectiveness of services to prevent errors. This system can also provide easy data

retrieval, records keeping, and real time record for the management. The

implementation of our Dental Clinic Management System can help the dental

clinic of Dra. Cyril B. Henson. This could assist the clinic to give greater services

and compute payment of patient with minimum error.

1.1.1 General Problem

How will the proponents design, develop, and

implement a Dental Management System for C.B.M

Dental Clinic.

The dental clinic system is all done manually and takes a lot of time

and does not help the dental staff to get the information and the patient to get their

service faster.

1.1.2 Specific Problems

 How will the proponents develop a user log?

The clinic use file cabins in storing files. File cabins

takes a lot of space in the clinic.

 How will the proponents make a scheduling module?

A Computerized Dental Management System for C.B.M Dental Clinic 1-2


The clinic use manual procedure in setting an

appointment and it usually result a conflict in the appointment scheduled.

 How will the proponents make file maintenance?

The clinic uses file cabinet in keeping files of their

patients.

 How will the proponent make registration module?

The clinic use index for as a record form for the

new patient and usually misplaced the form or damage.

 How will the proponents make the computation of the

payment computerize?

The clinic manually to compute the payment.

1.2 Current State of the Technology

CBM Dental Clinic do manual process when it comes of making appointment.

Since the clinic only entertains walk-in reservation, the patient needs to either make a call

through mobile phone or message the clinic’s Facebook page to appoint a schedule for inquiry

and appointment that also includes the date. When the patient visits on the appointed date, , the

new patient has to wait for the dentist to give the services they need and the regular patient has to

wait for their for information to be retrieve by secretary in the file cabinet, retrieve the file need
lots of time and effort. After the treatment, the secretary can now proceed to manual computation

of prices per treatment. C.B.M only accepts cash regarding of payment. Dentist will consult in a

fastest way so that the dentist could finish all the patients, and by that the secretary will lost track

of the patient records.

1.3 Objectives

1.3.1 General Objective

To design, develop, and implement a Computerized Dental

Management System for C.B.M Dental Clinic.

The study aims to develop and design an Information system with partial payment

management that can provide easy data retrieval, record keeping, and real time record for

management and compute payment of patients with minimum error.

1.3.2 Specific Objectives

 User Login Module:

This module gives the option to login for the admin and staff to use the

system.

 Scheduling Module:

It gives the option for the secretary to schedule the appointment for the

patients with their requested date with respect to the treatment.


 File maintenance:

It gives the option to search the records such as personal details, medical

problems, treatment details etc. of the patients who visited earlier to the dental clinic.

 Registration Module:

It gives the option to include all the details of the new patient.

Personal Info: It includes the personal details of the patient such

as name, address, age, contact number of the patient who comes to

the clinic for first time.

 Payment Module:

The secretary has a capability to compute for the payment of the patients for

the given services by the dentist clinic and the dentist will be the one to confirm

the services using the system.

1.3.3 Scope and Limitations

Scope

User Logs
Level of Access – there will be two user for the system which is the

Admin or the Dentist and the Staff.

File Maintenance

Patients Information - this module allows the secretary to view, add,

edit and delete patients’ information.

Patients Appointment – the secretary has the capability to set an

appointment of the patients for their checkup/needed services and the

dentist will only view the list of the appointment..

Billing

Billing of Service Fees – the secretary has a capability to compute the

payment of the patient through the use of the system.

Scheduling

Schedule Appointment – this module allows the secretary to add an

appointment.

Reschedule Appointment - this module allows the secretary to

reschedule an appointment.

Cancel Appointment - this module allows the secretary to cancel an

appointment.
Audit Trail

Backup and Restore - the system allows the dentist to restore the data

such as patient information, appointment history, and bills in the database

that were already deleted.

Reports

Billing Record

Limitations

Damage facilities & equipment


Chapter 2 THEORETICAL FRAMEWORK

2.1 Introduction

Theories are formulated to explain, predict and understand the phenomena, to test the

knowledge within the limits of critical assumption. The theoretical framework is the present

and defines the theories that explain why the problem of this research exists.

The proponents conducted an interview to gather data for the proponents guide to

build the proposed system.

2.2 Methodology

In the development of system we have used Waterfall method, the linear sequential

mode. This model encompasses the following step.

Figure 1.0 Iterative Waterfall Model

A Computerized Dental Management System for CBM Dental Clinic


Requirement-In this step, the proponents gathered requirements, with the goal of determining

how these will be accommodated in the system. The proponents looked for the locale to be used

as our resources in our system and gathered information by means of interview to be analyzed to

our next step.

Analysis – The proponents analyzed the needs and availability of our chosen locale before

designing any application. The proponents also analyzed the locale’s problem which is necessary

to design any solution.

Design- In this phase the proponents tried to focus on some attributes of a program like entities,

data structure, and interface representation. In this we tried to translate requirements into

representation of the software which can be assessed for quality before coding begins. Such as

ERD for graphical representation of entities and their relationship to each other, then we also use

DFD for representation of the flow of the data through an information system this diagram we

can identify the how data flow of the proposed system. and USE CASE is a list of action of the

interaction between a role in this diagram we can identify the who will be the users of the

proposed system.

Coding- In this step, we translated the design of the system into code which can be compiled and

executed. We have done coding for all forms and make sure to produce simple program which

are clear to understand.

Testing- Each of us have executed program on some test data and output of the program

examined to determine if there are any error present. While doing this step, one of us have to

A Computerized Dental Management System for C.B.M Dental Clinic 2-2


read the code carefully to detect any discrepancies between the design specification and the

actual implementation.

Acceptance- This is the step wherein we have to put the system into final application which is

followed by feedback and support.

2.3 Information System

An information system (IS) is any organized system for the collection,

organization, storage and communication of information. More specifically, it is the study of

complementary networks that people and organizations use to collect, filter, and

process, create and distribute data.

Also information system is a group of components that interact to produce information.

2.4 Database Management System

A database management system is a complex set of software programs that

controls the organization, storage, management and retrieval of data in a database. Database

management system categorized according to the data structure or types. It is a set of pre written

programs that are used to store, update and retrieve a database. The database management

accepts request for data from the application program and instructs the operating system to

transfer the appropriate data.


2.5 Summary

In this chapter, the proponents specify the theories included in the designs, database

and development of the proposed system. The theories will serve us guides and reference

for the proponents to develop the system. This will help the proponents develop the

system’s functions and modules.

Dental Management System is a program that will help the secretary browse and

add new patient information, compute the bills and to set appointment. The system will

also help the dentist to monitor the patient previous dental problem, create user account

and password for the trusted personnel only.


Chapter 3 A COMPUTERIZED DENTAL MANAGEMENT SYSTEM
3.1 Introduction

A dental management is a system that will help the patient in CBM Dental Clinic. It

involves three major process that the necessary to achieve the goal of the proponents. First is the

getting and storing the information from the patient to the system that will lessen the time of the

secretary finding the information of the patient. Second is the scheduling of the appointment that

will make the patient and the secretary lessen time by using the system the secretary can input

the date that the patient want through the system and can view by dentist within the day. Lastly

the secretary will lessen the time computing the payment by using the system the receptionist

will have to input the patient ID and the treatment then the system will compute the amount.

The proponents aim to develop a dental clinic management system to help the

secretary lessen their efforts in term of browsing patient information, computing payments and

scheduling appointment it fasten the work of the clinic in patient's information. There are some

confidential information so the proponents added security and storage of the information instead

of using the log books in acquiring patient's information.

Before being able to overcome the problem the proponents need to identify and

structure the problem to create the proposed system. By identifying the problem the proponents

need to plans on how to settle the problem once it is detected the proponents will proceed the

structure of the problem by doing some Data Flow Diagram (DFD), Entity Relationship Diagram

(ERD) and User Case diagram with this all diagram the proponents will solved the problem and

be able to make the proposed system successfully.

A Computerized Dental Management System for C.B.M Dental Clinic


In developing the proposed system, the proponents used different software like

MySQL that can make the proposed system understandable and attractive to the users.

3.2 System Design Specification

The process of defining the structural design modules, components, interface, and

data for the system are known as the system design specification. Proposed system should be

reliable, accurate and preform its function and usage in order to give accurate result, solve the

problem and a good feedback.

A dental clinic management system is a kind of system that will handling the patient's

information, dental care history and payment of patient’s. Report and the information need by the

user of the proposed system will provided (See Appendix)

This system design includes both logical and physical designs. The proponents were

able to identify all the requirement to build up the proposed system, which will defined and

understand the system and the design.

A Computerized Dental Management System for CBM Dental Clinic 3-2


3.3 (Diagrams Used)

Use case Diagram [see on the Appendix A]

The proponents use case diagram to represent o user's relation with the system.

Data Flow Diagram [see on the Appendix A]

DFD is a graphical representation of the flow of data through an instructive system,

demonstrating to its process aspects. A DFD is often used as preliminary system to create an

overview of the system, which can later be elaborated.

Entity Relationship Diagram [see on the Appendix A]

ERD describe inter -related thing of interest of specific domain of knowledge.

The proponent used ERD to show or visualize how the data connected in general way, and are

particular useful for constructing a relational database.

3.4 Hardware

A. Developer (Minimum Requirements)

 Laptop

o Wireless Mouse

o Operating System: Windows 10

o Processor: AMD E2 – 1800 APU with Radeon(tm) HD Graphics 1.70 GHz

o RAM: 2.00GB
o System type: 64-bit Operating System, x64-based processor

B. User (Recommended Requirements)

 Laptop or Desktop

o Operating System: Windows 10

o Processor: AMD E2 – 1800 APU with Radeon(tm) HD Graphics 1.70 GHz

o RAM: 2.00GB

o System type: 64-bit Operating System, x64-based processor

3.5 Programming Language

The proponents need the following software in the completion of the project:

• C#

Is design to work with Microsoft’s.NET platform. Microsoft’s aim is to facilitate

the exchange of information and services over the Web, and to enable developers to build

highly portable applications. C# simplifies programming through its use of Extensible

Markup Language (XML) and Simple Object Access Protocol (SOAP) which allow

access to a programming object or method without requiring the programmer to write

additional code for each step.


The proponent will create a system with the use of C# because it is a language

used exclusively for development of Windows based applications.

• MySQL

It an open source relational to database management system. Information in a

MYSQL database is stored in the form of related tables .Language used by the proponents for the

database.

The proponent will create a system with the use of MySQL. All the information of

client-server process will be stored in a database such as files on the patient and treatment

information.

 PHP

PHP is probably the most popular scripting language on the web. It is used to

enhance web pages. With PHP, you can do things like create username and password

login pages, check details from a form, create forums, picture galleries, surveys, and a

whole lot more.

The proponents use PHP for the connection of desktop application with online

application. PHP will serve as the bridge for the database and online module.

3.6 Summary

This chapter specified the process and features of the proposed system.
The hardware and software using developing the proposed system and the requirements need to

build the system.it also includes the diagrams.

The flow of the proposed system is discuss in the chapter and what the proponents use to

build the system, with the help of our knowledge in creating diagrams to illustrate the flows it

helps us to make the system successful.


Chapter 4 PERFORMANCE ANALYSIS
4.1 Introduction

Data gathering is the most important part in this chapter where necessary

information will be collected. The proponents used different resources and references in

gathering data.

The proposed system should have goals in order for the proponents to have

experiment through it. The proponents study the system flow of the proposed system to identify

the methods that will used such as interviews, research and observation. The proponents conduct

interview especially on the dental clinic to know what are the scope and limitation of the

proposed system. The proponents have researches to have detailed knowledge in doing the

system that is going to develop. And also conducted observation with the current system for the

proponents to verify the outcome after implementing the entire objective listed. The proponents

also conducted a series of test, first the proponents tested the proposed system by themselves to

know what will be the problem and to be able to fix the errors they find. Then the system test by

the teacher and inside the school to know where the failure is and will be able to fix.

4.2 System Testing

In developing the proposed system, the proonents gathered information

through the use of internet and previous thesis books in the school library. Getting information

through those references helps the proponents to get important information that can be

implemented to the proposed system.

A Computerized Dental Management System for CBM Dental Clinic


Before experimenting, the proponents observed the problems of the system of the dental

clinic, how the flow of taking patients information, browsing patient's records , how the

receptionist computed the payments and how long the receptionist can response to the patient's

needs.

And based on the proponents observation, the patient's in dental clinics is manually

monitored, schedules, registered and computing payments. The current system is all done

manually and it takes a lot of time and effort.

With these issues the proponents invasion that if the proposed system will be

implemented to the dental clinic it will help the clinic, will be faster and minimized the time of

the receptionist browsing for information ,accurate appointing and compute patients bills with a

minimum error.

4.2.1 Unit Testing

The proponents divided the source code into modules which are

divide also into units. The proponent’s test all the modules and few error arise and

debugging is also done in this testing.

4.2.2 Alpha Testing

A Computerized Dental Management System for CBM Dental Clinic 4-2


The proponents conducted a survey to test the system per

modules to know the overall evaluation. Testing module will help the proponents

to know what will be the problem and to be fix in same modules.

4.2.3 Beta Testing

The project adviser, dentist and the dental clinic staff will test the

system to know the overall evaluation. Testing the system will know where the

failure arises and the debugging will made.

4.3 Results and Analysis

The proponents conducted survey about the proposed system inside and

outside the school, we have IT instructors and our locale to test the system to know the overall

evaluation. For its interface, if it's user friendly, simplicity, functionalities and information. The

result of the overall analysis is will be computed by the proponents by the use of some

parameter.

4.4 Summary

By means of research, references, observation and knowledge of the proponents to

make the proposed system meet the scope and objectives of the system can make proposed

system successful. The proposed system will be a big help to the clinics especially in browsing

patient information, add new patients information, schedule appointment and computing

payments of the patient.


Chapter 5 CONCLUSION

Using traditional index card for records of the patient take lot of time and sometimes

causing some minor problem specially when browsing patient information, adding previous

dental care which is additional index attach in your records .That’s why the proponents decided

to develop a dental clinic management system, where both dentist and secretary will do their job

in much lessen time, effort and with a minimum error. They can view all the records of patient’s,

also can view the appointment module, and treatment. Also, can easily browse patient data, add

new patient information, set for an appointment for the patient and compute the bills in a

minimum error.

With the use of our system, the dentist can restore patient records that were deleted, the

advantage of implementing our proposed system is the security of patient’s information which is

confidential .So that why we create a log in module where the dentist can create a user account

for his/her secretary that can access the system. Except to create a user account for the system.

A Computerized Dental Management System for CBM Dental Clinic


Acknowledgement

First and foremost, we would like to express our sincere thanks to the almighty God for

the gift of life, wisdom and understanding he had given us, a reason for our existence. To our

families for the love and support they had provided throughout our research.

We also thank our locale, CBM Dental Clinic for having given their time and will during

our interview they had been particularly helpful in providing the necessary data about the manual

patient record system.

Mr. Louie A. Ruiz whom we regard as our mentor and supervisor, we thank him for the

expertise. We believe this good work is a result of his guidance and cooperation.

Lastly, we would like to convey our gratitude to our Faculty for the good job done during

this period of our course especially to our adviser, Mr. Jade Baldovino, for exerting extra effort

to help us and share what he knew. May the Lord bless them and keep them safe, we love you

all.
APPENDICES

A Computerized Dental Management System for CBM Dental Clinic


(Gantt Chart)
(Request Letter)
(Bibliography)
References

[1] Peter McMahon, [Book], “An Introduction to ASP.NET”, retrieved

on May 20, 2012, from

www.dotnet.za.net/book/IntroToASP.NET.pdf

[2] “Web Application Architecture, principles, protocols and

practices” by Leon Shklar, Richar Rosen, [Book], Retrieved on May,

2012.

[3] Tai BC, Seldrup J (2000), “A review of software for data

management, design and analysis of clinical trials”. Ann Acad Med

Singapore 29(5):576–581

[4] Greenes RA, Pappalardo AN, Marble CW, Barnett GO (1969),

“Design and implementation of a clinical data management system”.

Comput Biomed Res 2(5):469–485

[5] Atkinson, J.C., Zeller, G.G., & Shah, C. (2002, May 1),”

Electronic patient records for dental school clinics: more than

paperless systems”. Journal of Dental Education. doi: 66:634-642.

[6] Cederberg, R. A. & Valenza, J. A. (2012, May 1). “Ethics and

the electronic health record in dental school clinics”. Journal of

Dental Education. Doi: 76:584-589.

[7] Chutisant Kerdvibulvech+, Nwe Ni Win, “The Dentist

Online Reservation System Design and Implementation Web

Based Application and Database Management System Project”,


International Conference on Education Technology and Computer

(ICETC2012) IPCSIT vol.43 (2012)

[8] Krishnan, A., Nongkynrih, B., Yadav, K., Singh, S. & Gupta,

V. (2010, November 16). “Evaluation of computerized health

management information system for primary health care in rural

India”. BMC Health Services Research. 2010; 10(310).

Chat Conversation End


(Screen Shots)

Login
Home Page
Registration

Patients
Walk-in Patients

Records

Appointment
Transaction Reports

Archive
Audit Trail

User Audit
(Personal Vitae)

Curriculum Vitae of
AIRA SHAYNE M. AGUILAR
Purok 4-B Arayat Blvd. Pampang, Angeles City
airaaguilar31@gmail.com
09263546085

EDUCATIONAL BACKGROUND
Level Inclusive Dates Name of school/ Institution
Tertiary Present STI College Angeles
High School 2011-2015 Angeles City National High School
Elementary 2005-2011 Jesus Is Lord Christian School

PROFESSIONAL OR VOLUNTEER EXPERIENCE


Nature of Experience/ Name and Address of Company or
Inclusive Dates Job Title Organization
March 2017 Call Center Agent Friendship, Angeles City

AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A

SKILLS
SKILLS Level of Competency Date Acquired
Basic Knowledge in software Average
programming using C#
MS Office: Word, Intermediate
PowerPoint, Excel

TRAININGS, SEMINARS OR WORKSHOP ATTENDED


Inclusive Dates Title of Training, Seminar or Workshop
2016 NYC
2016 Y4IT
2015 NYC

Curriculum Vitae of
GRACE G. YOSORES
Jesus St. Brgy Pulungbulu, Angeles City
yosoresgrace14@gmail.com
0907217160

EDUCATIONAL BACKGROUND
Level Inclusive Dates Name of school/ Institution
Tertiary Present STI College Angeles
High School 2010-2015 FGNMHS
Elementary 2003-2010 Pulungbulu Elementary School

PROFESSIONAL OR VOLUNTEER EXPERIENCE


Nature of Experience/ Name and Address of Company or
Inclusive Dates Job Title Organization
N/A N/A N/A

AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A

SKILLS
SKILLS Level of Competency Date Acquired
Basic Knowledge in software Average
programming using C#
MS Office: Word, Intermediate
PowerPoint, Excel

TRAININGS, SEMINARS OR WORKSHOP ATTENDED


Inclusive Dates Title of Training, Seminar or Workshop
2016 NYC
2015 NYC

Curriculum Vitae of
ARCHIE A. LABAUSA
De Guzman St. Balibago Angeles City
deathzeolabausa@gmail.com

EDUCATIONAL BACKGROUND
Level Inclusive Dates Name of school/ Institution
Tertiary Present STI College Angeles
High School 2010-2015 RLMHS
Elementary 2003-2010 Gueco Balibago Elementary School

PROFESSIONAL OR VOLUNTEER EXPERIENCE


Nature of Experience/ Name and Address of Company or
Inclusive Dates Job Title Organization
N/A N/A N/A

AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A

SKILLS
SKILLS Level of Competency Date Acquired

MS Office: Word, Intermediate


PowerPoint, Excel

TRAININGS, SEMINARS OR WORKSHOP ATTENDED


Inclusive Dates Title of Training, Seminar or Workshop
2016 NYC
2015 NYC

Curriculum Vitae of
DARYLL L. TORRES
Pulungbulu, Angeles City
darylltorres@gmail.com

EDUCATIONAL BACKGROUND
Level Inclusive Dates Name of school/ Institution
Tertiary Present STI College Angeles
High School 2010-2015 RLMHS
Elementary 2003-2010 Sto. Rosario Elementary School

PROFESSIONAL OR VOLUNTEER EXPERIENCE


Nature of Experience/ Name and Address of Company or
Inclusive Dates Job Title Organization
N/A N/A N/A

AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A

SKILLS
SKILLS Level of Competency Date Acquired

MS Office: Word, Intermediate


PowerPoint, Excel

TRAININGS, SEMINARS OR WORKSHOP ATTENDED


Inclusive Dates Title of Training, Seminar or Workshop
2016 NYC
2015 NYC
(User’s Manual)
(Source Code)
User’s Manual for the Guest

 Index Page

Close Button
This will let the
user to close the
form

Login Module
The user has to login in
order to create an
appointment

 Home Page for the User


Logout
Let the user logout

Registration
Allows the user Transaction
to create Let the user to view
patient’s past transactions

Walk-In
Let the user to Audit Trail
make transaction Let the user to view
with walk in login trails
patients
Patients Appointment
Allows the user to Let the user to set
view, delete, and edit appointment for
patient’s information the patient

Records Archive
Let the user to view, Let the user to view
start and print all deleted patient
receipt for the information
patient scheduled
 Register Module
Back Button
Allows the user to go
back to the main
menu

R
cu

Add t
Button d
Allows a
the o
Save th
user
p
to Butto
ti
i nC
n
i Allows
a
the
n
user
c
save
e
the
l
patient
’sB
u
inform
t
ation
t
o
n
L
e
t
t
h
e
u
s
e
r
t
o
c
a
n
c
e
l
t
h
e
i
n
p
u
List all patient
View regis s
tered

U n
pd in
 Pa B ate m
tie o
Bu Del
nt S
A
tto ete
s n Bu
M Let C
tto
od the
ul use na
n
Allo
e r
wsc
to
e
the
upd
ate
l
user
P info toB
rma u
dele
tion tet
from t
infor
the mati
o
patien on
t n
fro
L
me
the
t
pati
t
ent
h
e
u
s
e
r
t
o
c
a
n
c
e
l
t
h
e
s
e
l
e
c
t
e
d
p
a
ti
e
List
Vie
w
Let
the
use
r to
vie
w
all
regi
ster
ed
pati
ents
 Appointment Module

Back Button
Let the user to go
back on the main
menu

Patient’s
Information
Patient Let the user to view
Appointment all registered patients
Shows the patient’s
information,
selected services, Search
date, time and Allows the user to
amount of the search a specific last
service name or id number

Scheduled
Appointment
Let the user to view
all patients’
appointment

Confirm Button
Allows the user to
save all data input
and save to the
database

Cancel Button
Let the user to cancel
the selected patient
information
 Transaction Module

Back Button
Let the user to go
back on the main
menu

Search
Allows the user to
Calendar search a specific last
Let the user name or id number
to view the
past
transaction of the
patients Past
Appointment
Let the user to
view all patients’
appointment

Daily Reports
Summary of past transaction of the
patients

 Walk In Module
Back Button
Let the user to go
back on the main
menu

Patient Information
Shows all the registered
patient’s information

Patient Walk In
Shows the patient’s information,
selected services, date, time and
amount of the service

Search
Print Button Open Button Allows the user to
Let the user to Allows the user to search a specific
print the receipt of open the receipt of last name or id
the patient the user number
 Record Module

Back Button
Let the user to go back to
the main menu

Radio Buttons
Displays records based on their status

Cancel Button Open Button


Allows the user to cancel Allows the user to open
an appointment the receipt of the patient

 Archive Module

Back Button
Let the user to go back to
the main menu

Search
Let the user to search a
specific last name or id

List View
Allows the user to view all
deleted patient
information

 Audit Trail
The user need to login to view the audit trail

Back Button
Let the user to go back to
the main menu

List View
Let the user to view all
login trails
Appointment.cs
using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Appointment : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Appointment()
{
InitializeComponent();
}

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users WHERE status=0 ORDER BY timestamp";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}
private void Appointment_Load(object sender, EventArgs e)
{
date.MinDate = date.TodayDate.AddDays(1); chosenDate.Text
= date.SelectionRange.Start.ToString("yyyy-MM-dd");

LoadList();
LoadData();
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text =
lsvList.SelectedItems[0].SubItems[1].Text; txtfn.Text
= lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text =
lsvList.SelectedItems[0].SubItems[3].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "Select * from users WHERE userid ='" + txtid.Text + "'";

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["userid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
}
}

private void lsvList_Click(object sender, EventArgs e)


{
SetRecords();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
description.Items.Clear();

if (type.Text == "Bone Graft")


{
description.Items.Add("Cosmetic Consultation");
}
else if (type.Text == "Dental Crown")
{
description.Items.Add("Gold Crown");
description.Items.Add("Permanent Crown");
description.Items.Add("PFM Crown");
description.Items.Add("Porcelain Crown");
description.Items.Add("Resin Crown");
description.Items.Add("Zirconia Crown");
}
else if (type.Text == "Dental Bridges")
{
description.Items.Add("Permanent Bridges");
description.Items.Add("PFM Bridge");
description.Items.Add("Porcelain Bridge");
description.Items.Add("Temporary Bridge");
}
else if (type.Text == "Preventive Dentistry")
{
description.Items.Add("Prophylaxis-Child");
description.Items.Add("Prophylaxis-Child + Flouride");
description.Items.Add("Prophylaxis-Adult (Regular)");
description.Items.Add("Prophylaxis-Adult (Heavy Plaque)");
description.Items.Add("Prophylaxis-Adult (Heavy Stain)");
}
}

private void description_SelectedIndexChanged(object sender, EventArgs e)


{
if (description.Text == "Cosmetic Consultation")
{
amount.Text = "6000";
}
else if (description.Text == "Gold Crown")
{
amount.Text = "25000";
}
else if (description.Text == "Permanent Crown")
{
amount.Text = "8000";
}
else if (description.Text == "PFM Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Porcelain Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Resin Crown")
{
amount.Text = "3000";
}
else if (description.Text == "Zirconia Crown")
{
amount.Text = "18000";
}
else if (description.Text == "Permanent Bridges")
{
amount.Text = "21000";
}
else if (description.Text == "PFM Bridge")
{
amount.Text = "21000";
}
else if (description.Text == "Porcelain Bridge")
{
amount.Text = "18000";
}
else if (description.Text == "Temporary Bridge")
{
amount.Text = "4500";
}
else if (description.Text == "Prophylaxis-Child")
{
amount.Text = "600";
}
else if (description.Text == "Prophylaxis-Child + Flouride")
{
amount.Text = "1200";
}
else if (description.Text == "Prophylaxis-Adult (Regular)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Plaque)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Stain)")
{
amount.Text = "1500";
}

date.Enabled = true;
time.Enabled = true;

private void date_DateChanged(object sender, DateRangeEventArgs e)


{
chosenDate.Text = date.SelectionRange.Start.ToString("yyyy-MM-dd");

time.Items.Clear();

time.Items.Add("09:30 AM");
time.Items.Add("10:00 AM");
time.Items.Add("10:30 AM");
time.Items.Add("11:00 AM");
time.Items.Add("11:30 AM");
time.Items.Add("12:00 PM");
time.Items.Add("12:30 PM");
time.Items.Add("13:00 (1:00 PM)");
time.Items.Add("13:30 (1:30 PM)");
time.Items.Add("14:00 (2:00 PM)");
time.Items.Add("14:30 (2:30 PM)");
time.Items.Add("15:00 (3:00 PM)");
time.Items.Add("15:30 (3:30 PM)");
time.Items.Add("16:00 (4:00 PM)");
time.Items.Add("16:00 (4:30 PM)");
time.Items.Add("17:00 (5:00 PM)");
time.Items.Add("17:00 (5:30 PM)");
}

private void date_MouseLeave(object sender, EventArgs e)


{
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "SELECT * FROM reservation WHERE status=0";

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
if (dr["date"].ToString() == chosenDate.Text)
{
string re =
dr["time"].ToString();
time.Items.Remove(re);
}
}
}
}

private void Clear()


{
txtid.Text = "";
txtln.Text = "";
txtfn.Text = "";
txtmn.Text = "";
txtcn.Text = "";
type.Text = "";
description.Text = "";
date.Text = "";
time.Text = "";
amount.Text = "";
}

private void LoadData()


{
datalist.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["middlename"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
datalist.Items.Add(item);
}
}
}

private void addbtn_Click(object sender, EventArgs e)


{
if (String.IsNullOrEmpty(txtfn.Text) || String.IsNullOrEmpty(txtln.Text) ||
String.IsNullOrEmpty(txtcn.Text) || String.IsNullOrEmpty(type.Text) ||
String.IsNullOrEmpty(description.Text) || String.IsNullOrEmpty(chosenDate.Text) ||
String.IsNullOrEmpty(time.Text))
{

MessageBox.Show("Please complete the form!");

}
else
{

OpenConnect();
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "SELECT * FROM reservation WHERE resid="+txtid.Text+" AND
service='"+type.Text+"' AND type='"+description.Text+"'";
MySqlDataReader dr2 = cmd2.ExecuteReader();

if(dr2.HasRows == true)
{
while (dr2.Read()){
MessageBox.Show("Duplicate record is not allowed!");
}}
else{ DialogResu
lt ans;
ans = MessageBox.Show("Are you sure you want to save?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "INSERT INTO reservation
(resid,lastname,firstname,middlename,contact,service,type,date,time,amount,status)
VALUES('" + txtid.Text + "','" + txtln.Text + "', '" + txtfn.Text + "', '" + txtmn.Text +
"', '" + txtcn.Text + "','" + type.Text + "','" + description.Text + "','" +
chosenDate.Text + "','" + time.Text + "','" + amount.Text + "', '0')";

// Declare a reader, through which we will read the data.


MySqlDataReader rdr = cmd.ExecuteReader();
MessageBox.Show("Reservation Successful!");

Clear();
LoadData();
}
}
}
}

private void lsvList_SelectedIndexChanged(object sender, EventArgs e)


{
LoadData();
}

private void txtSearch_TextChanged(object sender, EventArgs e)


{
lsvList.Items.Clear();
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command

if (rdoID.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE userid LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}
else if (rdoLN.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE lastname LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}

private void rdoLN_CheckedChanged(object sender, EventArgs e)


{

}
private void SetRecords2()
{
txtid.Text = datalist.SelectedItems[0].Text;
txtln.Text = datalist.SelectedItems[0].SubItems[1].Text;
txtfn.Text = datalist.SelectedItems[0].SubItems[2].Text;
txtmn.Text = datalist.SelectedItems[0].SubItems[3].Text;
type.Text = datalist.SelectedItems[0].SubItems[4].Text;
description.Text = datalist.SelectedItems[0].SubItems[5].Text;
date.Text = datalist.SelectedItems[0].SubItems[6].Text;
time.Text = datalist.SelectedItems[0].SubItems[7].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
"'"; cmd.CommandText = "Select * from reservation WHERE resid ='" + txtid.Text +

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["resid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
type.Text = drEmp["service"].ToString();
description.Text = drEmp["type"].ToString();
time.Text = drEmp["time"].ToString();
refID.Text = drEmp["refid"].ToString();
}
}
private void datalist_Click(object sender, EventArgs e)
{
SetRecords2();
confirm.Visible = true;
}

private void Update_Click(object sender, EventArgs e)


{
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to delete?", "Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "UPDATE reservation SET service = '" + type.Text +
"',type = '" + description.Text + "',date = '" + chosenDate.Text + "',time = '" +
time.Text + "',amount = '" + amount.Text + "' WHERE refid = '" + refID.Text + "'";
cmd.ExecuteReader();
Clear();
LoadData();
con.Close();

confirm.Visible = false;
}
}

private void chosenDate_TextChanged(object sender, EventArgs e)


{

private void datalist_SelectedIndexChanged(object sender, EventArgs e)


{

private void txtcn_KeyPress(object sender, KeyPressEventArgs e)


{

}
}

Archive.cs
using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Appointment : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Appointment()
{
InitializeComponent();
}

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users WHERE status=0 ORDER BY timestamp";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}
private void Appointment_Load(object sender, EventArgs e)
{
date.MinDate = date.TodayDate.AddDays(1); chosenDate.Text
= date.SelectionRange.Start.ToString("yyyy-MM-dd");

LoadList();
LoadData();
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text = lsvList.SelectedItems[0].SubItems[1].Text;
txtfn.Text = lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text =
lsvList.SelectedItems[0].SubItems[3].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "Select * from users WHERE userid ='" + txtid.Text + "'";

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["userid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
}
}

private void lsvList_Click(object sender, EventArgs e)


{
SetRecords();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
description.Items.Clear();

if (type.Text == "Bone Graft")


{
description.Items.Add("Cosmetic Consultation");
}
else if (type.Text == "Dental Crown")
{
description.Items.Add("Gold Crown");
description.Items.Add("Permanent Crown");
description.Items.Add("PFM Crown");
description.Items.Add("Porcelain Crown");
description.Items.Add("Resin Crown");
description.Items.Add("Zirconia Crown");
}
else if (type.Text == "Dental Bridges")
{
description.Items.Add("Permanent Bridges");
description.Items.Add("PFM Bridge");
description.Items.Add("Porcelain Bridge");
description.Items.Add("Temporary Bridge");
}
else if (type.Text == "Preventive Dentistry")
{
description.Items.Add("Prophylaxis-Child");
description.Items.Add("Prophylaxis-Child + Flouride");
description.Items.Add("Prophylaxis-Adult (Regular)");
description.Items.Add("Prophylaxis-Adult (Heavy Plaque)");
description.Items.Add("Prophylaxis-Adult (Heavy Stain)");
}
}

private void description_SelectedIndexChanged(object sender, EventArgs e)


{
if (description.Text == "Cosmetic Consultation")
{
amount.Text = "6000";
}
else if (description.Text == "Gold Crown")
{
amount.Text = "25000";
}
else if (description.Text == "Permanent Crown")
{
amount.Text = "8000";
}
else if (description.Text == "PFM Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Porcelain Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Resin Crown")
{
amount.Text = "3000";
}
else if (description.Text == "Zirconia Crown")
{
amount.Text = "18000";
}
else if (description.Text == "Permanent Bridges")
{
amount.Text = "21000";
}
else if (description.Text == "PFM Bridge")
{
amount.Text = "21000";
}
else if (description.Text == "Porcelain Bridge")
{
amount.Text = "18000";
}
else if (description.Text == "Temporary Bridge")
{
amount.Text = "4500";
}
else if (description.Text == "Prophylaxis-Child")
{
amount.Text = "600";
}
else if (description.Text == "Prophylaxis-Child + Flouride")
{
amount.Text = "1200";
}
else if (description.Text == "Prophylaxis-Adult (Regular)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Plaque)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Stain)")
{
amount.Text = "1500";
}

date.Enabled = true;
time.Enabled = true;

private void date_DateChanged(object sender, DateRangeEventArgs e)


{
chosenDate.Text = date.SelectionRange.Start.ToString("yyyy-MM-dd");

time.Items.Clear();

time.Items.Add("09:30 AM");
time.Items.Add("10:00 AM");
time.Items.Add("10:30 AM");
time.Items.Add("11:00 AM");
time.Items.Add("11:30 AM");
time.Items.Add("12:00 PM");
time.Items.Add("12:30 PM");
time.Items.Add("13:00 (1:00 PM)");
time.Items.Add("13:30 (1:30 PM)");
time.Items.Add("14:00 (2:00 PM)");
time.Items.Add("14:30 (2:30 PM)");
time.Items.Add("15:00 (3:00 PM)");
time.Items.Add("15:30 (3:30 PM)");
time.Items.Add("16:00 (4:00 PM)");
time.Items.Add("16:00 (4:30 PM)");
time.Items.Add("17:00 (5:00 PM)");
time.Items.Add("17:00 (5:30 PM)");
}

private void date_MouseLeave(object sender, EventArgs e)


{
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "SELECT * FROM reservation WHERE status=0";

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
if (dr["date"].ToString() == chosenDate.Text)
{
string re = dr["time"].ToString();
time.Items.Remove(re);
}
}
}
}

private void Clear()


{
txtid.Text = "";
txtln.Text = "";
txtfn.Text = "";
txtmn.Text = "";
txtcn.Text = "";
type.Text = "";
description.Text = "";
date.Text = "";
time.Text = "";
amount.Text = "";
}

private void LoadData()


{
datalist.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["middlename"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
datalist.Items.Add(item);
}
}
}

private void addbtn_Click(object sender, EventArgs e)


{
if (String.IsNullOrEmpty(txtfn.Text) || String.IsNullOrEmpty(txtln.Text) ||
String.IsNullOrEmpty(txtcn.Text) || String.IsNullOrEmpty(type.Text) ||
String.IsNullOrEmpty(description.Text) || String.IsNullOrEmpty(chosenDate.Text) ||
String.IsNullOrEmpty(time.Text))
{

MessageBox.Show("Please complete the form!");

}
else
{
OpenConnect();
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "SELECT * FROM reservation WHERE resid="+txtid.Text+" AND
service='"+type.Text+"' AND type='"+description.Text+"'";
MySqlDataReader dr2 = cmd2.ExecuteReader();

if(dr2.HasRows == true)
{
while (dr2.Read()){
MessageBox.Show("Duplicate record is not allowed!");
}}
else{ DialogResu
lt ans;
ans = MessageBox.Show("Are you sure you want to save?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "INSERT INTO reservation
(resid,lastname,firstname,middlename,contact,service,type,date,time,amount,status)
VALUES('" + txtid.Text + "','" + txtln.Text + "', '" + txtfn.Text + "', '" + txtmn.Text +
"', '" + txtcn.Text + "','" + type.Text + "','" + description.Text + "','" +
chosenDate.Text + "','" + time.Text + "','" + amount.Text + "', '0')";

// Declare a reader, through which we will read the data.


MySqlDataReader rdr = cmd.ExecuteReader();

MessageBox.Show("Reservation Successful!");

Clear();
LoadData();
}
}
}
}

private void lsvList_SelectedIndexChanged(object sender, EventArgs e)


{
LoadData();
}

private void txtSearch_TextChanged(object sender, EventArgs e)


{
lsvList.Items.Clear();
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql

command if (rdoID.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE userid LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}
else if (rdoLN.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE lastname LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}

private void rdoLN_CheckedChanged(object sender, EventArgs e)


{

}
private void SetRecords2()
{

txtid.Text = datalist.SelectedItems[0].Text;
txtln.Text = datalist.SelectedItems[0].SubItems[1].Text;
txtfn.Text = datalist.SelectedItems[0].SubItems[2].Text;
txtmn.Text = datalist.SelectedItems[0].SubItems[3].Text;
type.Text = datalist.SelectedItems[0].SubItems[4].Text;
description.Text = datalist.SelectedItems[0].SubItems[5].Text;
date.Text = datalist.SelectedItems[0].SubItems[6].Text;
time.Text = datalist.SelectedItems[0].SubItems[7].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
"'"; cmd.CommandText = "Select * from reservation WHERE resid ='" + txtid.Text +

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["resid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
type.Text = drEmp["service"].ToString();
description.Text = drEmp["type"].ToString();
time.Text = drEmp["time"].ToString();
refID.Text = drEmp["refid"].ToString();
}
}
private void datalist_Click(object sender, EventArgs e)
{
SetRecords2();
confirm.Visible = true;
}

private void Update_Click(object sender, EventArgs e)


{
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to delete?", "Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "UPDATE reservation SET service = '" + type.Text +
"',type = '" + description.Text + "',date = '" + chosenDate.Text + "',time = '" +
time.Text + "',amount = '" + amount.Text + "' WHERE refid = '" + refID.Text + "'";
cmd.ExecuteReader();

Clear();
LoadData();
con.Close();

confirm.Visible = false;
}
}

private void chosenDate_TextChanged(object sender, EventArgs e)


{

private void datalist_SelectedIndexChanged(object sender, EventArgs e)


{

private void txtcn_KeyPress(object sender, KeyPressEventArgs e)


{

}
}
AuditTrail.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class AuditTrail : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
public AuditTrail()
{
InitializeComponent();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void AuditTrail_Load(object sender, EventArgs e)
{
LoadList();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM audit ORDER BY time";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["audid"].ToString());
item.SubItems.Add(dr["user"].ToString());
item.SubItems.Add(dr["transaction"].ToString());
item.SubItems.Add(dr["time"].ToString());
lsvList.Items.Add(item);
}
}
}
private void logout_Click(object sender, EventArgs e)
{
Menu cs = new Menu();
cs.Show();
this.Hide();
}

}
}

Form1.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class userLogin : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
MySqlConnection conn = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
public userLogin()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void dt_Tick(object sender, EventArgs e)


{
date.Text =
DateTime.Now.ToLongDateString(); time.Text
= DateTime.Now.ToLongTimeString();
dt.Start();
}

private void AppointmentSystem_Load(object sender, EventArgs e)


{
dt.Start();
date.Text = DateTime.Now.ToLongDateString();
time.Text = DateTime.Now.ToLongTimeString();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void OpenConnect2() //Check if connection is open or close
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Open();
}
private void username_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar
== 45 ? false : true;
}

private void password_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
45 ? false : true;
}

private void login_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From accounts WHERE username = '" +
username.Text + "' AND password='" + password.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == true)
{
while (drs.Read())
{
if (username.Text == "staff" && password.Text == "" +
drs["password"].ToString() + "")
{
Menu me = new Menu();
me.Show();
this.Hide();

OpenConnect2();
// Create the sql command
MySqlCommand can = conn.CreateCommand();
can.CommandType = CommandType.Text;
// Declare the sript of sql command
can.CommandText = "INSERT INTO audit (user, transaction)
VALUES('" + username.Text + "','Login')";

// Declare a reader, through which we will read the data.


MySqlDataReader rdr = can.ExecuteReader();
}
else if (username.Text == "audit" && password.Text == "" +
drs["password"].ToString() + "")
{
AuditTrail me = new AuditTrail();
me.Show();
this.Hide();
}
else if (username.Text == "" + drs["username"].ToString() + "" &&
password.Text == "" + drs["password"].ToString() + "")
{
Menu mnu = new Menu();
mnu.Show();
this.Hide();

OpenConnect2();
// Create the sql command
MySqlCommand can = conn.CreateCommand();
can.CommandType = CommandType.Text;
// Declare the sript of sql command
can.CommandText = "INSERT INTO audit (user, transaction)
VALUES('" + username.Text + "','Login')";

// Declare a reader, through which we will read the data.


MySqlDataReader rdr = can.ExecuteReader();

}
else
{
MessageBox.Show("Please check your username/password");
}

}
con.Close();

}
else
{
MessageBox.Show("Please check your username/password");
}
con.Close();

private void pictureBox3_Click(object sender, EventArgs e)


{

private void pictureBox1_Click(object sender, EventArgs e)


{

}
}

}
Menu.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Menu : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
MySqlConnection conn = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
public Menu()
{
InitializeComponent();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void OpenConnect2() //Check if connection is open or close
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Open();
}
private void Menu_Load(object sender, EventArgs e)
{

private void logout_Click(object sender, EventArgs e)


{
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to logout?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
userLogin gs = new userLogin();
gs.Show();
this.Hide();
}
}

private void register_Click(object sender, EventArgs e)


{
Registration reg = new Registration();
reg.Show();
this.Hide();
}

private void label4_Click(object sender, EventArgs e)


{

private void label7_Click(object sender, EventArgs e)


{

private void label6_Click(object sender, EventArgs e)


{

private void label5_Click(object sender, EventArgs e)


{

private void label8_Click(object sender, EventArgs e)


{

private void label9_Click(object sender, EventArgs e)


{

private void search_Click(object sender, EventArgs e)


{
Patients sc = new Patients();
sc.Show();
this.Hide();
}

private void appointment_Click(object sender, EventArgs e)


{
Appointment ap = new Appointment();
ap.Show();
this.Hide();
}

private void records_Click(object sender, EventArgs e)


{
Records rec = new Records();
rec.Show();
this.Hide();
}

private void button1_Click(object sender, EventArgs e)


{
WalkIn wi = new WalkIn();
wi.Show();
this.Hide();
}

private void archive_Click(object sender, EventArgs e)


{
Archive ar = new Archive();
ar.Show();
this.Hide();
}

private void button2_Click(object sender, EventArgs e)


{
Security sc = new Security();
sc.Show();
this.Hide();
}

private void button3_Click(object sender, EventArgs e)


{
Transaction ts = new Transaction();
ts.Show();
this.Hide();
}
}
}

Patients.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Patients : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Patients()
{
InitializeComponent();
}

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users WHERE status=0 ORDER BY timestamp";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text = lsvList.SelectedItems[0].SubItems[1].Text;
txtfn.Text = lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text = lsvList.SelectedItems[0].SubItems[3].Text;
txtadd.Text =
lsvList.SelectedItems[0].SubItems[4].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "Select * from users WHERE userid ='" + txtid.Text + "'";

MySqlDataReader drEmp = cmd.ExecuteReader();


if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["userid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
txtadd.Text = drEmp["address"].ToString();
}
}
private void Patients_Load(object sender, EventArgs e)
{
LoadList();
}

private void lsvList_Click(object sender, EventArgs e)


{
SetRecords();
infobox.Enabled = true;
addbtn.Enabled = true;
savebtn.Enabled = true;
}
private void Clear()
{
txtadd.Text = "";
txtcn.Text = "";
txtfn.Text = "";
txtid.Text = "";
txtln.Text = "";
txtmn.Text = "";
}
private void addbtn_Click(object sender, EventArgs e)
{

//Contact Validation
if (txtcn.Text.Length < 11)
{
MessageBox.Show("Invalid Contact Number");
}
else
{
if (String.IsNullOrEmpty(txtfn.Text) || String.IsNullOrEmpty(txtln.Text)
|| String.IsNullOrEmpty(txtcn.Text) || String.IsNullOrEmpty(txtadd.Text))
{

MessageBox.Show("Please complete the form!");

}
else
{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" +
txtln.Text + "' AND firstname='" + txtfn.Text + "' AND middlename='" + txtmn.Text + "'
AND contact='" + txtcn.Text + "' AND address='" + txtadd.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{

DialogResult ans;
ans = MessageBox.Show("Are you sure you want to Update?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "UPDATE users SET lastname ='" + txtln.Text +
"', firstname ='" + txtfn.Text + "', middlename ='" + txtmn.Text + "', contact ='" +
txtcn.Text + "', address ='" + txtadd.Text + "' WHERE userid='" + txtid.Text + "'";
cmd.ExecuteReader();
Clear();
LoadList();
addbtn.Enabled = false;
savebtn.Enabled = false;
}

}
else
{
MessageBox.Show("User Already Registered!");
}
}
}
}

private void savebtn_Click(object sender, EventArgs e)


{

OpenConnect();
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "SELECT * FROM reservation WHERE resid='"+txtid.Text+"'";
MySqlDataReader dr2 = cmd2.ExecuteReader();

if (dr2.HasRows == true)
{
while (dr2.Read())
{
MessageBox.Show("The user has a active record and cannot be
deleted!");
}
}
else
{
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to delete?", "Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
txtid.Text + cmd.CommandText = "UPDATE users SET status = '1' WHERE userid = '" +
"'";
cmd.ExecuteReader();

Clear();
LoadList();
con.Close();

addbtn.Enabled = false;
savebtn.Enabled = false;
}
}
}

private void txtln_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;
}
private void txtfn_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;
}

private void txtmn_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;

}
private void txtcn_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
45 ? false : true;
}

private void txtSearch_TextChanged(object sender, EventArgs e)


{
lsvList.Items.Clear();
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command

if (rdoID.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE userid LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}
else if (rdoLN.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE lastname LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}

private void logout_Click_1(object sender, EventArgs e)


{

Menu mn = new Menu();


mn.Show();
this.Hide();
}

private void rdoID_CheckedChanged(object sender, EventArgs e)


{

private void lsvList_SelectedIndexChanged(object sender, EventArgs e)


{

private void txtcn_TextChanged(object sender, EventArgs e)


{
if (txtcn.Text.Length <= 2)
{
txtcn.Text = "09";
}
else
{

}
}
}
}
Program.cs

using System;
using
System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace AppointmentSystem
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Menu());
}
}
}

Records.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Records : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
MySqlConnection conn = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Records()
{
InitializeComponent();
}

private void label5_Click(object sender, EventArgs e)


{
}

private void pictureBox1_Click(object sender, EventArgs e)


{

private void label4_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{

private void Records_Load(object sender, EventArgs e)


{
dt.Start();
date.Text = DateTime.Now.ToString("yyyy-MM-dd");

LoadActive();

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void datalist_SelectedIndexChanged(object sender, EventArgs e)


{

}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void OpenConnect2() //Check if connection is open or close
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Open();
}
private void LoadActive()
{
lsvList.Items.Clear();
OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 AND date > '" +
DateTime.Now.ToString("yyyy-MM-dd") + "' ORDER BY date ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadSchedule()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 and date = '" +
date.Text + "' ORDER BY date ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadCancel()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=2 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadFinished()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=1 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text =
lsvList.SelectedItems[0].SubItems[1].Text; txtfn.Text
= lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text =
lsvList.SelectedItems[0].SubItems[3].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "Select * from reservation WHERE resid ='" + txtid.Text +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text =
drEmp["resid"].ToString()
; textid.Text =
drEmp["refid"].ToString()
; txtln.Text =
drEmp["lastname"].ToStrin
g(); txtfn.Text =
drEmp["firstname"].ToStri
ng(); txtcn.Text =
drEmp["contact"].ToString
(); txtdesc.Text =
drEmp["type"].ToString();
txtamt.Text =
drEmp["amount"].ToString(
);
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
canc
el.V
isib
le =
true
;
goin
g.Vi
sibl
e =
fals
e;
prin
t.Vi
sibl
e =
fals
e;
open
.Vis
ible
=
fals
e;
Load
Acti
ve()
;
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)


{
cance
l.Vis
ible
= tArgs e)
print.Vi {
sible = cance
false l.Vis
going.Vi ible
sible = =
true false
open.Vis ;
ible = going
false .Visi
LoadSche ble =
dule(); false
} ;
print
priv .Visi
ate ble =
void false
radi ;
oBut open.
ton3 Visib
_Che le =
cked true;
Chan LoadF
ged( inish
obje ed();
ct }
send
er, private void lsvList_Click(object sender, EventArgs e)
Even {
tArg SetRecords();
s
{
cancel.V
isible =
false
going.Vi
sible =
false
print.Vi
sible =
false
open.Vis
ible =
false
LoadCanc
el();
}

priv
ate
void
radi
oBut
ton4
_Che
cked
Chan
ged(
obje
ct
send
er,
Even
}

private void logout_Click_1(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void cancel_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{

OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='2' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadActive();
}
}
}

private void print_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs =

camd.ExecuteReader(); if (drs.HasRows ==

false)
{
MessageBox.Show("Please Select A Patient");

}
else
{

System.Diagnostics.Process[] ps =
System.Diagnostics.Process.GetProcessesByName("winword");

foreach (System.Diagnostics.Process p3 in ps)


p3.Kill();
try
{
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);

object missing = new object();


missing = System.Reflection.Missing.Value;

Microsoft.Office.Interop.Word.Application wordApp = new


Microsoft.Office.Interop.Word.Application();

Microsoft.Office.Interop.Word.Document aDoc = null;

object filename =
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx";

if (System.IO.File.Exists((string)filename))
{
object readOnly = false;
object isVisible = false;
wordApp.Visible = false;
aDoc = wordApp.Documents.Open(ref filename, ref missing,
ref readOnly, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref isVisible, ref missing, ref missing,
ref missing, ref missing);
aDoc.Activate();

this.FindAndReplace(wordApp, "<Lastname>", txtln.Text);


this.FindAndReplace(wordApp, "<Firstname>", txtfn.Text.Trim());
this.FindAndReplace(wordApp, "<Contact>", txtcn.Text.Trim());
this.FindAndReplace(wordApp, "<Date>", date.Text.Trim());
this.FindAndReplace(wordApp, "<Description>",
txtdesc.Text.Trim());
this.FindAndReplace(wordApp, "<Amount>", txtamt.Text.Trim());

aDoc.Save();

MessageBox.Show("Generating Successful!" + Environment.NewLine +


"Your file(output.docx) is generated!");

OpenConnect();

// Create the sql command


MySqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "UPDATE reservation SET status='1' WHERE
refid='" + textid.Text + "'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadGoing();

open.Enabled = true;
}
else
MessageBox.Show("File does not exist.",
"No File", MessageBoxButtons.OK,
MessageBoxIcon.Information);
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

}
catch (Exception)
{
MessageBox.Show("Please Wait.", "Processing",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void FindAndReplace(Microsoft.Office.Interop.Word.Application wordApp,
object findText, object replaceText)
{
object matchCase = true;
object matchWholeWord = true;
object matchWildCards =
false;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida =
false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
wordApp.Selection.Find.Execute(ref findText, ref matchCase,
ref matchWholeWord, ref matchWildCards, ref matchSoundsLike,
ref matchAllWordForms, ref forward, ref wrap, ref format,
ref replaceText, ref replace, ref matchKashida,
ref matchDiacritics,
ref matchAlefHamza, ref matchControl);
}

private void open_Click(object sender, EventArgs e)


{

OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{

System.Diagnostics.Process.Start(@"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.do
cx");
}
}

private void textid_TextChanged(object sender, EventArgs e)


{

private void radioButton5_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
open.Visible = false;
print.Visible = false;
LoadMissed();

string t = DateTime.Now.ToString("HH:mm");
string d = DateTime.Now.ToString("yyyy-MM-dd");

//MessageBox.Show(d + t);

OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE date='" + d + "'";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
string x = dr["time"].ToString().Remove(5);

string up = t.Remove(3) + "15";

if (up == t)
{
OpenConnect2();
MySqlCommand can = conn.CreateCommand();
can.CommandType = CommandType.Text;
can.CommandText = "UPDATE reservation SET status=3 WHERE status!
=1 AND date='" + d + "'";
MySqlDataReader rdr = can.ExecuteReader();
}

}
}
}

private void radioButton6_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
open.Visible = false;
print.Visible = true;
LoadGoing();
}
private void LoadMissed()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=3 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadGoing()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=4 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}

private void missed_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{
OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='3' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadMissed();
}
}
}

private void going_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "' AND status=0";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{
OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='4' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadSchedule();
}
else
{

}
}

private void dt_Tick(object sender, EventArgs e)


{

time.Text = DateTime.Now.ToShortTimeString().Remove(5);
dt.Start();
}

private void Records_Click(object sender, EventArgs e)


{
}

private void groupBox1_Enter(object sender, EventArgs e)


{

}
}
}
Registration.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Records : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");
MySqlConnection conn = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Records()
{
InitializeComponent();
}

private void label5_Click(object sender, EventArgs e)


{

private void pictureBox1_Click(object sender, EventArgs e)


{

private void label4_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{

private void Records_Load(object sender, EventArgs e)


{
dt.Start();
date.Text = DateTime.Now.ToString("yyyy-MM-dd");

LoadActive();

}
private void logout_Click(object sender, EventArgs e)
{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void datalist_SelectedIndexChanged(object sender, EventArgs e)


{

}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void OpenConnect2() //Check if connection is open or close
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Open();
}
private void LoadActive()
{
lsvList.Items.Clear();
OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 AND date > '" +
DateTime.Now.ToString("yyyy-MM-dd") + "' ORDER BY date ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadSchedule()
{
lsvList.Items.Clear();
OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=0 and date = '" +
date.Text + "' ORDER BY date ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadCancel()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=2 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadFinished()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=1 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text =
lsvList.SelectedItems[0].SubItems[1].Text; txtfn.Text
= lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text =
lsvList.SelectedItems[0].SubItems[3].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
"'"; cmd.CommandText = "Select * from reservation WHERE resid ='" + txtid.Text +

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["resid"].ToString();
textid.Text = drEmp["refid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtcn.Text = drEmp["contact"].ToString();
txtdesc.Text = drEmp["type"].ToString();
txtamt.Text = drEmp["amount"].ToString();
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
cancel.Visible = true;
going.Visible = false;
print.Visible = false;
open.Visible = false;
LoadActive();
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
cancel.Visible = false;
print.Visible = false;
going.Visible = true;
open.Visible = false;
LoadSchedule();
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
print.Visible = false;
open.Visible = false;
LoadCancel();
}

private void radioButton4_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
print.Visible = false;
open.Visible = true;
LoadFinished();
}

private void lsvList_Click(object sender, EventArgs e)


{
SetRecords();
}

private void logout_Click_1(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void cancel_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{
OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='2' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadActive();
}
}
}

private void print_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{

System.Diagnostics.Process[] ps =
System.Diagnostics.Process.GetProcessesByName("winword");

foreach (System.Diagnostics.Process p3 in ps)


p3.Kill();
try
{
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);

object missing = new object();


missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application wordApp = new
Microsoft.Office.Interop.Word.Application();

Microsoft.Office.Interop.Word.Document aDoc = null;

object filename =
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx";

if (System.IO.File.Exists((string)filename))
{
object readOnly = false;
object isVisible = false;
wordApp.Visible = false;
aDoc = wordApp.Documents.Open(ref filename, ref missing,
ref readOnly, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref isVisible, ref missing, ref missing,
ref missing, ref missing);
aDoc.Activate();

this.FindAndReplace(wordApp, "<Lastname>", txtln.Text);


this.FindAndReplace(wordApp, "<Firstname>", txtfn.Text.Trim());
this.FindAndReplace(wordApp, "<Contact>", txtcn.Text.Trim());
this.FindAndReplace(wordApp, "<Date>", date.Text.Trim());
this.FindAndReplace(wordApp, "<Description>",
txtdesc.Text.Trim());
this.FindAndReplace(wordApp, "<Amount>", txtamt.Text.Trim());

aDoc.Save();

MessageBox.Show("Generating Successful!" + Environment.NewLine +


"Your file(output.docx) is generated!");

OpenConnect();

// Create the sql command


MySqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "UPDATE reservation SET status='1' WHERE
refid='" + textid.Text + "'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadGoing();

open.Enabled = true;
}
else
MessageBox.Show("File does not exist.",
"No File", MessageBoxButtons.OK,
MessageBoxIcon.Information);
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

}
catch (Exception)
{
MessageBox.Show("Please Wait.", "Processing",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void FindAndReplace(Microsoft.Office.Interop.Word.Application wordApp,
object findText, object replaceText)
{
object matchCase = true;
object matchWholeWord = true;
object matchWildCards =
false;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida =
false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
wordApp.Selection.Find.Execute(ref findText, ref matchCase,
ref matchWholeWord, ref matchWildCards, ref matchSoundsLike,
ref matchAllWordForms, ref forward, ref wrap, ref format,
ref replaceText, ref replace, ref matchKashida,
ref matchDiacritics,
ref matchAlefHamza, ref matchControl);
}

private void open_Click(object sender, EventArgs e)


{

OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{

System.Diagnostics.Process.Start(@"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.do
cx");
}
}

private void textid_TextChanged(object sender, EventArgs e)


{
}

private void radioButton5_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
open.Visible = false;
print.Visible = false;
LoadMissed();

string t = DateTime.Now.ToString("HH:mm");
string d = DateTime.Now.ToString("yyyy-MM-dd");

//MessageBox.Show(d + t);

OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE date='" + d + "'";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
string x = dr["time"].ToString().Remove(5);

string up = t.Remove(3) + "15";

if (up == t)
{
OpenConnect2();
MySqlCommand can = conn.CreateCommand();
can.CommandType = CommandType.Text;
can.CommandText = "UPDATE reservation SET status=3 WHERE status!
=1 AND date='" + d + "'";
MySqlDataReader rdr = can.ExecuteReader();
}

}
}
}

private void radioButton6_CheckedChanged(object sender, EventArgs e)


{
cancel.Visible = false;
going.Visible = false;
open.Visible = false;
print.Visible = true;
LoadGoing();
}
private void LoadMissed()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=3 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}
private void LoadGoing()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE status=4 ORDER BY date
ASC, time ASC";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["resid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["service"].ToString());
item.SubItems.Add(dr["type"].ToString());
item.SubItems.Add(dr["date"].ToString());
item.SubItems.Add(dr["time"].ToString());
item.SubItems.Add(dr["amount"].ToString());
lsvList.Items.Add(item);
}
}
}

private void missed_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();
if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{
OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='3' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadMissed();
}
}
}

private void going_Click(object sender, EventArgs e)


{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" + txtln.Text + "'
AND firstname='" + txtfn.Text + "' AND status=0";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");

}
else
{
OpenConnect();
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (ans.ToString() == "Yes")
{
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
textid.Text + cmd.CommandText = "UPDATE reservation SET status='4' WHERE refid='" +
"'";
MySqlDataReader drEmp = cmd.ExecuteReader();
con.Close();
LoadSchedule();
}
else
{

}
}

private void dt_Tick(object sender, EventArgs e)


{

time.Text = DateTime.Now.ToShortTimeString().Remove(5);
dt.Start();
}

private void Records_Click(object sender, EventArgs e)


{
}

private void groupBox1_Enter(object sender, EventArgs e)


{

}
}
}

Registration.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Registration : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Registration()
{
InitializeComponent();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void Clear()
{
txtadd.Text = "";
txtcn.Text = "";
txtfn.Text = "";
txtid.Text = "";
txtln.Text = "";
txtmn.Text = "";
}

private void button1_Click(object sender, EventArgs e)


{
infobox.Enabled = true;
addbtn.Enabled = false;
savebtn.Enabled = true;
cancelbtn.Enabled = true;

OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users ORDER BY userid";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == false)
{
//IF THE TABLE IS EMPTY
txtid.Text = "1001";

}
else //IF THE TABLE IS OT EMPTY
{
while (dr.Read())
{
txtid.Text = dr["userid"].ToString();

}
txtid.Text = (Convert.ToInt32(txtid.Text) + 1).ToString();
}

private void cancelbtn_Click(object sender, EventArgs e)


{
infobox.Enabled = false;
savebtn.Enabled = false;
cancelbtn.Enabled = false;
addbtn.Enabled = true;
Clear();
}

private void savebtn_Click(object sender, EventArgs e)


{
//Contact Validation
if (txtcn.Text.Length <= 10)
{
MessageBox.Show("Fill the form properly");
}
else
{
if (String.IsNullOrEmpty(txtfn.Text) || String.IsNullOrEmpty(txtln.Text)
|| String.IsNullOrEmpty(txtcn.Text) || String.IsNullOrEmpty(txtadd.Text))
{

MessageBox.Show("Please complete the form!");

}
else
{
DialogResult ans;
ans = MessageBox.Show("Are you sure you want to save?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (ans.ToString() == "Yes")
{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From users WHERE lastname = '" +
txtln.Text + "' AND firstname='" + txtfn.Text + "' AND middlename='" + txtmn.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == true)
{
MessageBox.Show("User Already Registered!");
}
else
{
string hey = DateTime.Now.ToString("MMM. dd,yyyy");

MessageBox.Show(hey);

OpenConnect();
// Create the sql command
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "INSERT INTO users (userid, lastname,
firstname, middlename, contact, address, status) VALUES('" + txtid.Text + "','" +
txtln.Text + "','" + txtfn.Text + "','" + txtmn.Text + "', '" + txtcn.Text + "', '" +
txtadd.Text + "','" + '0' + "')";

// Declare a reader, through which we will read the data.


MySqlDataReader rdr = cmd.ExecuteReader();
Clear();
savebtn.Enabled = false;
infobox.Enabled = false;
addbtn.Enabled = true;
LoadList();
}
}
}
}
}

private void txtln_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;
}

private void txtfn_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;
}

private void txtmn_KeyPress(object sender, KeyPressEventArgs e)


{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
32 || e.KeyChar == 45 ? false : true;

}
private void txtcn_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 45 ?
false : true;
}

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void txtid_TextChanged(object sender, EventArgs e)


{

}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users WHERE status=0 ORDER BY timestamp";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["timestamp"].ToString());
lsvList.Items.Add(item);
}
}
}

private void Registration_Load(object sender, EventArgs e)


{
LoadList();
}

private void cancelbtn_Click_1(object sender, EventArgs e)


{
Registration rg = new Registration();
rg.Show();
this.Hide();
}

private void txtcn_TextChanged(object sender, EventArgs e)


{
if(txtcn.Text.Length <= 2){
txtcn.Text = "09";
}
else {

}
}
}

Security.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Security : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Security()
{
InitializeComponent();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void button1_Click(object sender, EventArgs e)
{
OpenConnect();
MySqlCommand camd = con.CreateCommand();
camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * From accounts WHERE username = '" +
username.Text + "' AND password='" + password.Text + "'";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == true)
{
while (drs.Read())
{
if (username.Text == "admin" && password.Text == "" +
drs["password"].ToString() + "")
{
AuditTrail at = new AuditTrail();
at.Show();
this.Hide();
}
else
{
MessageBox.Show("Please check your Username and Password");
}

}
}
else
{
MessageBox.Show("Please check your Username and Password");
}
con.Close();

private void button2_Click(object sender, EventArgs e)


{
Menu cs = new Menu();
cs.Show();
this.Hide();
}

private void label1_Click(object sender, EventArgs e)


{

}
}
}
Transaction.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class Transaction : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public Transaction()
{
InitializeComponent();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand camd = con.CreateCommand();


camd.CommandType = CommandType.Text;
camd.CommandText = "SELECT * FROM reservation WHERE date = '" +
chosenDate.Text + "' AND status=1 ";
MySqlDataReader drs = camd.ExecuteReader();

if (drs.HasRows == true)
{
while (drs.Read())
{
ListViewItem item = new ListViewItem(drs["resid"].ToString());
item.SubItems.Add(drs["lastname"].ToString());
item.SubItems.Add(drs["firstname"].ToString());
item.SubItems.Add(drs["middlename"].ToString());
item.SubItems.Add(drs["service"].ToString());
item.SubItems.Add(drs["type"].ToString());
item.SubItems.Add(drs["date"].ToString());
item.SubItems.Add(drs["time"].ToString());
lsvList.Items.Add(item);
}
}
}
private void date_DateChanged(object sender, DateRangeEventArgs e)
{

tt.Text = "";
db.Text = "";
pd.Text = "";
bg.Text = "";
int total =
0;
chosenDate.Text = date.SelectionRange.Start.ToString("yyyy-MM-dd");

//Total
OpenConnect();
MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM reservation WHERE date='"+chosenDate.Text+"'
AND status=1";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
total += Convert.ToInt32(dr["amount"].ToString());
tt.Text = total.ToString("C", CultureInfo.CurrentCulture);
}
}
//Bone Graft
OpenConnect();
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "SELECT * FROM reservation WHERE status=1 AND date='" +
chosenDate.Text + "' AND service='Bone Graft'";
MySqlDataReader dr2 = cmd2.ExecuteReader();

if (dr2.HasRows == true)
{
while (dr2.Read())
{
int amt = Convert.ToInt32(dr2["amount"].ToString());
bg.Text = amt.ToString("C", CultureInfo.CurrentCulture);
}
}
//Dental Bridges
OpenConnect();
MySqlCommand cmd3 = con.CreateCommand();
cmd3.CommandType = CommandType.Text;
cmd3.CommandText = "SELECT * FROM reservation WHERE status=1 AND date='" +
chosenDate.Text + "' AND service='Dental Bridges'";
MySqlDataReader dr3 = cmd3.ExecuteReader();

if (dr3.HasRows == true)
{
while (dr3.Read())
{
int amt = Convert.ToInt32(dr3["amount"].ToString());
db.Text = amt.ToString("C", CultureInfo.CurrentCulture);
}
}
//Preventive Dentistry
OpenConnect();
MySqlCommand cmd4 = con.CreateCommand();
cmd4.CommandType = CommandType.Text;
cmd4.CommandText = "SELECT * FROM reservation WHERE status=1 AND date='" +
chosenDate.Text + "' AND service='Preventive Dentistry'";
MySqlDataReader dr4 = cmd4.ExecuteReader();

if (dr4.HasRows == true)
{
while (dr4.Read())
{
int amt = Convert.ToInt32(dr4["amount"].ToString());
pd.Text = amt.ToString("C", CultureInfo.CurrentCulture);
}
}
//Dental Crown
OpenConnect();
MySqlCommand cmd5 = con.CreateCommand();
cmd5.CommandType = CommandType.Text;
cmd5.CommandText = "SELECT * FROM reservation WHERE status=1 AND date='" +
chosenDate.Text + "' AND service='Dental Crown'";
MySqlDataReader dr5 = cmd5.ExecuteReader();

if (dr5.HasRows == true)
{
while (dr5.Read())
{
int amt = Convert.ToInt32(dr5["amount"].ToString());
pd.Text = amt.ToString("C", CultureInfo.CurrentCulture);
}
}
LoadList();
}

private void logout_Click(object sender, EventArgs e)


{
Menu mn = new Menu();
mn.Show();
this.Hide();
}

private void button1_Click(object sender, EventArgs e)


{

private void lsvList_SelectedIndexChanged(object sender, EventArgs e)


{

private void Transaction_Load(object sender, EventArgs e)


{
date.MaxDate = date.TodayDate;
}

private void textBox5_TextChanged(object sender, EventArgs e)


{

lsvList.Items.Clear();
if(txtSearch.Text == "")
{
lsvList.Items.Clear();
cdate.Enabled = true;
dr2.Enabled = true;

}
else
{
cdate.Enabled = false;
dr2.Enabled = false;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command

cmd.CommandText = "SELECT * FROM reservation WHERE lastname LIKE '%" +


txtSearch.Text + "%' AND status = '1'";

MySqlDataReader drs = cmd.ExecuteReader();

if (drs.HasRows == true)
{
while (drs.Read())
{
ListViewItem item = new ListViewItem(drs["resid"].ToString());
item.SubItems.Add(drs["lastname"].ToString());
item.SubItems.Add(drs["firstname"].ToString());
item.SubItems.Add(drs["middlename"].ToString());
item.SubItems.Add(drs["service"].ToString());
item.SubItems.Add(drs["type"].ToString());
item.SubItems.Add(drs["date"].ToString());
item.SubItems.Add(drs["time"].ToString());
lsvList.Items.Add(item);
}
}
}
}

private void lsvList_Click(object sender, EventArgs e)


{

}
}
}
Walkin.cs

using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace AppointmentSystem
{
public partial class WalkIn : Form
{
MySqlConnection con = new MySqlConnection(@"Data
Source=localhost;port=3306;Initial Catalog=dentalsystem;User Id=root; password=''");

public WalkIn()
{
InitializeComponent();
}

private void logout_Click(object sender, EventArgs e)


{
Menu me = new Menu();
me.Show();
this.Hide();
}
private void OpenConnect() //Check if connection is open or close
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
private void LoadList()
{
lsvList.Items.Clear();
OpenConnect();

MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
cmd.CommandText = "SELECT * FROM users WHERE status=0 ORDER BY timestamp";
MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}
private void SetRecords()
{

txtid.Text = lsvList.SelectedItems[0].Text;
txtln.Text =
lsvList.SelectedItems[0].SubItems[1].Text; txtfn.Text
= lsvList.SelectedItems[0].SubItems[2].Text;
txtcn.Text =
lsvList.SelectedItems[0].SubItems[3].Text;

OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command
cmd.CommandText = "Select * from users WHERE userid ='" + txtid.Text + "'";

MySqlDataReader drEmp = cmd.ExecuteReader();

if (drEmp.HasRows == true)
{
drEmp.Read();
txtid.Text = drEmp["userid"].ToString();
txtln.Text = drEmp["lastname"].ToString();
txtfn.Text = drEmp["firstname"].ToString();
txtmn.Text = drEmp["middlename"].ToString();
txtcn.Text = drEmp["contact"].ToString();
}
}
private void WalkIn_Load(object sender, EventArgs e)
{
LoadList();
chosenDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
}

private void lsvList_Click(object sender, EventArgs e)


{
SetRecords();
}

private void type_SelectedIndexChanged(object sender, EventArgs e)


{
description.Items.Clear();

if (type.Text == "Bone Graft")


{
description.Items.Add("Cosmetic Consultation");
}
else if (type.Text == "Dental Crown")
{
description.Items.Add("Gold Crown");
description.Items.Add("Permanent Crown");
description.Items.Add("PFM Crown");
description.Items.Add("Porcelain Crown");
description.Items.Add("Resin Crown");
description.Items.Add("Zirconia Crown");
}
else if (type.Text == "Dental Bridges")
{
description.Items.Add("Permanent Bridges");
description.Items.Add("PFM Bridge");
description.Items.Add("Porcelain Bridge");
description.Items.Add("Temporary Bridge");
}
else if (type.Text == "Preventive Dentistry")
{
description.Items.Add("Prophylaxis-Child");
description.Items.Add("Prophylaxis-Child + Flouride");
description.Items.Add("Prophylaxis-Adult (Regular)");
description.Items.Add("Prophylaxis-Adult (Heavy Plaque)");
description.Items.Add("Prophylaxis-Adult (Heavy Stain)");
}
}

private void description_SelectedIndexChanged(object sender, EventArgs e)


{
if (description.Text == "Cosmetic Consultation")
{
amount.Text = "6000";
}
else if (description.Text == "Gold Crown")
{
amount.Text = "25000";
}
else if (description.Text == "Permanent Crown")
{
amount.Text = "8000";
}
else if (description.Text == "PFM Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Porcelain Crown")
{
amount.Text = "7000";
}
else if (description.Text == "Resin Crown")
{
amount.Text = "3000";
}
else if (description.Text == "Zirconia Crown")
{
amount.Text = "18000";
}
else if (description.Text == "Permanent Bridges")
{
amount.Text = "21000";
}
else if (description.Text == "PFM Bridge")
{
amount.Text = "21000";
}
else if (description.Text == "Porcelain Bridge")
{
amount.Text = "18000";
}
else if (description.Text == "Temporary Bridge")
{
amount.Text = "4500";
}
else if (description.Text == "Prophylaxis-Child")
{
amount.Text = "600";
}
else if (description.Text == "Prophylaxis-Child + Flouride")
{
amount.Text = "1200";
}
else if (description.Text == "Prophylaxis-Adult (Regular)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Plaque)")
{
amount.Text = "900";
}
else if (description.Text == "Prophylaxis-Adult (Heavy Stain)")
{
amount.Text = "1500";
}
}

private void print_Click(object sender, EventArgs e)


{
System.Diagnostics.Process[] ps =
System.Diagnostics.Process.GetProcessesByName("winword");

foreach (System.Diagnostics.Process p3 in ps)


p3.Kill();
try
{
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);

object missing = new object();


missing = System.Reflection.Missing.Value;

Microsoft.Office.Interop.Word.Application wordApp = new


Microsoft.Office.Interop.Word.Application();

Microsoft.Office.Interop.Word.Document aDoc = null;

object filename =
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx";
if (System.IO.File.Exists((string)filename))
{
object readOnly = false;
object isVisible = false;
wordApp.Visible = false;
aDoc = wordApp.Documents.Open(ref filename, ref missing,
ref readOnly, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref isVisible, ref missing, ref missing,
ref missing, ref missing);
aDoc.Activate();

this.FindAndReplace(wordApp, "<Lastname>", txtln.Text);


this.FindAndReplace(wordApp, "<Firstname>", txtfn.Text.Trim());
this.FindAndReplace(wordApp, "<Contact>", txtcn.Text.Trim());
this.FindAndReplace(wordApp, "<Date>", chosenDate.Text.Trim());
this.FindAndReplace(wordApp, "<Description>",
description.Text.Trim());
this.FindAndReplace(wordApp, "<Amount>", amount.Text.Trim());

aDoc.Save();

MessageBox.Show("Generating Successful!" + Environment.NewLine +


"Your file(output.docx) is generated!");

}
else
MessageBox.Show("File does not exist.",
"No File", MessageBoxButtons.OK,
MessageBoxIcon.Information);
foreach (System.Diagnostics.Process p3 in ps)
p3.Kill();

}
catch (Exception)
{
MessageBox.Show("Please Wait.", "Processing",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FindAndReplace(Microsoft.Office.Interop.Word.Application wordApp,
object findText, object replaceText)
{
object matchCase = true;
object matchWholeWord = true;
object matchWildCards =
false;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida =
false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
wordApp.Selection.Find.Execute(ref findText, ref matchCase,
ref matchWholeWord, ref matchWildCards, ref matchSoundsLike,
ref matchAllWordForms, ref forward, ref wrap, ref format,
ref replaceText, ref replace, ref matchKashida,
ref matchDiacritics,
ref matchAlefHamza, ref matchControl);
}

private void open_Click(object sender, EventArgs e)


{

System.Diagnostics.Process.Start(@"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.do
cx");
}

private void txtSearch_TextChanged(object sender, EventArgs e)


{
lsvList.Items.Clear();
OpenConnect();

// Create the sql command


MySqlCommand cmd =
con.CreateCommand(); cmd.CommandType =
CommandType.Text;
// Declare the sript of sql command

if (rdoID.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE userid LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}
else if (rdoLN.Checked)
{
cmd.CommandText = "SELECT * FROM users WHERE lastname LIKE '%" +
txtSearch.Text + "%' AND status = '0'";
}

MySqlDataReader dr = cmd.ExecuteReader();

if (dr.HasRows == true)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["userid"].ToString());
item.SubItems.Add(dr["lastname"].ToString());
item.SubItems.Add(dr["firstname"].ToString());
item.SubItems.Add(dr["contact"].ToString());
item.SubItems.Add(dr["address"].ToString());
lsvList.Items.Add(item);
}
}
}
}
}

You might also like