-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasses.cshtml
57 lines (57 loc) · 1.91 KB
/
classes.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
@{
Layout = "~/_xuejiLayout.cshtml";
if (Session["name"] == null || Session["username"] == null)
{
Response.Redirect("~/#.cshtml");
}
var db = Database.Open("ctXueji");
var list = "select *from classes inner join majors on classes.majors_id = majors.id inner join teachers on classes.teachers_id = teachers.id";
}
<script>
$(document).ready(function () {
$('#table_id').DataTable();
});
</script>
@if (Convert.ToInt16(Session["authority"]) == 2)
{
<a class="btn btn-info" href="~/classes_add.cshtml">新增班级</a>
}
@if (Convert.ToInt16(Session["authority"]) == 3)
{
list += " where teachers_name = " + "'" + Session["name"] + "'";
}
<table id="table_id" class="table table-striped table-bordered">
<thead>
<tr class="t">
<th>班级</th>
<th>辅导员</th>
@if (Convert.ToInt16(Session["authority"]) == 2)
{
<th>操作</th>
}
</tr>
</thead>
<tbody>
@foreach (var row in db.Query(list))
{
<tr class="t">
@if (Convert.ToInt16(Session["authority"]) >= 2)
{
<td class="center"><a href="~/students.cshtml?classe_id=@row.id">@row.classes_year@row.majors_name</a></td>
}
else
{
<td class="center">@row.classes_year@row.majors_name</td>
}
<td class="center">@row.teachers_name</td>
@if (Convert.ToInt16(Session["authority"]) == 2)
{
<td class="center">
<a class="btn btn-danger" href="~/classes_del.cshtml?id=@row.id">删除</a>
<a class="btn btn-primary" href="~/classes_edit.cshtml?id=@row.id">修改</a>
</td>
}
</tr>
}
</tbody>
</table>