|
@@ -11,14 +11,10 @@
|
|
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
|
@using Microsoft.AspNetCore.Identity;
|
|
|
@inject UserManager<IdentityUser> UserManager;
|
|
|
-<p>
|
|
|
- ID транзакции: @transactionId
|
|
|
-</p>
|
|
|
|
|
|
-<EditForm Model="@articleModel">
|
|
|
- @*OnValidSubmit="@HandleValidSubmit"
|
|
|
+<EditForm Model="@articleModel" OnValidSubmit="@HandleValidSubmit">
|
|
|
<DataAnnotationsValidator />
|
|
|
- <ValidationSummary />*@
|
|
|
+ <ValidationSummary />
|
|
|
|
|
|
<h1>@header</h1>
|
|
|
<br>
|
|
@@ -59,8 +55,7 @@
|
|
|
</p>
|
|
|
<p>
|
|
|
<button class="btn btn-danger" type="button" @onclick="@Cancel">Отклонить</button>
|
|
|
- <button class="btn btn-primary" type="button" @onclick="@Submit">Утвердить</button>
|
|
|
- @*<button class="btn btn-primary" type="submit">Утвердить</button>*@
|
|
|
+ <button class="btn btn-primary" type="submit">Утвердить</button>
|
|
|
</p>
|
|
|
}
|
|
|
<p>Статус: @status</p>
|
|
@@ -73,16 +68,13 @@
|
|
|
ID транзакции: @transactionId
|
|
|
</p>
|
|
|
<p>
|
|
|
- Инициатор: <mark>@initiatorAcc.Name</mark> Сумма: овердофига <b>ETH</b><br>
|
|
|
+ Инициатор: <mark>@initiatorAcc.Name</mark> Сумма: @(articleModel.Rating*5) <b>WEI</b><br>
|
|
|
Рейтинг статьи: @articleModel.Rating<br>
|
|
|
</p>
|
|
|
<p>
|
|
|
- Верификатор: <mark>@currentAcc.Name</mark> Сумма: овердофига <b>ETH</b><br>
|
|
|
+ Верификатор: <mark>@currentAcc.Name</mark> Сумма: @editsCount <b>WEI</b><br>
|
|
|
Кол-во исправлений: @editsCount
|
|
|
</p>
|
|
|
- <p>
|
|
|
- Вознаграждение системы: овердофига <b>ETH</b>.
|
|
|
- </p>
|
|
|
</Body>
|
|
|
<Footer>
|
|
|
@*<button type="button" class="btn btn-primary">Save changes</button>*@
|
|
@@ -164,14 +156,16 @@
|
|
|
header = "Загрузка материала";
|
|
|
|
|
|
|
|
|
- InitializeAccount();
|
|
|
+ await InitializeAccount();
|
|
|
|
|
|
//int count = await articleModel.GetEditsCount();
|
|
|
//int countbyid = await articleModel.GetEditsCount(currentAcc.UUID);
|
|
|
//header += $", uuid:{currentAcc.UUID}, name: {currentAcc.Name}, edits count:{count}, count by accid: {countbyid}";
|
|
|
}
|
|
|
|
|
|
- private async void Submit()
|
|
|
+
|
|
|
+
|
|
|
+ private async Task HandleValidSubmit()
|
|
|
{
|
|
|
MySQLConnector dbCon = MySQLConnector.Instance();
|
|
|
long id = 0;
|
|
@@ -246,81 +240,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //private async void HandleValidSubmit()
|
|
|
- //{
|
|
|
- // MySQLConnector dbCon = MySQLConnector.Instance();
|
|
|
- // long id = 0;
|
|
|
- // string stringSQL;
|
|
|
-
|
|
|
- // if (docID > 0)
|
|
|
- // {
|
|
|
- // id = docID;
|
|
|
- // stringSQL = $"UPDATE articles " +
|
|
|
- // $"SET filename='{articleModel.Filename}', article_name='{articleModel.Name}', authors='{articleModel.Authors}', " +
|
|
|
- // $"date_publish='{articleModel.PublishDate.ToString("yyyy-MM-dd")}', annotation='{articleModel.Annotation}', " +
|
|
|
- // $"keywords='{articleModel.Keywords}', rating={articleModel.Rating} " +
|
|
|
- // $"WHERE id={docID}";
|
|
|
- // dbCon.SQLInsert(stringSQL);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // stringSQL = $"INSERT INTO articles (filename, article_name, authors, date_publish, annotation, keywords) " +
|
|
|
- // $"VALUES ('{articleModel.Filename}', '{articleModel.Name}', '{articleModel.Authors}', '{articleModel.PublishDate.ToString("yyyy-MM-dd")}'," +
|
|
|
- // $"'{articleModel.Annotation}', '{articleModel.Keywords}')";
|
|
|
- // id = dbCon.SQLInsert(stringSQL);
|
|
|
- // }
|
|
|
-
|
|
|
- // ///temp
|
|
|
- // int action_type = docID > 0 ? 2 : 1;
|
|
|
-
|
|
|
- // stringSQL = $"INSERT INTO actions_history (article_id, action_type, acc_id) " +
|
|
|
- // $"VALUES ('{id}', '{action_type}', '{currentAcc.UUID}')";
|
|
|
- // dbCon.SQLInsert(stringSQL);
|
|
|
-
|
|
|
- // Dictionary<string, PropertyInfo> propDict = Compare.SimpleCompare<ArticleModel>(articleModel, articleModelClone);
|
|
|
- // foreach (KeyValuePair<string, PropertyInfo> prop in propDict)
|
|
|
- // {
|
|
|
- // //Console.WriteLine($"property name: {prop.Key}, value: {prop.Value.GetValue(articleModel, null)}");
|
|
|
-
|
|
|
- // stringSQL = $"INSERT INTO articles_edit_log (article_id, acc_id, field_name, field_prevvalue, field_newvalue) " +
|
|
|
- // $"VALUES ('{id}', '{currentAcc.UUID}', '{prop.Key}', '{prop.Value.GetValue(articleModelClone, null)}', '{prop.Value.GetValue(articleModel, null)}')";
|
|
|
- // dbCon.SQLInsert(stringSQL);
|
|
|
- // }
|
|
|
-
|
|
|
- // dbCon.Close();
|
|
|
-
|
|
|
- // if (docID > 0)
|
|
|
- // {
|
|
|
- // status = propDict.Count > 0 ? "All changes saved, article has veryfied." : "Article verifyed without any changes.";
|
|
|
- // transactionId = await Verify();
|
|
|
- // Console.WriteLine("transactionId found " + transactionId);
|
|
|
-
|
|
|
- // ///tmp
|
|
|
- // editsCount = await articleModel.GetEditsCount(currentAcc.UUID);
|
|
|
- // modal.Open();
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // string fullpath = Path.Combine(storageFolderPath, $"{id}_{articleModel.Filename}");
|
|
|
- // Directory.CreateDirectory(storageFolderPath);
|
|
|
- // FileStream fs = new(fullpath, FileMode.Create, FileAccess.Write);
|
|
|
- // memoryStream.Position = 0;
|
|
|
- // await memoryStream.CopyToAsync(fs);
|
|
|
-
|
|
|
- // Console.WriteLine($"User has saved new article data, {id}_{articleModel.Filename}, memory size:{memoryStream.Length}b, file size: {fs.Length}b");
|
|
|
- // memoryStream.Close();
|
|
|
- // fs.Close();
|
|
|
-
|
|
|
- // status = "New article data saved.";
|
|
|
-
|
|
|
- // bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Хотите загрузить еще статью?");
|
|
|
- // if (confirmed)
|
|
|
- // NavigationManager.NavigateTo("docedit", true);
|
|
|
- // else
|
|
|
- // NavigationManager.NavigateTo("");
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
private async Task HandleSelection(InputFileChangeEventArgs e)
|
|
|
{
|
|
|
IBrowserFile file = e.File;
|
|
@@ -338,7 +257,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async void Cancel()
|
|
|
+ private async Task Cancel()
|
|
|
{
|
|
|
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Вы уверены, что хотите отклонить статью?");
|
|
|
if (confirmed)
|
|
@@ -348,7 +267,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async void InitializeAccount()
|
|
|
+ public async Task InitializeAccount()
|
|
|
{
|
|
|
AccountModel.Current = await GetCurrentAcc();
|
|
|
Console.WriteLine("InitializeAccount in DocEdit " + AccountModel.Current.Name);
|