|
@@ -15,9 +15,10 @@
|
|
|
ID транзакции: @transactionId
|
|
|
</p>
|
|
|
|
|
|
-<EditForm Model="@articleModel" OnValidSubmit="@HandleValidSubmit">
|
|
|
+<EditForm Model="@articleModel">
|
|
|
+ @*OnValidSubmit="@HandleValidSubmit"
|
|
|
<DataAnnotationsValidator />
|
|
|
- <ValidationSummary />
|
|
|
+ <ValidationSummary />*@
|
|
|
|
|
|
<h1>@header</h1>
|
|
|
<br>
|
|
@@ -58,7 +59,7 @@
|
|
|
</p>
|
|
|
<p>
|
|
|
<button class="btn btn-danger" type="button" @onclick="@Cancel">Отклонить</button>
|
|
|
- <button class="btn btn-danger" type="button" @onclick="@Verify">Утвердить</button>
|
|
|
+ <button class="btn btn-primary" type="button" @onclick="@Submit">Утвердить</button>
|
|
|
@*<button class="btn btn-primary" type="submit">Утвердить</button>*@
|
|
|
</p>
|
|
|
}
|
|
@@ -170,7 +171,7 @@
|
|
|
//header += $", uuid:{currentAcc.UUID}, name: {currentAcc.Name}, edits count:{count}, count by accid: {countbyid}";
|
|
|
}
|
|
|
|
|
|
- private async void HandleValidSubmit()
|
|
|
+ private async void Submit()
|
|
|
{
|
|
|
MySQLConnector dbCon = MySQLConnector.Instance();
|
|
|
long id = 0;
|
|
@@ -220,7 +221,7 @@
|
|
|
Console.WriteLine("transactionId found " + transactionId);
|
|
|
|
|
|
///tmp
|
|
|
- //editsCount = await articleModel.GetEditsCount(currentAcc.UUID);
|
|
|
+ editsCount = await articleModel.GetEditsCount(currentAcc.UUID);
|
|
|
modal.Open();
|
|
|
}
|
|
|
else
|
|
@@ -245,6 +246,81 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //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;
|