Professional Documents
Culture Documents
INTRODUCTION
The purpose of this document to give a general information about the project
and emphasizes the important parts that interacts with the main system.
This report will be read by the manager of the dental hospital and board of
management. This report will provide managers to see the interaction between dentists
and the patients as well as the information they will share. Project will help the dental
hospital to reach their potential patients.
While preparing the Project, firstly, the requirements were considered and
design of the Project was completed. In the design part, all the operations were shown
step by step. After the completion of the design, the code of the Project was written
and implementation part was carried out.
2. CORPORATE OVERVIEW
This system provides patients to see the information and the schedule of the
dentists in order to choose their own dentist for any operation. Also, in the system,
both patients and the dentists can see the former operations, that had been done to the
patients, on the reports which are prepared by the dentists.
3.
SYSTEM REQUEST
Project Sponsor: Mehmet Sapmaz, Manager of the Dental Hospital
Business Need: This project has been initiated to reach new patients via Internet, to
increase the potential of preferability and to provide an effective way to monitor the existing
patients.
Business Requirements: Using the web, patients should be able to register to the
system, list dentists and reach their schedules, select their own dentists, update or delete their
own appointments. They should be able to search a specific dentist or time to get an
appointment. if they choose a dentist that is very busy, the system reserves its rights to assign
the patient to another dentist. Dentists should be able to upload their schedules, update or
delete appointments. They should also be able to list and reach all information of their own
patients. Finally, admin(s) should be able to add dentists with their information, update or
delete them. The admin(s) should be able to list all dentists and patients and reach their
information.
1
System will assign patients automatically one by one to the dentists if they do not
choose a specific dentist. Therefore, equal distribution of the patients will be provided by the
system.
The functionality that the system will have is as follows:
-
patients that come to the hospital in a year. In this way, annual earning will increase about
%20 per year. We also expect via the online appointment system, patient complaints will
decrease because more than %40 of the all patients reproach from hardship of getting an
appointment at any time they want.
Conservative estimates of tangible value to the hospital include:
-
4. REQUIREMENTS SPECIFICATION
a. Nonfunctional Requirements
1. Operational Requirements
1.1. The record logging option of the application includes ability to record modifications
with user identification and date & time.
1.2. The system should be able to work on any web browser.
1.3. The system should be able to work on every screen resolutions.
1.4. If a dentist quits the job or takes time off from work, then his/her patients will
automatically be assigned to other dentists and patients will be informed by an
automatic e-mail that system sends.
2. Performance Requirements
2.1. The system should be able to give response to user less than 2 seconds.
2.2. The system should be available for use 24 hours per day, 365 days per year.
2.3. The system should have less than 1 day downtime per year.
2.4. The system should have capacity of at least 200.000 users at the beginning.
3. Security Requirements
3.1. The passwords and user names should be stored in encrypted format to protect
patients' privacy.
3.2. A dentist should not be able to reach the information of a patient who is not his/her
own patient.
3.3. The system should be able to provide datacenter security, database security and
privacy of users information.
3.4. A patient should not be able to see the information of other patients.
3.5. User access to data should be controlled at various levels.
4. Cultural and Political Requirements
No special cultural and political requirements are anticipated.
b. Functional Requirements
1. Maintain Database Information
1.1.
The system will need a database that keeps all patients and dentists
information. (e.g. TCid, name, surname, age, special professions of dentists etc.)
The system must receive updates instantly, especially the moment that an
1.2.
appointment occurs.
1.3.
The system must keep dentists daily schedules.
3
1.4.
The system must keep the dental processes made to patients at Hospidental
and print their reports showing id, name, surname, age, gender and previous dental
processes.
1.4.
1.5.
5. FUNCTIONAL MODEL
a) Use Case Diagram
Brief Description
Preconditions
Post-conditions
Flow of Events
Alternative-1
Scope
Level
Primary Actor
Preconditions
Post-conditions
Flow of Events
Patients can get an appointment from any dentist instantly using the system.
Login the system.
The system updates changes on a schedule immediately.
Actor Input
System Response
1
Actor clicks on "Get an
appointment" tab
2
The system displays
"get_appointment" page
3
Actor enters time and clicks OK
button
4
The system checks if any dentist is
available at the entered time
5
The system shows the dentists that
are available at the entered time
6
Actor selects a dentist
7
The system displays selected
dentist's schedule on
"approve_appointment" page and
signs the entered time on the
schedule
8
The system enables "Approve" and
"Cancel" buttons
9
Actor clicks "Approve" button
10
The system receives the
appointment and update the chosen
dentist's schedule
11
The system displays main page
Online Dental Hospidental Appointment System
Alternative of user goal
Patient
Login the system
1
Actor Input
Actor clicks on "Get an
appointment" tab
2
3
System Response
The system displays
"get_appointment" page
6
Alternative-2.
Scope
Level
Primary Actor
Preconditions
Post-conditions
Flow of Events
Actor Input
Actor clicks on "Get an
appointment" tab
2
3
5
6
7
8
9
10
System Response
11
1
2
Actor Input
Actor clicks on the "Dentists" tab
System Response
The system displays "Dentists"
page
3
4
1
2
3
Actor Input
Actor clicks on the "Dentists" tab
4
5
6
7
Alternative.
Scope
Level
Primary actor
Secondary actors
Brief Description
Preconditions
Post-conditions
Flow of Events
System Response
1
2
3
Actor Input
Actor clicks on the "Dentists" tab
4
5
6
7
System Response
Brief Description
Preconditions
Post-conditions
Flow of Events
Actor Input
Actor clicks on "MyProfile" tab
3
4
5
6
8
Alternative.
Scope
Level
Brief Description
Preconditions
Post-conditions
Flow of Events
System Response
Actor Input
Actor clicks on "MyProfile" tab
3
4
5
6
System Response
10
Actor Input
Actor clicks on "Dentists" tab
4
5
6
System Response
11
Brief Description
Preconditions
Post-conditions
Flow of Events
6
7
8
Alternative.
Scope
Level
Primary actor
Brief Description
Preconditions
Post-conditions
Flow of Events
4
5
System Response
Actor Input
Actor clicks "MyProfile" tab
4
5
6
7
System Response
Alternative.
Scope
Level
Brief Description
Preconditions
Post-conditions
Flow of Events
1
2
3
Actor Input
Actor clicks "Login" button on
main page
5
6
8
9
10
System Response
11
c) Activity Diagrams
Login the System
14
15
22
Figure
25.
Design
Class
Diagram
9. INTERACTION
DIAGRAMS
GetAppointment(date :
Date)
ListDentists()
23
26
27
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace DentalHospital
{
public partial class Patient : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ //login check starts
if (Session["loginName"] != null && Session["loginPass"] != null &&
Convert.ToInt32(Session["userType"]) == 3)
{ //session control
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
//if session is empty, does it!
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{ //if input info is correct, getting patient id
SqlConnection connn = new SqlConnection(Tools.localConnString);
SqlCommand comm = new SqlCommand("Select UserId from Userr where
UserName = '" + Session["loginName"].ToString() + "' and Password = '" +
Session["loginPass"].ToString() + "' and UserTypeId = '" + Session["userType"].ToString() +
"'", connn);
connn.Open();
string UserrrrId = comm.ExecuteScalar().ToString();
connn.Close();
SqlDataAdapter dap = new SqlDataAdapter("Select * from Patient where
UserrId=" + UserrrrId.ToString(), new SqlConnection(Tools.localConnString));
DataTable dt = new DataTable();
dap.Fill(dt);
string PatientId = dt.Rows[0]["PatientId"].ToString();
string Name = dt.Rows[0]["Name"].ToString();
string Surname = dt.Rows[0]["Surname"].ToString();
string ReportId = dt.Rows[0]["ReportId"].ToString();
LabelName.Text=Name+" "+Surname;
if (ReportId.Equals(""))
29
{
return;
}
else
{
SqlConnection co = new SqlConnection(Tools.localConnString);
SqlCommand c = new SqlCommand("Select Diagnosis from Patient inner join
Report on Report.ReportId ="+ReportId , co);
co.Open();
string Diagnosis = c.ExecuteScalar().ToString();
co.Close();
LabelReport.Text = Diagnosis;
}
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
//login check finishes
protected void LinkButton3_Click(object sender, EventArgs e)
{ //logout
Session["loginName"] = null;
Session["loginPass"] = null;
Session["userType"] = null;
Response.Redirect(ResolveUrl("~/Default.aspx"));
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/Appointment.aspx"));
30
}
}
}
Appointment.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/DentalMaster.Master"
AutoEventWireup="true"
CodeBehind="Appointment.aspx.cs" Inherits="DentalHospital.Appointment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click">Get
Appointment</asp:LinkButton>
/
<asp:LinkButton ID="LinkButton3" runat="server"
OnClick="LinkButton3_Click">Logout</asp:LinkButton><br />
<table>
<tr>
<th>
Doctor Name
</th>
<th>
Date
</th>
<th>
Hours
</th>
</tr>
<asp:ListView ID="ListView1" runat="server"
onitemcommand="ListView1_ItemCommand">
<ItemTemplate>
<tr>
<td><%# Eval("Name").ToString()%> <%# Eval("Surname").ToString()%>
</td>
<td><%# Eval("StartDate").ToString().Substring(0,10)%>
</td>
<td><%# Eval("StartDate").ToString().Substring(11,5)%>-<%#
Eval("EndDate").ToString().Substring(11,5) %></td>
<td>
<asp:LinkButton ID="LinkButtonGetAppointment"
CommandName="GetAppointment" CommandArgument='<%#
Eval("ScheduleId").ToString() + ";" + Eval("StartDate").ToString() %> '
runat="server">Register</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
31
<tr><td> </td></tr>
<tr><th colspan="3">My Appointments</th></tr>
<asp:ListView ID="ListView2" runat="server">
<ItemTemplate>
<tr>
<td><%# Eval("Name").ToString()%> <%# Eval("Surname").ToString()%>
</td>
<td><%# Eval("StartDate").ToString().Substring(0,10)%>
</td>
<td><%# Eval("StartDate").ToString().Substring(11,5)%>-<%#
Eval("EndDate").ToString().Substring(11,5) %></td>
</tr>
</ItemTemplate>
</asp:ListView>
</table>
</asp:Content>
Appointment.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace DentalHospital
{
public partial class Appointment : System.Web.UI.Page
{
public string PatientId;
protected void Page_Load(object sender, EventArgs e)
{ //login check starts
if (Session["loginName"] != null && Session["loginPass"] != null &&
Convert.ToInt32(Session["userType"]) == 3)
{
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
32
33
throw;
}
finally
{
conn.Close();
}
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
}
protected void LinkButton3_Click(object sender, EventArgs e)
{ //logout
Session["loginName"] = null;
Session["loginPass"] = null;
Session["userType"] = null;
Response.Redirect(ResolveUrl("~/Default.aspx"));
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/Appointment.aspx"));
}
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs)
{
//according to schedule id, time is specified.
string ScheduleId = e.CommandArgument.ToString().Split(';')[0].ToString();
string sd = e.CommandArgument.ToString().Split(';')[1].ToString();
int day = Convert.ToInt32(sd.Split(' ')[0].Split('.')[0].ToString());
int month = Convert.ToInt32(sd.Split(' ')[0].Split('.')[1].ToString());
int year = Convert.ToInt32(sd.Split(' ')[0].Split('.')[2].ToString());
int hour = Convert.ToInt32(sd.Split(' ')[1].Split(':')[0].ToString());
int min = Convert.ToInt32(sd.Split(' ')[1].Split(':')[1].ToString());
int sec = Convert.ToInt32(sd.Split(' ')[1].Split(':')[2].ToString());
DateTime StartDate = new DateTime(year, month, day, hour, min, sec);
SqlConnection ccon = new SqlConnection(Tools.localConnString);
SqlCommand ccom = new SqlCommand("Insert Into Appointment (PatientId,Date)
values (@PatientId,@StartDate)", ccon);
ccom.Parameters.AddWithValue("@PatientId", PatientId);
ccom.Parameters.AddWithValue("@StartDate",StartDate);
34
ccon.Open();
int aa = ccom.ExecuteNonQuery();
ccon.Close();
//insert appointment in database
SqlConnection con = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("update Schedule set PatientId="+PatientId+"
where ScheduleId="+ScheduleId,con);
con.Open();
int a = com.ExecuteNonQuery();
con.Close();
//update schedule according to patient id
Response.Redirect(ResolveUrl("~/Patient.aspx"));
}
}
}
Dentist.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/DentalMaster.Master"
AutoEventWireup="true" CodeBehind="Dentist.aspx.cs" Inherits="DentalHospital.Dentist"
%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" >My
Details</asp:LinkButton> /
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Give
Report</asp:LinkButton> /
<asp:LinkButton ID="LinkButton3" runat="server" onclick="LinkButton3_Click"
>Logout</asp:LinkButton>
<table style="text-align: left" cellpadding="3px" cellspacing="1px">
<thead>
<tr>
<th class="header" colspan="5">
List Of Dentists
</th>
</tr>
<tr>
<th>
Name Surname
</th>
<th>
Age
</th>
<th>
35
Sex
</th>
<th>
Telephone
</th>
<th>
Operations
</th>
</tr>
</thead>
<tbody>
<asp:ListView runat="server" ID="ListView1"
OnItemCommand="ListView1_ItemCommand">
<ItemTemplate>
<tr class="non-alternate">
<td>
<%# Eval("Name").ToString() %>
<%# Eval("Surname").ToString() %>
</td>
<td>
<%# Eval("Age").ToString() %>
</td>
<td>
<%# Eval("Sex").ToString() %>
</td>
<td>
<%# Eval("Telephone").ToString() %>
</td>
<td>
<asp:LinkButton ID="LinkButtonDentistDelete" CommandName="detail"
CommandArgument='<%# Eval("DentistId").ToString() %>'
runat="server">Details</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr class="alternate">
<td>
<%# Eval("Name").ToString() %>
<%# Eval("Surname").ToString() %>
</td>
<td>
<%# Eval("Age").ToString() %>
</td>
<td>
<%# Eval("Sex").ToString() %>
</td>
<td>
<%# Eval("Telephone").ToString() %>
</td>
36
<td>
<asp:LinkButton ID="LinkButtonDentistDelete" CommandName="detail"
CommandArgument='<%# Eval("DentistId").ToString() %>'
runat="server">Details</asp:LinkButton>
</td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
</tbody>
<tfoot>
</tfoot>
</table>
</asp:Content>
Dentist.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace DentalHospital
{
public partial class Dentist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ //login check
if (Session["loginName"] != null && Session["loginPass"] != null &&
Convert.ToInt32(Session["userType"]) == 2)
{
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{ //get dentist list
SqlDataAdapter dap = new SqlDataAdapter("select * from Dentist", new
SqlConnection(Tools.localConnString));
37
{ //logout
Session["loginName"] = null;
Session["loginPass"] = null;
Session["userType"] = null;
Response.Redirect(ResolveUrl("~/Default.aspx"));
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/DentistDetails.aspx"));
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/GiveReport.aspx"));
}
}
}
DentistDetails.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/DentalMaster.Master"
AutoEventWireup="true"
CodeBehind="DentistDetails.aspx.cs" Inherits="DentalHospital.DentistDetails" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
/<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Give
Report</asp:LinkButton> /
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/Dentist.aspx">Dentist</asp:LinkButton><br />
<table>
<tr>
<td>
Date
</td>
<td colspan="3">
Hour
</td>
<td>
Patient
</td>
</tr>
<asp:ListView ID="ListView1" runat="server"
onitemcommand="ListView1_ItemCommand">
<ItemTemplate>
<tr>
<td>
<%# Eval("StartDate").ToString().Substring(0,10) %>
39
</td>
<td>
<%# Eval("StartDate").ToString().Substring(11,5)%>
</td>
<td>
</td>
<td>
<%# Eval("EndDate").ToString().Substring(11,5)%>
</td>
<td>
<%# Eval("Name").ToString()%>
<%# Eval("Surname").ToString()%>
</td>
<td>
<asp:LinkButton ID="LinkButtonDelete" CommandName="ddelete"
CommandArgument='<%# Eval("ScheduleId").ToString()%>'
runat="server">Delete</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr>
<td>
<%# Eval("StartDate").ToString().Substring(0,10) %>
</td>
<td>
<%# Eval("StartDate").ToString().Substring(11,5)%>
</td>
<td>
</td>
<td>
<%# Eval("EndDate").ToString().Substring(11,5)%>
</td>
<td>
<%# Eval("Name").ToString()%>
<%# Eval("Surname").ToString()%>
</td>
<td>
<asp:LinkButton ID="LinkButtonDelete" CommandName="ddelete"
CommandArgument='<%# Eval("ScheduleId").ToString()%>'
runat="server">Delete</asp:LinkButton>
</td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
<tr>
<td>
40
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{ //get schedule
FillSchedule();
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
private void FillSchedule()
{
if (Request.QueryString["DentistId"] == null)
{
SqlConnection connn = new SqlConnection(Tools.localConnString);
SqlCommand comm = new SqlCommand("Select UserId from Userr where
UserName = '" + Session["loginName"].ToString() + "' and Password = '" +
Session["loginPass"].ToString() + "' and UserTypeId = '" + Session["userType"].ToString() +
"'", connn);
//get user info
connn.Open();
string UserrrrId = comm.ExecuteScalar().ToString();
connn.Close();
42
44
Report.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace DentalHospital
{
public partial class GiveReport : System.Web.UI.Page
{
public string DentisId;
protected void Page_Load(object sender, EventArgs e)
{ //login check
if (Session["loginName"] != null && Session["loginPass"] != null &&
Convert.ToInt32(Session["userType"]) == 2)
{
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
45
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{
if (Request.QueryString["DentistId"] == null)
{ //get user info
SqlConnection connn = new SqlConnection(Tools.localConnString);
SqlCommand comm = new SqlCommand("Select UserId from Userr where
UserName = '" + Session["loginName"].ToString() + "' and Password = '" +
Session["loginPass"].ToString() + "' and UserTypeId = '" + Session["userType"].ToString() +
"'", connn);
connn.Open();
string UserrrrId = comm.ExecuteScalar().ToString();
connn.Close();
SqlConnection co = new SqlConnection(Tools.localConnString);
SqlCommand c = new SqlCommand("Select DentistId from Dentist where
UserrId=" + UserrrrId.ToString(), co);
co.Open();
DentisId = c.ExecuteScalar().ToString();
co.Close();
SqlDataAdapter dap = new SqlDataAdapter("Select
Name,Surname,Patient.PatientId as PatientId from Schedule inner join Patient on
Schedule.PatientId = Patient.PatientId where Schedule.DentistId = @DentistId and
Patient.ReportId IS NULL",new SqlConnection(Tools.localConnString));
dap.SelectCommand.Parameters.AddWithValue("@DentistId",DentisId);
DataTable dt = new DataTable();
dap.Fill(dt);
ListView1.DataSource = dt;
ListView1.DataBind();
} //see patients that can be given report
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
catch (Exception)
{
throw;
46
}
finally
{
conn.Close();
}
}
else
{
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
protected void LinkButton3_Click(object sender, EventArgs e)
{ //logout
Session["loginName"] = null;
Session["loginPass"] = null;
Session["userType"] = null;
Response.Redirect(ResolveUrl("~/Default.aspx"));
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/DentistDetails.aspx"));
}
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs
e)
{ //according to patient id, getting report id
SqlConnection con = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select ReportId from Patient where
PatientId=@PatientId",con);
com.Parameters.AddWithValue("@PatientId", e.CommandArgument.ToString());
con.Open();
object reportId = com.ExecuteScalar();
string r = Convert.ToString(reportId);
con.Close();
if(r == "")
Response.Redirect(ResolveUrl("~/ReportToPatient.aspx?
PatientId="+e.CommandArgument.ToString()+"&DentistId="+DentisId));
}
}
}
Admin.aspx
47
<td>
<asp:TextBox ID="TextBoxTelephone" runat="server"></asp:TextBox>
</td>
<td>
<asp:LinkButton ID="LinkButtonDentistInsert"
runat="server"
onclick="LinkButtonDentistInsert_Click">Insert</asp:LinkButton>
</td>
</tr>
</tfoot>
</table>
</asp:Content>
Admin.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace DentalHospital
{
public partial class Administration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ //login check
if (Session["loginName"] != null && Session["loginPass"] != null &&
Convert.ToInt32(Session["userType"]) == 1)
{
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{ //see dentists
SqlDataAdapter dap = new SqlDataAdapter("select * from Dentist", new
SqlConnection(Tools.localConnString));
50
finally
{
conn.Close();
}
}
if (e.CommandName == "updatee")
{
//Response.Redirect("DentistUpdate.aspx?DentistId=" +
e.CommandArgument.ToString());
return;
}
}
private void FillDentists()
{ //get dentist
SqlDataAdapter dap = new SqlDataAdapter("Select * from Dentist",
Tools.localConnString);
DataTable dt = new DataTable();
dap.Fill(dt);
ListView1.DataSource = dt;
ListView1.DataBind();
}
protected void LinkButtonDentistInsert_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Insert into
Dentist(Name,Surname,Age,Sex,Telephone)
values(@Name,@Surname,@Age,@Sex,@Telephone)", con);
com.Parameters.AddWithValue("@Name", TextBoxName.Text.ToString());
com.Parameters.AddWithValue("@Surname", TextBoxSurname.Text.ToString());
com.Parameters.AddWithValue("@Age", TextBoxAge.Text.ToString());
com.Parameters.AddWithValue("@Sex", TextBoxSex.Text.ToString());
com.Parameters.AddWithValue("@Telephone",
TextBoxTelephone.Text.ToString());
try
{
con.Open();
if (1 == com.ExecuteNonQuery())
{
}
else
{
}
}
catch (Exception exception)
52
{
throw;
}
finally
{
con.Close();
Response.Redirect(ResolveUrl("~/Administration.aspx"));
}
}
protected void LinkButton3_Click(object sender, EventArgs e)
{ //logout
Session["loginName"] = null;
Session["loginPass"] = null;
Session["userType"] = null;
Response.Redirect(ResolveUrl("~/Default.aspx"));
}
}
}
Login.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/DentalMaster.Master"
AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DentalHospital.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table>
<tr>
<td>
<b>Kullanc Ad</b>
</td>
<td>
<b>:</b>
</td>
<td>
<asp:TextBox ID="txtLgn" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<b>ifre</b>
</td>
<td>
<b>:</b>
</td>
<td>
<asp:TextBox ID="txtPass" runat="server"
TextMode="Password"></asp:TextBox>
</td>
53
</tr>
<tr>
<td colspan="3">Login As;
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Text="Admin" Value="1"></asp:ListItem>
<asp:ListItem Text="Dentist" Value="2"></asp:ListItem>
<asp:ListItem Text="Patient" Value="3"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td colspan="3">
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click"><b>Go !</b></asp:LinkButton>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="lblError" runat="server"></asp:Label>
</td>
</tr>
</table>
</asp:Content>
Login.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace DentalHospital
{
public partial class Login : System.Web.UI.Page
{
string loginName;
string loginPass;
int userType;
protected void Page_Load(object sender, EventArgs e)
{ //login checks
if (Session["loginName"] != null && Session["loginPass"] != null &&
Session["loginPass"] != null)
{
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", Session["loginName"]);
54
com.Parameters.AddWithValue("@Password", Session["loginPass"]);
com.Parameters.AddWithValue("@UserTypeId", Session["userType"]);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{
switch (Convert.ToInt32(Session["userType"]))
{
case 1:
Response.Redirect(ResolveUrl("~/Administration.aspx"), false);
break;
case 2:
Response.Redirect(ResolveUrl("~/Dentist.aspx"), false);
break;
case 3:
Response.Redirect(ResolveUrl("~/Patient.aspx"), false);
break;
}
}
else
{
return;
}
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
}
else
{
return;
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
loginName = txtLgn.Text.Trim();
55
loginPass = txtPass.Text.Trim();
userType = Convert.ToInt32(RadioButtonList1.SelectedValue);
SqlConnection conn = new SqlConnection(Tools.localConnString);
SqlCommand com = new SqlCommand("Select Count(*) from Userr where
UserName = @UserName and Password = @Password and UserTypeId = @UserTypeId",
conn);
com.Parameters.AddWithValue("@UserName", loginName);
com.Parameters.AddWithValue("@Password", loginPass);
com.Parameters.AddWithValue("@UserTypeId", userType);
try
{
conn.Open();
if ((int)com.ExecuteScalar() == 1)
{
Session["loginName"] = loginName;
Session["loginPass"] = loginPass;
Session["userType"] = userType;
switch (userType)
{
case 1:
Response.Redirect(ResolveUrl("~/Administration.aspx"), false);
break;
case 2:
Response.Redirect(ResolveUrl("~/Dentist.aspx"), false);
break;
case 3:
Response.Redirect(ResolveUrl("~/Patient.aspx"), false);
break;
}
}
else
{
lblError.Text = "Byle bir kullanc ad veya ifre ikilisi bulunmuyor";
Response.Redirect(ResolveUrl("~/Login.aspx"));
}
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}
56
}
}
}
Note: Classes and functions that have high importance have been implemented.
11. SCREENSHOTS
Login:
----------------------------------------------------------------------------------------------------------Patient:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Dentist:
57
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Admin:
58
59