-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpDatePatient.aspx.cs
123 lines (94 loc) · 3.81 KB
/
UpDatePatient.aspx.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
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
public partial class UpDatePatient : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Patient> listPatient = new List<Patient>();
try
{
if (!IsPostBack)
{
ListItem item = new ListItem();
DBservices dbs = new DBservices();
List<Item> itemList = new List<Item>();
itemList = dbs.getItem();
foreach (Item x in itemList)
{
if (x.Category == "מחטים")
DDneedle.Items.Add(x.Name);
else
if (x.Category == "סליל")
DDcoil.Items.Add(x.Name);
else
if (x.Category == "שקית עירוי")
DDinfusionBag.Items.Add(x.Name);
else
if (x.Category == "תמיסה")
DDsolutions.Items.Add(x.Name);
}
DropDownList DDL = sender as DropDownList;
NameValueCollection coll = Request.QueryString;
string IdPatient = coll["P_id"];
listPatient = dbs.InfoPatient(IdPatient);
foreach (Patient x in listPatient)
{
Label lbName = new Label();
lbName.Text = x.Name;
PHPatientName.Controls.Add(lbName);
Label lbNum = new Label();
lbNum.Text = x.Num;
PHPatientNum.Controls.Add(lbNum);
Label lbID = new Label();
lbID.Text = x.P_id;
PHPatientID.Controls.Add(lbID);
DDPatientKupah.SelectedValue = x.Kupah;
if (x.Zantar == "False")
DDPatientZantar.SelectedValue = "לא";
else
DDPatientZantar.SelectedValue = "כן";
DDneedle.SelectedValue = x.Needle;
DDcoil.SelectedValue = x.Coil;
DDinfusionBag.SelectedValue = x.InfusionBag;
DDsolutions.SelectedValue = x.Solutions;
}
}
}
catch (Exception ex)
{
ErrHandler.WriteError(ex.Message);
Response.Write("ארעה שגיאה");
}
}
protected void ButtonPatient_Click(object sender, EventArgs e)
{
DBservices dbs = new DBservices();
try
{
NameValueCollection coll = Request.QueryString;
string ID = coll["P_id"];
string Kupah = (DDPatientKupah.SelectedItem).ToString();
string Zantar = (DDPatientZantar.SelectedItem).ToString();
if (Zantar == "כן")
Zantar = "1";
else
Zantar = "0";
string needle = (DDneedle.SelectedItem).ToString();
string coil = (DDcoil.SelectedItem).ToString();
string infusionBag = (DDinfusionBag.SelectedItem).ToString();
string solutions = (DDsolutions.SelectedItem).ToString();
dbs.UpDatePatient(ID, Kupah, Zantar,needle,coil,infusionBag,solutions);
Response.Redirect("PatientList.aspx");
}
catch (Exception ex)
{
ErrHandler.WriteError(ex.Message);
Response.Write("קיימת בעיה אנא נסה שנית מאוחר יותר");
}
}
}