Professional Documents
Culture Documents
A Computerized Dental Management System For CBM Dental Clinic
A Computerized Dental Management System For CBM Dental Clinic
A Project
Presented to
In Partial Fulfillment
by
Labausa, Archie A.
Torres, Daryll L.
Yosores, Grace G.
April 2019
ADVISER’S RECOMMENDATION SHEET
by:
Project Adviser
April 2019
PANEL’S APPROVAL SHEET
developed by:
April 2019
PROJECT COORDINATOR AND DEAN’S ACCEPTANCE SHEET
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
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
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
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
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.
patients.
payment computerize?
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
1.3 Objectives
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
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
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.
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
Scope
User Logs
Level of Access – there will be two user for the system which is the
File Maintenance
Billing
Scheduling
appointment.
reschedule an appointment.
appointment.
Audit Trail
Backup and Restore - the system allows the dentist to restore the data
Reports
Billing Record
Limitations
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
2.2 Methodology
In the development of system we have used Waterfall method, the linear sequential
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
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
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
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
actual implementation.
Acceptance- This is the step wherein we have to put the system into final application which is
complementary networks that people and organizations use to collect, filter, and
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
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
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
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
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
MySQL that can make the proposed system understandable and attractive to the users.
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
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
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
The proponents use case diagram to represent o user's relation with the system.
demonstrating to its process aspects. A DFD is often used as preliminary system to create an
The proponent used ERD to show or visualize how the data connected in general way, and are
3.4 Hardware
Laptop
o Wireless Mouse
o RAM: 2.00GB
o System type: 64-bit Operating System, x64-based processor
Laptop or Desktop
o RAM: 2.00GB
The proponents need the following software in the completion of the project:
• C#
the exchange of information and services over the Web, and to enable developers to build
Markup Language (XML) and Simple Object Access Protocol (SOAP) which allow
• MySQL
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
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
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
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.
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
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
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.
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
modules to know the overall evaluation. Testing module will help the proponents
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
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
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
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.
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
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
www.dotnet.za.net/book/IntroToASP.NET.pdf
2012.
Singapore 29(5):576–581
[5] Atkinson, J.C., Zeller, G.G., & Shah, C. (2002, May 1),”
[8] Krishnan, A., Nongkynrih, B., Yadav, K., Singh, S. & Gupta,
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
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
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
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
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
AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A
SKILLS
SKILLS Level of Competency Date Acquired
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
AFFILIATIONS
Inclusive Dates Name of Organization Position
N/A N/A N/A
SKILLS
SKILLS Level of Competency Date Acquired
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
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
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();
}
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();
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();
}
}
date.Enabled = true;
time.Enabled = true;
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)");
}
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);
}
}
}
}
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);
}
}
}
}
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')";
Clear();
LoadData();
}
}
}
}
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 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();
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;
}
confirm.Visible = false;
}
}
}
}
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();
}
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();
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();
}
}
date.Enabled = true;
time.Enabled = true;
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)");
}
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);
}
}
}
}
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);
}
}
}
}
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')";
MessageBox.Show("Reservation Successful!");
Clear();
LoadData();
}
}
}
}
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 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();
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;
}
Clear();
LoadData();
con.Close();
confirm.Visible = false;
}
}
}
}
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();
}
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')";
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')";
}
else
{
MessageBox.Show("Please check your username/password");
}
}
con.Close();
}
else
{
MessageBox.Show("Please check your username/password");
}
con.Close();
}
}
}
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)
{
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();
}
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();
//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))
{
}
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!");
}
}
}
}
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 txtcn_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsLetterOrDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar ==
45 ? false : true;
}
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);
}
}
}
}
}
}
}
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();
}
LoadActive();
}
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();
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()
;
}
priv
ate
void
radi
oBut
ton4
_Che
cked
Chan
ged(
obje
ct
send
er,
Even
}
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();
}
}
}
camd.ExecuteReader(); if (drs.HasRows ==
false)
{
MessageBox.Show("Please Select A Patient");
}
else
{
System.Diagnostics.Process[] ps =
System.Diagnostics.Process.GetProcessesByName("winword");
System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);
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();
aDoc.Save();
OpenConnect();
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);
}
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");
}
}
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);
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();
}
}
}
}
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);
}
}
}
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();
}
}
}
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
{
}
}
time.Text = DateTime.Now.ToShortTimeString().Remove(5);
dt.Start();
}
}
}
}
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();
}
LoadActive();
}
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 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();
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();
}
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();
}
}
}
if (drs.HasRows == false)
{
MessageBox.Show("Please Select A Patient");
}
else
{
System.Diagnostics.Process[] ps =
System.Diagnostics.Process.GetProcessesByName("winword");
System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);
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();
aDoc.Save();
OpenConnect();
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);
}
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");
}
}
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);
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();
}
}
}
}
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);
}
}
}
}
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();
}
}
}
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
{
}
}
time.Text = DateTime.Now.ToShortTimeString().Remove(5);
dt.Start();
}
}
}
}
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 = "";
}
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();
}
}
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' + "')";
}
private void txtcn_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = char.IsDigit(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == 45 ?
false : true;
}
}
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);
}
}
}
}
}
}
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();
}
}
}
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();
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();
}
lsvList.Items.Clear();
if(txtSearch.Text == "")
{
lsvList.Items.Clear();
cdate.Enabled = true;
dr2.Enabled = true;
}
else
{
cdate.Enabled = false;
dr2.Enabled = false;
OpenConnect();
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);
}
}
}
}
}
}
}
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();
}
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();
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");
}
System.IO.File.Copy("C:\\Users\\DELL\\Desktop\\AppointmentSystem\\clear.docx",
"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.docx", true);
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();
aDoc.Save();
}
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);
}
System.Diagnostics.Process.Start(@"C:\\Users\\DELL\\Desktop\\AppointmentSystem\\output.do
cx");
}
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);
}
}
}
}
}