fork download
  1. @using System.Web.Mvc.Html
  2. @using System.Web.UI.HtmlControls
  3. @using DAL
  4. @using Microsoft.AspNet.Identity
  5. @using Model
  6. @using Ninject.Infrastructure.Disposal
  7. @model Model.Contest
  8.  
  9. @{
  10. var diff = 0;
  11. var contestId = Model.Id;
  12. }
  13. <link rel="stylesheet"
  14. href="https://c...content-available-to-author-only...e.com/ajax/libs/highlight.js/9.12.0/styles/androidstudio.min.css">
  15. <link href="~/Content/Watch.css" rel="stylesheet" />
  16. <div id="rbody">
  17. <button id ="ref">ref</button>
  18. <div>
  19. <h1 align="center">Contest - @Model.Name</h1>
  20. @if (Model.EndTime < DateTime.Now)
  21. {
  22. diff = -1;
  23. <h2>contest has Ended</h2>
  24. <ul class="nav nav-tabs" id="myTab" role="tablist">
  25. <li class="nav-item">
  26. <a class="nav-link active" id="problem-tab" data-toggle="tab" href="#problems" role="tab" aria-controls="home" aria-selected="true">Problems</a>
  27. </li>
  28. <li class="nav-item">
  29. <a class="nav-link" id="standings-tab" data-toggle="tab" href="#standings" role="tab" aria-controls="profile" aria-selected="false">Standings</a>
  30. </li>
  31. <li class="nav-item">
  32. <a class="nav-link" id="submissions-tab" data-toggle="tab" href="#submissions" role="tab" aria-controls="contact" aria-selected="false">Submissions</a>
  33. </li>
  34. </ul>
  35.  
  36. <div class="tab-content" id="myTabContent">
  37. <div class="tab-pane fade show active" id="problems" role="tabpanel" aria-labelledby="problem-tab">
  38.  
  39. Contest has ended. Go to Problem Section to up solve the problems
  40.  
  41. </div>
  42. <div class="tab-pane fade" id="standings" role="tabpanel" aria-labelledby="standings-tab">
  43. @Html.Partial("StandingPartial", Model)
  44. </div>
  45. <div class="tab-pane fade" id="submissions" role="tabpanel" aria-labelledby="submissions-tab">
  46. <h3>Submissions</h3>
  47. <table id="Submissions" class="table table-bordered table-hover">
  48.  
  49. @if (Model.Participants != null)
  50. {
  51. <thead>
  52. <tr>
  53. <th>Submission Problem</th>
  54. <th>Participant Name</th>
  55. <th>Compiler Comment</th>
  56. <th>Submission Time</th>
  57. </tr>
  58. </thead>
  59.  
  60. <tbody>
  61. @foreach (var item in Model.Submissions.OrderByDescending(t => t.SubmissionTime.Second))
  62. {
  63. if (item.IsContestTime == false)
  64. {
  65. continue;
  66. }
  67. var tim = (item.SubmissionTime - Model.StarTime).TotalSeconds;
  68. TimeSpan time = TimeSpan.FromSeconds(tim);
  69. string str = time.ToString(@"hh\:mm\:ss");
  70. var color = "btn";
  71. <tr>
  72. @if (item.Participant != null)
  73. {
  74. <td>
  75. @item.Problem.ProblemName
  76. </td>
  77. <td>
  78. @item.Participant.Id
  79. </td>
  80. <td>
  81. @if (item.IsProcessed == true && item.IsCompiledSuccessfully == false)
  82. {
  83. color = "btn btn-danger";
  84. item.CompilerComment = "Compilation Error";
  85. }
  86. else if (item.CompilerComment == "Accepted")
  87. {
  88. color = "btn btn-success";
  89. }
  90. else if (item.CompilerComment == "Wrong Answer" || item.CompilerComment == "Runtime Error" || item.CompilerComment == "Time Limit" || item.CompilerComment == "Runtime Error" || item.CompilerComment == "Memory Limit")
  91. {
  92. color = "btn btn-danger";
  93. }
  94. else if (item.CompilerComment == "Duplicate")
  95. {
  96. color = "btn btn-warning";
  97. }
  98. <button item-id-at="@item.Id" type="button" class="@color">
  99. @Html.DisplayFor(modelItem => item.CompilerComment)
  100. </button>
  101. </td>
  102. <td>@str</td>
  103. }
  104.  
  105. @*<td>
  106. @Html.DisplayFor(modelItem => item.TimeLimit)
  107. </td>
  108. <td></td>*@
  109. </tr>
  110. }
  111. </tbody>
  112. }
  113.  
  114. </table>
  115. </div>
  116. </div>
  117.  
  118.  
  119.  
  120. }
  121. else if (Model.StarTime > DateTime.Now)
  122. {
  123. <h2>contest has not started yet</h2>
  124. diff = (int) (Model.StarTime - DateTime.Now).TotalSeconds;
  125. var participant = this.Model.Participants.Where(c => c.Id == this.User.Identity.GetUserName()).Count();
  126. if (participant != 0)
  127. {
  128. <h3>You have registered for this contest</h3>
  129. }
  130. else
  131. {
  132. if (this.Model.Visible == true)
  133. {
  134. @Html.ActionLink("Registration", "RegistrationForContest",
  135. "Participant", new {id = Model.Id,}, htmlAttributes: new {@class = "btn btn-primary"})
  136. }
  137. else
  138. {
  139. <h3>contest is invite only.</h3>
  140. }
  141. }
  142. <div id="timer" data-time-id=@diff>
  143. <span id="days"></span>days
  144. <span id="hours"></span>hours
  145. <span id="minutes"></span>minutes
  146. <span id="seconds"></span>seconds
  147. </div>
  148. }
  149. else
  150. {
  151. diff = (int) (Model.EndTime - DateTime.Now).TotalSeconds;
  152. <div id="timer" data-time-id=@diff>
  153. <span id="days"></span>days
  154. <span id="hours"></span>hours
  155. <span id="minutes"></span>minutes
  156. <span id="seconds"></span>seconds
  157. </div>
  158.  
  159.  
  160. <ul class="nav nav-tabs" id="myTab" role="tablist">
  161. <li class="nav-item">
  162. <a class="nav-link active" id="problem-tab" data-toggle="tab" href="#problems" role="tab" aria-controls="home" aria-selected="true">Problems</a>
  163. </li>
  164. <li class="nav-item">
  165. <a class="nav-link" id="standings-tab" data-toggle="tab" href="#standings" role="tab" aria-controls="profile" aria-selected="false">Standings</a>
  166. </li>
  167. <li class="nav-item">
  168. <a class="nav-link" id="submissions-tab" data-toggle="tab" href="#submissions" role="tab" aria-controls="contact" aria-selected="false">Submissions</a>
  169. </li>
  170. </ul>
  171.  
  172. <div class="tab-content" id="myTabContent">
  173. <div class="tab-pane fade show active" id="problems" role="tabpanel" aria-labelledby="problem-tab">
  174.  
  175. <h3>Problems</h3>
  176. <table id="Problems" class="table table-bordered table-hover">
  177.  
  178. @if (Model.Problems != null)
  179. {
  180. <thead>
  181. <tr>
  182. <th>
  183. @Html.DisplayNameFor(model => model.Problems[0].ProblemName)
  184. </th>
  185. <th>
  186. @Html.DisplayNameFor(model => model.Problems[0].ProblemName)
  187. </th>
  188. <th>
  189. @Html.DisplayNameFor(model => model.Problems[0].ProblemName)
  190. </th>
  191.  
  192. <th>Utilitis</th>
  193. </tr>
  194. </thead>
  195.  
  196. <tbody>
  197. @foreach (var item in Model.Problems)
  198. {
  199. <tr>
  200. <td>
  201. @Html.ActionLink(item.ProblemName, "Details", "Problem", new {id = item.Id}, null)
  202. </td>
  203. <td>
  204. @Html.DisplayFor(modelItem => item.Score)
  205. </td>
  206. <td>
  207. @Html.DisplayFor(modelItem => item.TimeLimit)
  208. </td>
  209. <td></td>
  210.  
  211. </tr>
  212. }
  213. </tbody>
  214. }
  215.  
  216. </table>
  217.  
  218. </div>
  219. <div class="tab-pane fade" id="standings" role="tabpanel" aria-labelledby="standings-tab">
  220. @Html.Partial("StandingPartial", Model)
  221. </div>
  222. <div class="tab-pane fade" id="submissions" role="tabpanel" aria-labelledby="submissions-tab">
  223. <h3>Submissions</h3>
  224. <table id="Submissions" class="table table-bordered table-hover">
  225.  
  226. @if (Model.Participants != null)
  227. {
  228. <thead>
  229. <tr>
  230. <th>Submission Problem</th>
  231. <th>Participant Name</th>
  232. <th>Compiler Comment</th>
  233. <th>Submission Time</th>
  234. </tr>
  235. </thead>
  236.  
  237. <tbody>
  238. @foreach (var item in Model.Submissions.OrderByDescending(t => t.SubmissionTime.Millisecond))
  239. {
  240. if (item.IsContestTime == false)
  241. {
  242. continue;
  243. }
  244. var tim = (item.SubmissionTime - Model.StarTime).TotalSeconds;
  245. TimeSpan time = TimeSpan.FromSeconds(tim);
  246. string str = time.ToString(@"hh\:mm\:ss");
  247. var color = "btn";
  248. <tr>
  249. @if (item.Participant != null)
  250. {
  251. <td>
  252. @item.Problem.ProblemName
  253. </td>
  254. <td>
  255. @item.Participant.Id
  256. </td>
  257. <td>
  258. @if (item.IsProcessed == true && item.IsCompiledSuccessfully == false)
  259. {
  260. color = "btn btn-danger";
  261. item.CompilerComment = "Compilation Error";
  262. }
  263. else if (item.CompilerComment == "Accepted")
  264. {
  265. color = "btn btn-success";
  266. }
  267. else if (item.CompilerComment == "Wrong Answer" || item.CompilerComment == "Runtime Error" || item.CompilerComment == "Time Limit" || item.CompilerComment == "Runtime Error" || item.CompilerComment == "Memory Limit")
  268. {
  269. color = "btn btn-danger";
  270. }
  271. else if (item.CompilerComment == "Duplicate")
  272. {
  273. color = "btn btn-warning";
  274. }
  275. <button item-id-at="@item.Id" type="button" class="@color">
  276. @Html.DisplayFor(modelItem => item.CompilerComment)
  277. </button>
  278. </td>
  279. <td>
  280. @str
  281. </td>
  282. }
  283.  
  284. @*<td>
  285. @Html.DisplayFor(modelItem => item.TimeLimit)
  286. </td>
  287. <td></td>*@
  288. </tr>
  289. }
  290. </tbody>
  291. }
  292.  
  293. </table>
  294. </div>
  295. </div>
  296.  
  297. }
  298. <hr/>
  299.  
  300. </div>
  301. <p>
  302. @Html.ActionLink("Edit", "Edit", new {id = Model.Id}) |
  303. @Html.ActionLink("Back to List", "Index")
  304. </p>
  305. <div align="center">
  306.  
  307. </div>
  308. <div class="modal fade" id="myModal">
  309. <div class="modal-dialog">
  310. <div class="modal-content">
  311.  
  312. <!-- Modal Header -->
  313. <div class="modal-header">
  314. <h4 class="modal-title">Code</h4>
  315. <button type="button" class="close" data-dismiss="modal">&times;</button>
  316. </div>
  317.  
  318. <!-- Modal body -->
  319. <div class="modal-body">
  320. <pre><code id="codeset" class="cpp"> </code></pre>
  321.  
  322. </div>
  323.  
  324. <!-- Modal footer -->
  325. <div class="modal-footer">
  326. <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
  327. </div>
  328.  
  329. </div>
  330. </div>
  331. </div>
  332. </div>
  333. @section scripts
  334. {
  335. <script src="https://c...content-available-to-author-only...e.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
  336. <script src="https://c...content-available-to-author-only...e.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  337. <script src="~/Scripts/Encoder.js"></script>
  338. <script>hljs.initHighlightingOnLoad();</script>
  339. <script src="~/Scripts/watch.js"></script>
  340. <script src="~/Scripts/jquery.signalR-2.2.3.min.js"></script>
  341. <script src="~/signalr/hubs"></script>
  342. <script>
  343. var signalRHubInitialized = false;
  344. $(function () {
  345. InitializeSignalRHubStore();
  346. });
  347. $("#ref").click(function() {
  348. ReloadIndexPartial();
  349. });
  350. function InitializeSignalRHubStore() {
  351.  
  352. if (signalRHubInitialized)
  353. return;
  354.  
  355. try {
  356. var clientHub = $.connection.StandingHub;
  357.  
  358. clientHub.client.broadcastMessage = function (message) {
  359.  
  360. if (message === "Refresh")
  361. ReloadIndexPartial();
  362. };
  363.  
  364. $.connection.hub.start().done(function () {
  365. clientHub.server.initialize($("#NotifierEntity").val());
  366. signalRHubInitialized = true;
  367. });
  368.  
  369. } catch (err) {
  370. signalRHubInitialized = false;
  371. }
  372. };
  373. function ReloadIndexPartial() {
  374. $.post('@Url.Action("StandingPartial", "Contest", null, Request.Url.Scheme)')
  375. .done(function (response) {
  376. $("#standings").html(response)
  377. if (!signalRHubInitialized)
  378. InitializeSignalRHubStore();
  379. });
  380. };
  381.  
  382. </script>
  383. <script>
  384. setdata(@diff);
  385. </script>
  386. <script>
  387. var con = @contestId;
  388.  
  389. $(document).ready(function () {
  390. $('#Submissions button').click(function() {
  391. var obj = $(this);
  392. $.ajax({
  393. url: '@Url.RouteUrl("DefaultApi",
  394. new {httproute = "", controller = "Submission"})/' +
  395. obj.attr("item-id-at"),
  396. // < -- -- -- -- -- -- -- -- -- -- -- -- - > It 's represent url of api
  397. type: 'GET',
  398. // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - > we need to set whether we getting / posting the data
  399. dataType: 'json',
  400. // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > type of data
  401. success: function(data, textStatus, xhr) {
  402. //-- -- -- -- -- -- -- > here we can the result from data object
  403. var cn = Encoder.htmlEncode(data.code);
  404. $("#myModal").modal("toggle");
  405. $("#codeset").html(cn);
  406.  
  407. //document.getElementById("codeset").innerHTML("Hello");
  408. // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - > here you can proceed to get the data
  409. },
  410. error: function(xhr, textStatus, errorThrown) {
  411. console.log('Error in Database');
  412. // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - >
  413. //if any error caught
  414. }
  415. });
  416. });
  417. $("#Problems").DataTable();
  418. $("#Standings").DataTable();
  419. $("#Submissions").DataTable({
  420. "order": [[ 3, "desc" ]]
  421. } );
  422. $("#Problems .js-delete").on("click",
  423. function() {
  424. var button = $(this);
  425. var obj = $(this);
  426. var Url = "@Url.RouteUrl("DefaultApi",
  427. new {httproute = "", controller = "Problem"})/";
  428. bootbox.confirm("Are you sure to delete this problem?",
  429. function(result) {
  430. if (result) {
  431. $.ajax({
  432. url: Url + obj.attr("data-problem-id"),
  433. method: "DELETE",
  434. success: function() {
  435. button.parents("tr").remove();
  436. }
  437. });
  438. }
  439. });
  440.  
  441. });
  442. });
  443. </script>
  444. <script src="@Url.Content("~/Scripts/val.js")"></script>
  445. }
  446.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,1): error CS1525: Unexpected symbol `using'
prog.cs(9,2): error CS1646: Keyword, identifier, or string expected after verbatim specifier: @
prog.cs(105,30): error CS1646: Keyword, identifier, or string expected after verbatim specifier: @
prog.cs(109,0): error CS1646: Keyword, identifier, or string expected after verbatim specifier: @
prog.cs(284,30): error CS1646: Keyword, identifier, or string expected after verbatim specifier: @
prog.cs(288,0): error CS1646: Keyword, identifier, or string expected after verbatim specifier: @
prog.cs(344,9): error CS1056: Unexpected character `$'
prog.cs(347,9): error CS1056: Unexpected character `$'
prog.cs(356,33): error CS1056: Unexpected character `$'
prog.cs(364,17): error CS1056: Unexpected character `$'
prog.cs(365,49): error CS1056: Unexpected character `$'
prog.cs(374,13): error CS1056: Unexpected character `$'
prog.cs(374,20): error CS1012: Too many characters in character literal
prog.cs(376,21): error CS1056: Unexpected character `$'
prog.cs(389,9): error CS1056: Unexpected character `$'
prog.cs(390,13): error CS1056: Unexpected character `$'
prog.cs(390,15): error CS1012: Too many characters in character literal
prog.cs(391,27): error CS1056: Unexpected character `$'
prog.cs(392,17): error CS1056: Unexpected character `$'
prog.cs(393,26): error CS1012: Too many characters in character literal
prog.cs(394,76): error CS1012: Too many characters in character literal
prog.cs(397,27): error CS1012: Too many characters in character literal
prog.cs(399,31): error CS1012: Too many characters in character literal
prog.cs(404,25): error CS1056: Unexpected character `$'
prog.cs(405,25): error CS1056: Unexpected character `$'
prog.cs(411,37): error CS1012: Too many characters in character literal
prog.cs(417,13): error CS1056: Unexpected character `$'
prog.cs(418,13): error CS1056: Unexpected character `$'
prog.cs(419,13): error CS1056: Unexpected character `$'
prog.cs(422,13): error CS1056: Unexpected character `$'
prog.cs(424,34): error CS1056: Unexpected character `$'
prog.cs(425,31): error CS1056: Unexpected character `$'
prog.cs(426,58): error CS1010: Newline in constant
prog.cs(427,83): error CS1010: Newline in constant
prog.cs(431,33): error CS1056: Unexpected character `$'
Compilation failed: 35 error(s), 0 warnings
stdout
Standard output is empty