Advertisement
Guest User

Untitled

a guest
Jan 15th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. @Scripts.Render("~/bundles/jquery")
  2. @Scripts.Render("~/bundles/bootstrap")
  3. @model ClassDeclarationsThsesis.Models.ClassesViewViewModel
  4.  
  5.  
  6. @{
  7. ViewBag.Title = "ClassesView";
  8. }
  9.  
  10. <h2>ClassesView</h2>
  11.  
  12. <select id="sel">
  13. <option value="week">Current week</option>
  14. <option value="total">Total</option>
  15. </select>
  16.  
  17. @{
  18. int i = 0;
  19. int inside = 0;
  20.  
  21.  
  22. }
  23.  
  24.  
  25. @using (Html.BeginForm("ClassesView", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
  26. {
  27. List<SelectListItem> listItems1 = new List<SelectListItem>();
  28.  
  29.  
  30. <div id="week">
  31. <table border="1" width="500">
  32. <tr>
  33. <th>Surname</th>
  34. <th>Name</th>
  35. @foreach (var task in Model.current)
  36. {
  37. <th>@task.name</th>
  38. }
  39. <th>Total</th>
  40. </tr>
  41. @foreach (var user in Model.curr_users)
  42. {
  43. if (user.user_type.Replace(" ", String.Empty) == 1.ToString())
  44. {
  45.  
  46. <tr>
  47. <th>@user.surname</th>
  48. <th>@user.name</th>
  49.  
  50.  
  51. @foreach (var task in Model.current)
  52. {
  53. foreach (var grade in Model.grading)
  54. {
  55. if (user.user_id == grade.user_id)
  56. {
  57. if (task.task_id == grade.task_id)
  58. {
  59. inside = task.value;
  60. i = i + task.value;
  61. }
  62.  
  63. }
  64.  
  65. }
  66. <th>@inside</th>
  67. inside = 0;
  68.  
  69. listItems1.Add(new SelectListItem
  70. {
  71. Text = task.name,
  72. Value = task.name,
  73. });
  74. }
  75.  
  76. <th>@i</th>
  77.  
  78. @Model.student_id = user.user_id;
  79. @Html.HiddenFor(m => m.class_id)
  80. @Html.HiddenFor(m=>m.student_id)
  81.  
  82.  
  83. <th>
  84. @Html.DropDownListFor(m => m.task_name, listItems1, new { @class = "form-control" })
  85. <th>
  86. <th>@Html.TextBoxFor(m=>m.points)</th>>
  87. <th><input type="submit" class="btn btn-default" value="Modify" /></th>
  88. </tr>
  89.  
  90. }
  91. i = 0;
  92. }
  93. </table>
  94.  
  95. </div>
  96.  
  97. }
  98.  
  99.  
  100.  
  101.  
  102. <div id="total">
  103. <table border="1" width="500">
  104. <tr>
  105. <th>Surname</th>
  106. <th>Name</th>
  107. @foreach (var task in Model.t)
  108. {
  109. <th>@task.name</th>
  110. }
  111. <th>Total</th>
  112. </tr>
  113. @foreach (var user in Model.curr_users)
  114. {
  115. if (user.user_type.Replace(" ", String.Empty) == 1.ToString())
  116. {
  117. <tr>
  118. <th>@user.surname</th>
  119. <th>@user.name</th>
  120.  
  121.  
  122. @foreach (var task in Model.t)
  123. {
  124. foreach (var grade in Model.grading)
  125. {
  126. if (user.user_id == grade.user_id)
  127. {
  128. if (task.task_id == grade.task_id)
  129. {
  130. inside = task.value;
  131. i = i + task.value;
  132. }
  133.  
  134. }
  135.  
  136. }
  137. <th>@inside</th>
  138.  
  139. inside = 0;
  140. }
  141.  
  142. <th>@i</th>
  143. </tr>}
  144. i = 0;
  145. }
  146. </table>
  147.  
  148. </div>
  149.  
  150.  
  151. <script type='text/javascript'>
  152.  
  153. $(function() {
  154.  
  155. $("#total").hide();
  156.  
  157. console.log($("#sel"));
  158. $("#sel")
  159. .change(function() {
  160.  
  161. var selectedItem = $(this).val();
  162.  
  163. if (selectedItem == "week") {
  164. $("#week").show();
  165. $("#total").hide();
  166. } else if (selectedItem == "total") {
  167. $("#total").show();
  168. $("#week").hide();
  169. }
  170.  
  171. });
  172. });
  173. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement