-
Notifications
You must be signed in to change notification settings - Fork 0
/
HealthTracking.aspx.cs
140 lines (128 loc) · 4.78 KB
/
HealthTracking.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class HealthTracking : System.Web.UI.Page
{
clsHealthInfo HeInfo = new clsHealthInfo();
clsHealthInfo he = new clsHealthInfo();
DataTable dl;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadFields();
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(Session["UserId"]);
HeInfo.Age = txtAge.Text;
string _bmi = "",_sgr = "",_plt = "",_chlstrl = "";
double _bmi_p = (Convert.ToDouble(txtWt.Text) * 100) / (Convert.ToDouble(txtHt.Text) * 2);
if (_bmi_p < 16)
{
_bmi = "Severe Thinness";
}
else if (_bmi_p >= 16 && _bmi_p < 17)
{
_bmi = "Moderate Thinness";
}
else if (_bmi_p >= 17 && _bmi_p < 18.5)
{
_bmi = "Mild Thinness";
}
else if (_bmi_p >= 18.5 && _bmi_p < 25)
{
_bmi = "Normal";
}
else if (_bmi_p >= 25 && _bmi_p < 30)
{
_bmi = "Overweight";
}
else if (_bmi_p >= 30 && _bmi_p < 35)
{
_bmi = "Obese Class I";
}
else if (_bmi_p >= 35 && _bmi_p < 40)
{
_bmi = "Obese Class II";
}
else if (_bmi_p >= 40)
{
_bmi = "Obese Class III";
}
double _sgr_v = (Convert.ToDouble(txtSgrLvl.Text));
double _plt_v = (Convert.ToDouble(txtPlt.Text));
double _chlstrl_v = (Convert.ToDouble(txtChLvl.Text));
if(_sgr_v < 70)
{
_sgr = "Sugar Level (" + _sgr_v + "mg/dL) falls below the normal (70 - 140 mg/dL) range! Possibile Hypoglycemia.";
}
else if (_sgr_v > 140 )
{
_sgr = "Sugar Level (" + _sgr_v + "mg/dL) exceeds normal (70 - 140 mg/dL) range! Possibile Hyperglycemia.";
}
else
{
_sgr = "Sugar Level (" + _sgr_v + "mg/dL) is within the normal (70 - 140 mg/dL) range.";
}
if (_plt_v < 1.5)
{
_plt = "Platelet count (" + _plt_v + "lakh/microL) falls below the normal (1.5 - 4 lakh/microL) range! Possible Thrombocytopenia.";
}
else if (_plt_v > 4)
{
_plt = "Platelet count (" + _plt_v + "lakh/microL) exceeds normal (1.5 - 4 lakh/microL) range! Possible Thrombocytosis.";
}
else
{
_plt = "Platelet count (" + _plt_v + "lakh/microL) is within the normal (1.5 - 4 lakh/microL) range.";
}
if(_chlstrl_v < 190)
{
_chlstrl = "Cholestrol level (" + _chlstrl_v + "mg/dL) falls below the normal (200 mg/dL) range!";
}
else if(_chlstrl_v > 210)
{
_chlstrl = "Cholestrol level (" + _chlstrl_v + "mg/dL) exceeds the normal (200 mg/dL) range! Possibility of Hyperlipidemia/Hypercholestrolemia.";
}
else
{
_chlstrl = "Cholestrol level (" + _chlstrl_v + "mg/dL) is within the normal (200 mg/dL) range.";
}
txtGo.Text = "Records Updated!";
txtGo.Text = txtGo.Text + Environment.NewLine + "BMI is " + _bmi_p.ToString("0.00") + " kg/m2 - " + _bmi + Environment.NewLine + "Sugar Level is " + _sgr_v.ToString("0.00") + " mg/dL - " + _sgr + Environment.NewLine + "Platelet is " + _plt_v.ToString("0.00") + " lakh/microL of blood - " + _plt + Environment.NewLine + "Cholestrol is " + _chlstrl_v.ToString("0.00") + " mg/dL - " + _chlstrl;
HeInfo.Age = txtAge.Text;
HeInfo.Height = txtHt.Text;
HeInfo.Weight = txtWt.Text;
HeInfo.HeartRate = txtHrtRt.Text;
HeInfo.SugarLevel = txtSgrLvl.Text;
HeInfo.Cholestrol = txtChLvl.Text;
HeInfo.Platelet = txtPlt.Text;
HeInfo.trackHealth(id);
loadFields();
}
protected void loadFields()
{
if (Session["UserId"] != null)
{
he.UserId = Session["UserId"].ToString();
dl = he.showHealthUsr();
txtHt.Text = dl.Rows[0]["HT_Height"].ToString();
txtWt.Text = dl.Rows[0]["HT_Weight"].ToString();
txtAge.Text = dl.Rows[0]["HT_Age"].ToString();
txtChLvl.Text = dl.Rows[0]["HT_Cholestrol"].ToString();
txtHrtRt.Text = dl.Rows[0]["HT_HeartRate"].ToString();
txtPlt.Text = dl.Rows[0]["HT_Platelet"].ToString();
txtSgrLvl.Text = dl.Rows[0]["HT_SugarLevel"].ToString();
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Session Expired! Please login again.');window.location ='Login.aspx';", true);
}
}
}