-
Notifications
You must be signed in to change notification settings - Fork 0
/
Summary.xaml.cs
284 lines (259 loc) · 8.55 KB
/
Summary.xaml.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
using ProjectK.ErgoMC.Assessment.classes;
using ProjectK.ErgoMC.Assessment.Library;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProjectK.ErgoMC.Assessment
{
/// <summary>
/// Interaction logic for Summary.xaml
/// </summary>
public partial class Summary : Window
{
private float num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0;
public float Number1
{
get { return this.num1; }
set { this.num1 = value; }
}
public float Number2
{
get { return this.num2; }
set { this.num2 = value; }
}
public float Number3
{
get { return this.num3; }
set { this.num3 = value; }
}
public float Number4
{
get { return this.num4; }
set { this.num4 = value; }
}
public float Number5
{
get { return this.num5; }
set { this.num5 = value; }
}
private float pnum1 = 0, pnum2 = 0, pnum3 = 0, pnum4 = 0, pnum5 = 0;
public float pNumber1
{
get { return this.pnum1; }
set { this.pnum1 = value; }
}
public float pNumber2
{
get { return this.pnum2; }
set { this.pnum2 = value; }
}
public float pNumber3
{
get { return this.pnum3; }
set { this.pnum3 = value; }
}
public float pNumber4
{
get { return this.pnum4; }
set { this.pnum4 = value; }
}
public float pNumber5
{
get { return this.pnum5; }
set { this.pnum5 = value; }
}
private float nnum1, nnum2, nnum3, nnum4, nnum5;
public float nnumber1
{
get { return this.nnum1; }
set { this.nnum1 = value; }
}
public float nnumber2
{
get { return this.nnum2; }
set { this.nnum2 = value; }
}
public float nnumber3
{
get { return this.nnum3; }
set { this.nnum3 = value; }
}
public float nnumber4
{
get { return this.nnum4; }
set { this.nnum4 = value; }
}
public float nnumber5
{
get { return this.nnum5; }
set { this.nnum5 = value; }
}
private float npnum1 = 0, npnum2 = 0, npnum3 = 0, npnum4 = 0, npnum5 = 0;
public float npnumber1
{
get { return this.npnum1; }
set { this.npnum1 = value; }
}
public float npnumber2
{
get { return this.npnum2; }
set { this.npnum2 = value; }
}
public float npnumber3
{
get { return this.npnum3; }
set { this.npnum3 = value; }
}
public float npnumber4
{
get { return this.npnum4; }
set { this.npnum4 = value; }
}
public float npnumber5
{
get { return this.npnum5; }
set { this.npnum5 = value; }
}
//case 1:
// this.description = "Neglible risk, no action required.";
// break;
// case 2:
// case 3:
// this.description = "Low risk, change may be needed.";
// break;
// case 4:
// case 5:
// case 6:
// case 7:
// this.description = "Medium risk,further investigation and change soon.";
// break;
// case 8:
// case 9:
// case 10:
// this.description = "High risk,investigate and implement change.";
// break;
// default:
// this.description = "Very high risk, implement change.";
// break;
public Summary()
{
Model m = new Model();
m.table = "reba";
float total = 0;
System.Data.DataTable t = m.selectQuery("SELECT final_score ,count(1) as number from reba GROUP By final_score");
foreach (DataRow row in t.Rows)
{
switch (Helpers.Convert(row["final_score"].ToString()))
{
case 1:
Number1 += Helpers.Convert(row["number"].ToString());
break;
case 2:
case 3:
Number2 += Helpers.Convert(row["number"].ToString());
break;
case 4:
case 5:
case 6:
case 7:
Number3 += Helpers.Convert(row["number"].ToString());
break;
case 8:
case 9:
case 10:
Number4 += Helpers.Convert(row["number"].ToString());
break;
default:
Number5 += Helpers.Convert(row["number"].ToString());
break;
}
}
total = (float)(num1 + num2 + num3 + num4 + num5);
pNumber1 = Number1 / total * 100;
pNumber2 = Number2 / total * 100;
pNumber3 = Number3 / total * 100;
pNumber4 = Number4 / total * 100;
pNumber5 = Number5 / total * 100;
float rulatotal = 0;
System.Data.DataTable rt = m.selectQuery("SELECT final_score ,count(1) as number from rula GROUP By final_score");
foreach (DataRow row in rt.Rows)
{
switch (Helpers.Convert(row["final_score"].ToString()))
{
case 1:
case 2:
nnumber1 += Helpers.Convert(row["number"].ToString());
break;
case 3:
case 4:
nnumber2 += Helpers.Convert(row["number"].ToString());
break;
case 5:
case 6:
nnumber3 += Helpers.Convert(row["number"].ToString());
break;
default:
nnumber4 += Helpers.Convert(row["number"].ToString());
break;
}
}
rulatotal = (float)(nnum1 + nnum2 + nnum3 + nnum4);
npnumber1 = nnumber1 / rulatotal * 100;
npnumber2 = nnumber2 / rulatotal * 100;
npnumber3 = nnumber3 / rulatotal * 100;
npnumber4 = nnumber4 / rulatotal * 100;
InitializeComponent();
DataContext = this;
}
//case 1:
// case 2:
// this.description = "Acceptable";
// break;
// case 3:
// case 4:
// this.description = "Investigate further.";
// break;
// case 5:
// case 6:
// this.description = "Investigate further and change soon.";
// break;
// default:
// this.description = "Investigate and change immediately";
// break;
//switch (final_score)
// {
// case 1:
// this.description = "Neglible risk, no action required.";
// break;
// case 2:
// case 3:
// this.description = "Low risk, change may be needed.";
// break;
// case 4:
// case 5:
// case 6:
// case 7:
// this.description = "Medium risk,further investigation and change soon.";
// break;
// case 8:
// case 9:
// case 10:
// this.description = "High risk,investigate and implement change.";
// break;
// default:
// this.description = "Very high risk, implement change.";
// break;
// }
}
}