-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashboard.cs
115 lines (98 loc) · 3.62 KB
/
Dashboard.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HospitalManagementSystem
{
public partial class Dashboard : Form
{
public Dashboard()
{
InitializeComponent();
}
private void btnAddPatient_Click(object sender, EventArgs e)
{
btnAddPatient.ForeColor = Color.OrangeRed;
btnFullHistory.ForeColor = Color.Black;
btnHospital.ForeColor = Color.Black;
btnAddDiag.ForeColor = Color.Black;
panel1.Visible = true;
}
private void btnFullHistory_Click(object sender, EventArgs e)
{
btnAddPatient.ForeColor = Color.Black;
btnFullHistory.ForeColor = Color.OrangeRed;
btnHospital.ForeColor = Color.Black;
btnAddDiag.ForeColor = Color.Black;
}
private void btnAddDiag_Click(object sender, EventArgs e)
{
btnAddPatient.ForeColor = Color.Black;
btnFullHistory.ForeColor = Color.Black;
btnHospital.ForeColor = Color.Black;
btnAddDiag.ForeColor = Color.OrangeRed;
}
private void btnHospital_Click(object sender, EventArgs e)
{
btnAddPatient.ForeColor = Color.Black;
btnFullHistory.ForeColor = Color.Black;
btnHospital.ForeColor = Color.OrangeRed;
btnAddDiag.ForeColor = Color.Black;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
private void Dashboard_Load(object sender, EventArgs e)
{
panel1.Visible = false;
}
private void label9_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
try
{
String name = txtName.Text;
String address = txtAddress.Text;
Int64 contact = Convert.ToInt64(txtContact.Text);
int age = Convert.ToInt32(txtAge.Text);
String gender = comboGender.Text;
String blood = txtBlood.Text;
String any = txtAny.Text;
int pid = Convert.ToInt32(txtPid.Text);
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source =LAPTOP-8REHB37C\\SQLEXPRESS; database = hospital_db_2; integrated security = True";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into AddPatient values ('" + name + "','" + address + "','" + contact + "','" + age + "','" + gender + "','" + blood + "','" + any + "','" + pid + "')";
SqlDataAdapter DA = new SqlDataAdapter(cmd);
DataSet DS = new DataSet();
DA.Fill(DS);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
txtName.Clear();
txtAddress.Clear();
txtContact.Clear();
txtAge.Clear();
txtBlood.Clear();
txtAny.Clear();
txtPid.Clear();
comboGender.ResetText();
MessageBox.Show("New Patient Saved");
}
}
}