View
47
Download
0
Category
Tags:
Preview:
DESCRIPTION
hospital management coding of ado .net
Citation preview
HOSPITAL MANAGEMENT SYSTEMLife Line Hospital was founded in 2011 with an aim to help people with their medical needs. It has become are all life line of for the city of Texas because it was founded with motive to serve people rather than make profits. Highly dedicated employees and a specialized medical staff are the key factors that help people to rely on Life Line.
Life Line has a group of social and professional people as directors and managers in its management who provide a personal as well as professional touch to the overall working of the hospital. Proper guidelines and objectives are laid down for every process and section of the hospital which results in ensuring satisfaction of patients.
The current department structure of Life Line is given below:-
Page 1 of 33
1
Current SystemLife Line Hospital maintains a manual system to manage its operations. The front desk assistant handles the Out Patient (OP) registration details. When patient comes for admission or consultation, the front desk assistant makes the required entries in the OP file. The front desk assistant provides an OP number and then the patient is referred to the concerned doctor. The concerned department assistant then makes the entry of the patient in In-Patient(IP) file and provides an IP number. The patient is then referred to an available doctor and the treatment process starts. The Patient Insurance Department issues the required documents for the medical insurance of the patient. The documents are then sent to the concerned doctor and accounts department for approval and if approval is given, the documents are sent to the concerned insurance company.
Below is the ER diagram of patient’s registration and management in Life Line:-Page 2 of 33
2
Front-End and Middle-Tier Code and Design
Visual C# programming is used to make the front-end for the users to work in the system while Ado.NET is used to connect the Front-End and Back-End.
The forms used are divided into the following ways for ease of use:-
1. Log-In Form2. Life Line System Workspace Form3. Medical And Drug History4. Diagnosis And Bills5. Create An Event or Circular6. Delete Confirm Form7. Help Menu
Log-In Form
The Log-In Form is shown above. The properties set are below:-
Property Name Value
Form:-
3
Name formLogin
Text Log-In Form
MaximizeBox False
MinimizeBox False
StartPosition CentreScreen
Font TimesNewRoman,9.75pt,style=Bold
Size 604,420
Panel:-
Name panelLogin
AutoSize True
Dock Fill
Labels:-
Name:- labelUsername
Text Username
FontColor Desktop
Font TimesNewRoman,12pt,style=Bold,Underline
Name labelInfo
Text LogintoHospitalManagementSystem
Font TimesNewRoman,15.75pt,style=Bold,Underline
Name labelPassword
Text Password
Font TimesNewRoman,12pt,style=Bold,Underline
FontColor Desktop
TextBox:-
Name textUsername
Font TimesNewRoman,9.75pt,style=Bold
TabIndex 1
4
Name textpassword
Font TimesNewRoman,9.75pt,style=Bold
TabIndex 2
Button:-
Name btnLogin
Text LOGIN
Font TimesNewRoman,14.25pt,style=Bold
FontColor Green
Name btnCancel
Text CANCEL
Font TimesNewRoman,14.25pt,style=Bold
FontColor 192,0,0
The code written for this form is below:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Hospital_Management_Project
{
public partial class formLogin : Form
{
public formLogin()
{
5
InitializeComponent();
}
int ctr;
public string username, password;
private void buttonCancel_Click(object sender, EventArgs e)
{
//To exit the application on pressing the CANCEL button
Application.Exit();
}
private void buttonLogin_Click(object sender, EventArgs e)
{
//Code to login to the database.
//User given 3 tries to login.
username = textUsername.Text;
password = textPassword.Text;
ctr = ctr + 1;
if ((username == "Hospital") && (password == "niit"))
{
labelLoginStatus.Visible = true;
labelLoginStatus.Text = "Login Successful";
ctr = 0;
formLifeLineSystemWorkspace fhmw = new formLifeLineSystemWorkspace();
fhmw.Show();
this.Hide();
}
else
if (ctr < 3)
{
labelLoginStatus.Visible = true;
6
labelLoginStatus.Text = "Login Unsuccessful";
textUsername.ResetText();
textPassword.ResetText();
textUsername.Focus();
}
else
{
MessageBox.Show("Unauthorized access. Aborting ............");
Application.Exit();
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void textPassword_TextChanged(object sender, EventArgs e)
{
}
}
}
7
Life Line System Workspace Form
The workspace form's property set is given below:-
PropertyName Value
Form:-
Name formLifeLineSystemWorkspace
Text LifeLineSystemWorkspace
BackgroundImage Hospital_Management_Project.Properties.Resources.isuite
BackgroundImageLayout Stretch
IsMDIContainer True
MainMenuStrip menuStrip1
StartPosition CenterScreen
WindowState Maximized
MenuStripControl
Name menuStrip1
Collections menuPatientRegistrationDetailsmenuFinancialAccontingmenuMiscOperatingDepartmentsmenuMoreOptionsMenuToolStripmenuHelp
menuPatientRegistrationDetails
8
Name menuPatientRegistrationDetails
Text PatientRegistrationDetails
Collections menuMedicalAndDrugHistorymenuDiagnosisAndBills
menuFinancialAccounting
Name menuFinanialAccounting
Text FinancialAccounting
menuMiscOperatingDepartments
Name menuMiscOperatingDepartments
Text Misc.OperatingDepartments
menuMoreOptions
Name menuMoreOptions
Text MoreOptions
Collections createAnEventOrCircularToolStripMenuItem
menuHelp
Name menuHelp
Text Help
The code written for this form is below:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace Hospital_Management_Project
{
public partial class formLifeLineSystemWorkspace : Form
{
public formLifeLineSystemWorkspace()
9
{
InitializeComponent();
}
private void menuMedicalDrugHistory_Click(object sender, EventArgs e)
{
//Shows Medical and Drug History form.
formMedicalAndDrugHstory fmdh = new formMedicalAndDrugHstory();
fmdh.Show();
fmdh.MdiParent = this;
}
private void menuPatientStatusAndBills_Click(object sender, EventArgs e)
{
//Shows Diagnosis And Bills form.
formDiagnosisAndBills fdb = new formDiagnosisAndBills();
fdb.Show();
fdb.MdiParent = this;
}
private void formHospitlaManagementWorkspace_FormClosing(object sender, FormClosingEventArgs e)
{
//On clicking the close button on the workspace form, the application shuts down.
Application.Exit();
}
private void menuFinancialAcconting_Click(object sender, EventArgs e)
{
MessageBox.Show("The application is still under construction, so not all parts of it are ready yet. We regret our convenience.");
}
private void menuMiscOperatingDepartments_Click(object sender, EventArgs e)
10
{
MessageBox.Show("The application is still under construction, so not all parts of it are ready yet. We regret our convenience.");
}
private void createAnEventOrCircularToolStripMenuItem_Click(object sender, EventArgs e)
{
//Shows the create and Event or Circular form
formCreateAnEventOrCircular fcaeoc = new formCreateAnEventOrCircular();
fcaeoc.Show();
}
private void menuHelp_Click(object sender, EventArgs e)
{
Process.Start(Application.StartupPath + @"\Help File\Hospital Management System.chm");
}
}
}
Medical And Drug History Form
11
The form's property set is given below:-
Property Name Value
Form:-
Name formMedicalAndDrugHistory
Text MedicalAndDrugHistory
BackColor LightSteelBlue
ShowIcon False
Labels:-
Name labelOPID
Text OPID
Name labelIPID
Text IPID
Name labelPatientName
Text PatientName
Name labelAddress
Text Address
Name labelProblem
Text Problem
Name labelMedicineHistory
12
Text MedicalHistory
Name labelPreviousDoctor
Text PreviousDoctor(Ifany.)
Name labelPreviousHospital
Text PreviousHospital(Ifany.)
Name labelDostorSpeciality
Text DoctorSpecialty
Name labelDoctorID
Text DoctorID
Name labelOPIDSearch
Text MentionOPIDHere
Font(--setforalllabels--) Times New Roman, 11.25pt, style=Bold
TextBoxes:-
Name textIPID
Name textOPID
Name textPatientName
Name textAddress
Name textProblem
Name textMedicalHistory
Name textPreviousDoctor
Name textPrevioudHospital
Name textDoctorSpeciality
Font(--setforalltextboxes---) TimesNewRoman,9.75pt
ComboBox:-
Name ComboBoxOPIDSearch
GroupBox:-
Name groupBoxSearch
Text Searchanrecord
Font MicrosoftSansSerif,9.75pt
DataGridView:-
Name dataGridView1
Buttons:-
Name btnAdd
Text ADD
Color DarkCyan
13
Name btnSave
Text Save
Color Green
Name btnReset
Text Reset
Color ControlText
Name btnDelete
Text Delete!
Color 192,0,0
Name btnSearch
Text Search
Color MidnightBlue
The code written for this form is below:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Hospital_Management_Project
{
public partial class formMedicalAndDrugHstory : Form
{
SqlConnection conn ;
public formMedicalAndDrugHstory()
{
InitializeComponent();
conn = new SqlConnection("data Source=kol-11274-mrsrv;Initial catalog=HospitalManagementSystem;User Id=student;Password=sql_2005");
}
14
private void formMedicalAndDrugHstory_Load_1(object sender, EventArgs e)
{
conn.Open();
string qry = "Select * from medicalanddrughistory";
DataSet Dhistory = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(qry, conn);
adp.Fill(Dhistory);
dataGridView1.DataSource = Dhistory.Tables[0];
comboBoxOPIDSearch.DataSource = Dhistory.Tables[0];
comboBoxOPIDSearch.DisplayMember = "opid";
conn.Close();
}
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
textOPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[0].Value);
textIPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
textPatientName.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value);
textAddress.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value);
textProblem.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value);
textMedicineHistory.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value);
textPreviousDoctor.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value);
textPreviousHospital.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value);
textDoctorSpeciality.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value);
textDoctorID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[9].Value);
}
15
private void btnSearch_Click_1(object sender, EventArgs e)
{
conn.Open();
string query = "Select * from medicalanddrughistory where opid="+comboBoxOPIDSearch.Text+"";
SqlCommand cmd = new SqlCommand(query, conn);
SqlDataReader rdr= cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(rdr);
dataGridView1.DataSource = dt.DefaultView;
conn.Close();
}
private void btnAdd_Click(object sender, EventArgs e)
{
conn.Open();
//Implement Local transaction.
string strinsert = "Insert into medicalanddrughistory( IPID, PName, PAddress, PProblem, PMedicalHistory, PrevDoctor, PrevHospital, DoctorSpeciality, DoctorID) values('" + textIPID.Text + "', '" + textPatientName.Text + "', '" + textAddress.Text + "', '" + textProblem.Text + "', '" + textMedicineHistory.Text + "', '" + textPreviousDoctor.Text + "','" + textPreviousHospital.Text + "', '" + textDoctorSpeciality.Text + "', '" + textDoctorID.Text + "')";
SqlCommand cmd = new SqlCommand(strinsert, conn);
SqlTransaction tran = null;
try
{
//Sources of possible exception errors.
tran = conn.BeginTransaction();
SqlCommand cmd1 = new SqlCommand(strinsert, conn, tran);
cmd1.ExecuteNonQuery();
tran.Commit();
MessageBox.Show("Patient Information added Successfully.", "Info message");
16
}
catch (SqlException se)
{
//In case of Sql Exception.
MessageBox.Show("Error", se.Message);
tran.Rollback();
}
catch (System.Exception sysex)
{
//In case of Other Exception.
MessageBox.Show("Error in Transaction" + sysex.Message);
}
finally
{
//Display changes in DataGridView
SqlDataAdapter sda = new SqlDataAdapter("select * from medicalanddrughistory", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
//Finally close the connection.
conn.Close();
}
}
private void btnSave_Click(object sender, EventArgs e)
{
conn.Open();
string savedetails = textOPID.Text;
string strsave = "Update medicalanddrughistory set IPID='" + textIPID.Text + "', pname='" + textPatientName.Text + "', paddress='" + textAddress.Text + "', pproblem='" + textProblem.Text + "', pmedicalhistory='" + textMedicineHistory.Text + "', PrevDoctor='" +
17
textPreviousDoctor.Text + "',PrevHospital='" + textPreviousHospital.Text + "',Doctorspeciality='" + textDoctorSpeciality.Text + "',DoctorID='" + textDoctorID.Text + "' where opid =" + Convert.ToInt32(textOPID.Text) + "";
try
{
SqlCommand cmd = new SqlCommand(strsave, conn);
//cmd.Parameters.Add(new SqlParameter("@opid", savedetails));
cmd.ExecuteNonQuery();
SqlDataAdapter sda = new SqlDataAdapter(strsave, conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
catch (SqlException se)
{
MessageBox.Show("error in :" + se.Message);
}
catch (Exception ex)
{
MessageBox.Show("Unknown error Find it.\n" + ex.Message);
}
finally
{
conn.Close();
}
}
private void btnReset_Click(object sender, EventArgs e)
{
textIPID.Clear();
textOPID.Clear();
textPatientName.Clear();
18
textAddress.Clear();
textDoctorID.Clear();
textDoctorSpeciality.Clear();
textProblem.Clear();
textMedicineHistory.Clear();
textPreviousDoctor.Clear();
textPreviousHospital.Clear();
}
private void btnDelete_Click(object sender, EventArgs e)
{
conn.Open();
formDeleteConfirmation fdc = new formDeleteConfirmation();
DialogResult dr = fdc.ShowDialog();
if (dr == DialogResult.OK)
{
string deleterecord = textIPID.Text;
string strdelete = "Delete from medicalanddrughistory where ipid = @ipid";
SqlCommand cmd = new SqlCommand(strdelete, conn);
cmd.Parameters.Add(new SqlParameter("@ipid", deleterecord));
cmd.ExecuteNonQuery();
MessageBox.Show("Deleted");
SqlDataAdapter sda = new SqlDataAdapter("select * from medicalanddrughistory", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
conn.Close();
}
}
19
}
Diagnosis And Bills Form
The form's property set is given below:-
Property Name ValueForm:-Name formDiagnosisAndBillsText Diagnosis And BillsBackColor LightSteelBlueShowIcon FalseLabels:-Name labelIPIDText IPIDName labelOPIDText OPIDName labelDoctorIDText Doctor IDName labelDoctorSpecialityText Doctor SpecialityName labelPatientNameText Patient NameName labelTreatmentDetaislText Treatment DetailsName labelTreatmentCost
20
Text Treatment CostName labelFinalCostText Final CostName labelIPIDSearchText Mention IPID hereFont (--For all labels--) Times New Roman, 11.25pt,
style=BoldTextBox:-Name textOPIDName textIPIDName textDoctorIDName textDoctorSpecialityName textPatientNameName textTreatmentDetailsName textTreatmentCostName textFinalCostFont (--For all textboxes--) Times New Roman, 9.75ptComboBox:-Name comboBoxIPIDSearchGroupBox:-Name groupBoxSearchText Search an recordFont MicrosoftSansSerif,9.75ptDatGridView:-Name dataGridView1Buttons:-Name btnAddText AddFont Times New Roman, 14.25pt,
style=BoldFontColor DarkCyanName btnSaveText SaveFont Times New Roman, 14.25pt,
style=BoldFontColor GreenName btnResetText ResetFont Times New Roman, 14.25pt,
style=BoldFontColor ControlTextName btnDeleteText Delete!Font Times New Roman, 14.25pt,
style=BoldFontColor 192, 0, 0Name btnSearchText SearchFont Times New Roman, 14.25pt,
21
style=BoldFontColor MidnightBlue
The code written for this form is below:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Hospital_Management_Project
{
public partial class formDiagnosisAndBills : Form
{
SqlConnection conn;
public formDiagnosisAndBills()
{
InitializeComponent();
conn = new SqlConnection("data Source=kol-11274-mrsrv;Initial catalog=HospitalManagementSystem;User Id=student;Password=sql_2005");
}
private void formDiagnosisAndBills_Load(object sender, EventArgs e)
{
conn.Open();
string qry = "Select * from diagnosisandbills";
DataSet ds = new DataSet();
SqlDataAdapter sdp = new SqlDataAdapter(qry, conn);
sdp.Fill(ds);
22
dataGridView1.DataSource = ds.Tables[0];
comboBoxIPIDSearch.DataSource = ds.Tables[0];
comboBoxIPIDSearch.DisplayMember = "ipid";
conn.Close();
}
private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
textOPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[0].Value);
textIPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);
textDoctorID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value);
textDoctorSpeciality.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value);
textPatientName.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value);
textTreatmentDetails.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value);
textTreatmentCost.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value);
textFinalCost.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value);
}
private void btnAdd_Click(object sender, EventArgs e)
{
conn.Open();
string strinsert = "Insert into diagnosisandbills(opid, ipid, doctorid, doctorspeciality, pname, treatmentdetails, treatmentcost, finalcost) values('"+ Convert.ToInt32(textOPID.Text)+"','"+ textIPID.Text + "', '" + textDoctorID.Text + "', '" + textDoctorSpeciality.Text + "', '" + textPatientName.Text + "', '" + textTreatmentDetails.Text + "', '" + Convert.ToInt32(textTreatmentCost.Text) + "','" + Convert.ToInt32(textFinalCost.Text) + "')";
SqlCommand cmd = new SqlCommand(strinsert, conn);
SqlTransaction tran = null;
23
try
{
//Sources of possible exception errors.
tran = conn.BeginTransaction();
SqlCommand cmd1 = new SqlCommand(strinsert, conn, tran);
cmd1.ExecuteNonQuery();
tran.Commit();
MessageBox.Show("Patient Information added Successfully.", "Info message");
}
catch (SqlException se)
{
//In case of Sql Exception.
MessageBox.Show("Error", se.Message);
tran.Rollback();
}
catch (System.Exception sysex)
{
//In case of Other Exception.
MessageBox.Show("Error in Transaction" + sysex.Message);
}
finally
{
SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
//Finally close the connection.
conn.Close();
}
}
24
private void btnSave_Click(object sender, EventArgs e)
{
conn.Open();
// string savedetails = textIPID.Text;
try
{
string strsave ="update diagnosisandbills set doctorid='"+textDoctorID.Text+"',doctorspeciality='"+textDoctorSpeciality.Text+"',pname='"+textPatientName.Text+"',treatmentdetails='"+textTreatmentDetails.Text+"',treatmentcost="+textTreatmentCost.Text+",finalcost="+textFinalCost.Text+" where ipid='"+textIPID.Text+"'";
SqlCommand cmd = new SqlCommand(strsave, conn);
//cmd.Parameters.Add(new SqlParameter("@ipid", savedetails));
cmd.ExecuteNonQuery();
SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
catch (FormatException fx)
{
MessageBox.Show(fx.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
25
MessageBox.Show("Updation complete", "Update done.", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void btnReset_Click(object sender, EventArgs e)
{
textOPID.Clear();
textIPID.Clear();
textDoctorID.Clear();
textDoctorSpeciality.Clear();
textPatientName.Clear();
textTreatmentDetails.Clear();
textTreatmentCost.Clear();
textFinalCost.Clear();
}
private void btnDelete_Click(object sender, EventArgs e)
{
//If chosen record is to be deleted, then confirmation throws up asking the user to confirm the deleteion.
conn.Open();
formDeleteConfirmation fdc = new formDeleteConfirmation();
DialogResult dr = fdc.ShowDialog();
if (dr == DialogResult.OK)
{
string deleterecord = textIPID.Text;
string strdelete = "Delete from diagnosisandbills where ipid = @ipid";
SqlCommand cmd = new SqlCommand(strdelete, conn);
cmd.Parameters.Add(new SqlParameter("@ipid", deleterecord));
cmd.ExecuteNonQuery();
MessageBox.Show("Deleted");
26
SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
conn.Close();
}
private void btnSearch_Click(object sender, EventArgs e)
{
conn.Open();
string query = "Select * from diagnosisandbills where ipid='" + comboBoxIPIDSearch.Text + "'";
SqlCommand cmd = new SqlCommand(query, conn);
SqlDataReader rdr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(rdr);
dataGridView1.DataSource = dt.DefaultView;
conn.Close();
}
}
}
Create an Event or Circular
27
The form is shown above. The form's property set is given below:-
Property Name ValueForm:-Name formCreateAnEventOrCircularText Create an Event/CircularShowIcon FalseBackColor ControlLabel:-Name labelNameText NameName labelTitleText TitleName labelSerialNumberText Serial NumberName labelDescriptionText DescriptionFont (--Set for all labels--) Times New Roman, 9.75ptTextBox:-Name textNameName textTitleName textSerialNumberName textDescriptionFont (--Set for all textboxes--) Times New Roman, 9.75ptButtons:-Name btnCreateText Create
28
Font Times New Roman, 14.25pt, style=Bold
FontColor GreenName btnCancelText CancelFont Times New Roman, 14.25pt,
style=BoldFontColor 192, 0, 0
The code written in this form is:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Data.SqlClient;
namespace Hospital_Management_Project
{
public partial class formCreateAnEventOrCircular : Form
{
public formCreateAnEventOrCircular()
{
InitializeComponent();
}
private void btnCreate_Click(object sender, EventArgs e)
{
//Creates and XML file with the specified details.
XmlWriterSettings set = new XmlWriterSettings();
set.Indent = true;
set.IndentChars = " ";
set.NewLineOnAttributes = true;
29
using(XmlWriter write = XmlWriter.Create("D:\\Debi\\"+textName.Text+".xml", set))
{
write.WriteStartElement(textName.Text);
write.WriteAttributeString(textTitle.Text,textSerialNumber.Text);
write.WriteElementString("Details", textDescription.Text);
//ConformanceLevel.Fragment = ConformanceLevel.Fragment;
write.WriteEndElement();
write.Flush();
}
}
}
}
Delete Confirmation Form
The form's property set is given below:-
Property Name ValueForm:-Name formDeleteConfirmationText Confirm Delete RecordShowIcon FalseFont Times New Roman, 8.25ptLabel:-Name labelMessageText Are you sure to delete the
record? Press YES to confirm else press NO to keep the record.
Font Times New Roman, 11.25ptFontColor ControlTextButton:-
30
Name button1Text YESFont Times New Roman, 11.25pt,
style=Bold, UnderlineDialogResult OKName button2Text CancelFont Times New Roman, 11.25pt,
style=Bold, UnderlineDialogResult Cancel
* There is no code written for this form as it acts only when there the delete confirm message box is to be shown to delete the particular record.
Help Menu
Opens the Help File associated with the form. The help file shall be accessed either using F1 shortcut key or by clicking Exit menu.
Back-End coding using SQL Server
31
The back-end of the system is taken care using SQL Server 2005. A database named “HospitalManagementSystem” is created and two tables are created “Medicalanddrughistory” and “diagnosisandbills” are created.
Creating & Using the database
The commands are:-
/*Database creation*/
create database HospitalManagementSystem
To start using the database:-
use hospitalmanagementsystem
MedicineandDrugHistory table
The code to create the table is:-
create table MedicalAndDrugHistory
(
OPID int constraint pkopid primary key identity(1,1) not null, IPID char(10), PName char(25), PAddress char(50),
PProblem char(50), PMedicalHistory char(50), PrevDoctor char(25), PrevHospital char(25),
DoctorSpeciality char(20), DoctorID char(10)
);
The sample code to insert a record in the table:-
insert into medicalanddrughistory( IPID, PName, PAddress, PProblem, PMedicalHistory, PrevDoctor, PrevHospital, DoctorSpeciality, DoctorID)
values('ip0001', 'Daniel Fleming', '24, Herbon Apts', 'Viral Infection', 'Normal', null, null, 'General', 'D0123');
DiagnosisandBills table
The code to create the table is:-32
create table DiagnosisAndBills
(
32
OPID int constraint fkopid foreign key references medicalanddrughistory(opid),
IPID char(10), DoctorID char(10), DoctorSpeciality char(20), pname char(25),
TreatmentDetails char(100) not null, TreatmentCost int, FinalCost int
);
The sample code to create a record in the table:-
insert into diagnosisandbills
values(1, 'ip0001', 'do123', 'General', 'Daniel Fleming', 'Viral Infection', 20, 24);
33
Recommended