Verifying.razor 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. @page "/verifying"
  2. @using System.ComponentModel.DataAnnotations;
  3. @using System.Linq;
  4. @using System.Reflection;
  5. @attribute [Authorize]
  6. <div class="tabs__content">
  7. <div class="tabs__controls">
  8. <a href="DocEdit" class="tabs__btn">Загрузка материалов</a>
  9. <a href="Verifying" class="tabs__btn tabs__btn_active">Верификация</a>
  10. <a class="tabs__btn">Библиотеки</a>
  11. <a class="tabs__btn">Заказы</a>
  12. </div>
  13. <div class="upload">
  14. <h2 class="upload__title">Аккаунт - Квалификация</h2>
  15. </div>
  16. <table class="table">
  17. <thead>
  18. <tr>
  19. <th>№</th>
  20. @*<th>Файл</th>*@
  21. <th>Название</th>
  22. <th>Дата издания</th>
  23. @*<th>Авторы</th>*@
  24. <th>Инициатор</th>
  25. <th>Верификатор</th>
  26. <th>Статус</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. @foreach (var articleModel in articleModels)
  31. {
  32. <tr>
  33. <td>@(counter++)</td>
  34. @*<td>@articleModel.Value.Filename</td>*@
  35. <td><a href="@($"/docedit/{articleModel.Key}")">@articleModel.Value.Name</a></td>
  36. <td>@articleModel.Value.PublishDate.ToString("d")</td>
  37. @*<td>@articleModel.Value.Authors</td>*@
  38. <td><center> - </center></td>
  39. <td><center> - </center></td>
  40. <td>@GetDisplayName(articleModel.Value.Status)</td>
  41. </tr>
  42. }
  43. </tbody>
  44. </table>
  45. </div>
  46. @code {
  47. private Dictionary<int, Models.ArticleModel> articleModels;
  48. private int counter = 1;
  49. protected override async Task OnInitializedAsync()
  50. {
  51. MySQLConnector dbCon = MySQLConnector.Instance();
  52. string stringSQL = $"SELECT a.id, filename, article_name, date_publish, authors, ah.action_type " +
  53. $"FROM articles a " +
  54. $"LEFT JOIN actions_history ah ON a.id = ah.article_id " +
  55. $"AND EXISTS (SELECT 1 FROM actions_history ah1 WHERE ah.article_id = ah1.article_id HAVING MAX(ah1.date_add) = ah.date_add) " +
  56. $"ORDER BY a.id";
  57. articleModels = await dbCon.SQLSelectArticles(stringSQL);
  58. dbCon.Close();
  59. //status = results;
  60. }
  61. private static string GetDisplayName(Enum enumValue)
  62. {
  63. return enumValue.GetType()
  64. .GetMember(enumValue.ToString())
  65. .First()
  66. .GetCustomAttribute<DisplayAttribute>()
  67. .GetName();
  68. }
  69. }