1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- @page "/verifying"
- @using System.ComponentModel.DataAnnotations;
- @using System.Linq;
- @using System.Reflection;
- @attribute [Authorize]
- <h1>Верификация</h1>
- <table class="table">
- <thead>
- <tr>
- <th>№</th>
- @*<th>Файл</th>*@
- <th>Название</th>
- <th>Дата издания</th>
- @*<th>Авторы</th>*@
- <th>Инициатор</th>
- <th>Верификатор</th>
- <th>Статус</th>
- </tr>
- </thead>
- <tbody>
- @foreach (var articleModel in articleModels)
- {
- <tr>
- <td>@(counter++)</td>
- @*<td>@articleModel.Value.Filename</td>*@
- <td><a href="@($"/docedit/{articleModel.Key}")">@articleModel.Value.Name</a></td>
- <td>@articleModel.Value.PublishDate.ToString("d")</td>
- @*<td>@articleModel.Value.Authors</td>*@
- <td><center> - </center></td>
- <td><center> - </center></td>
- <td>@GetDisplayName(articleModel.Value.Status)</td>
- </tr>
- }
- </tbody>
- </table>
- @code {
- private Dictionary<int, Models.ArticleModel> articleModels;
- private int counter = 1;
- protected override async Task OnInitializedAsync()
- {
- MySQLConnector dbCon = MySQLConnector.Instance();
- string stringSQL = $"SELECT a.id, filename, article_name, date_publish, authors, ah.action_type " +
- $"FROM articles a " +
- $"LEFT JOIN actions_history ah ON a.id = ah.article_id " +
- $"AND EXISTS (SELECT 1 FROM actions_history ah1 WHERE ah.article_id = ah1.article_id HAVING MAX(ah1.date_add) = ah.date_add) " +
- $"ORDER BY a.id";
- articleModels = await dbCon.SQLSelectArticles(stringSQL);
- dbCon.Close();
- //status = results;
- }
- private static string GetDisplayName(Enum enumValue)
- {
- return enumValue.GetType()
- .GetMember(enumValue.ToString())
- .First()
- .GetCustomAttribute<DisplayAttribute>()
- .GetName();
- }
- }
|