-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteachers.cshtml
72 lines (72 loc) · 2.3 KB
/
teachers.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
@{
Layout = "~/_xuejiLayout.cshtml";
if (Session["name"] == null || Session["username"] == null)
{
Response.Redirect("~/#.cshtml");
}
var db = Database.Open("ctXueji");
var list = "select *from teachers";
}
<script>
$(document).ready(function () {
$('#table_id').DataTable();
});
</script>
@if (Convert.ToInt16(Session["authority"]) == 2)
{
<a class="btn btn-info" href="~/teachers_add.cshtml">新增教师</a>
}
<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>
}
<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="~/teachers_edit.cshtml?id=@row.id">@row.teachers_name</a></td>
}
else
{
<td class="center">@row.teachers_name</td>
}
<td class="center">
@if (row.teachers_type == 1)
{
<a class="btn btn-success">讲师</a>
}
else if (row.teachers_type == 2)
{
<a class="btn btn-primary">辅导员</a>
}
else if (row.teachers_type == 3)
{
<a class="btn btn-warning">讲师+辅导员</a>
}
</td>
@if (Convert.ToInt16(Session["authority"]) == 2)
{
<td class="center"><a class="btn btn-danger" href="~/teachers_del.cshtml?id=@row.id">删除</a></td>
}
@if (row.status == 1)
{
<td class="center"><a class="btn btn-success">正常</a></td>
}
else
{
<td class="center"><a class="btn btn-danger">离职</a></td>
}
</tr>
}
</tbody>
</table>