-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails.cshtml
114 lines (104 loc) · 4.08 KB
/
details.cshtml
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
@{
Layout = "~/_xuejiLayout.cshtml";
if (Session["name"] == null || Session["username"] == null)
{
Response.Redirect("~/#.cshtml");
}
var cid = Request.QueryString["cid"];
var coid = Request.QueryString["coid"];
var exid = Request.QueryString["exid"];
var name = Request.QueryString["name"];
var au = Convert.ToInt16(Session["authority"]);
var db = Database.Open("ctXueji");
var list = "select * from scores where exams_id = " + exid;
var stu_value = db.QuerySingle(list);
var dic_value = Functions.StringToDictionary(stu_value.students_value);
if (IsPost)
{
var exid1 = Request.Form["exid"];
var value = Request.Form["value"];
string temp = value;
string[] temparry = temp.Split(',');
var sid = Request.Form["sid"];
string temp1 = sid;
string[] temparry1 = temp1.Split(',');
var b = temparry.Count();
Dictionary<int, int> student_value = new Dictionary<int, int>();
for (int x = 0; x < b; x++)
{
student_value.Add(Convert.ToInt16(temparry1[x]), Convert.ToInt16(temparry[x]));
}
var update = "update scores set students_value = @0 where exams_id = @1";
db.Execute(update, Functions.DictionaryToString(student_value), exid1);
Response.Redirect("~/details.cshtml?cid=" + cid + "&exid=" + exid + "&coid=" + coid);
}
var exams = "select *from exams where id=@0";
var row2 = db.QuerySingle(exams, exid);
int item = 0;
}
<i><a href="~/courses.cshtml">班级</a>->><a href="~/examsall.cshtml?cid=@cid&coid=@coid">考试信息</a>->><strong>当前(科目:@name,考试名称:@row2.exams_name)</strong></i><font color=green></font><br />
@if (au == 1)
{
<span style="color: orangered; size: 20px;">讲师成绩只能提交一次请谨慎操作!</span>
}
<form method="post">
<table class="table table-striped table-bordered table-hover bootstrap-datatable datatable">
<tr class="t">
<th>学生姓名</th>
<th>分数</th>
</tr>
@foreach (var row in dic_value)
{
var sid = exid;
var temp = row.Key;
var students = "select *from students where id = @0";
var row1 = db.QuerySingle(students, temp);
if (row1 == null)
{
continue;
}
<tr class="t">
<td class="center">@row1.students_name</td>
<td class="center">
@if (au == 2)
{
item = 1;
<div style="width:10em">
<input class="form-control" style="width:8em" type="text" id="value" name="value" value=@row.Value>
<input type="hidden" name="sid" id="sid" value=@temp />
</div>
}
else if (au == 1)
{
if (row.Value == 0)
{
item++;
<div style="width:10em">
<input class="form-control" style="width:8em" type="text" id="value" name="value" value=@row.Value>
<input type="hidden" name="sid" id="sid" value=@temp>
</div>
}
else
{
<input type="hidden" id="value" name="value" value=@row.Value>
<input type="hidden" name="sid" id="sid" value=@temp>
<span>@row.Value</span>
}
}
else
{
<span>@row.Value</span>
}
</td>
</tr>
}
</table>
<input type="hidden" name="exid" id="exid" value=@exid />
@if (au == 2 || au == 1)
{
if (item > 0)
{
<input id="button" class="btn" type="submit" value="确认" />
}
}
</form>