|
@@ -79,10 +79,11 @@
|
|
|
|
|
|
const string FOLDER_NAME = "articles_storage";
|
|
|
const long MAX_FILE_SIZE = 5120000; //bytes
|
|
|
- const int ACC_ID = 1; //temp
|
|
|
+ //const int ACC_ID = 1; //temp
|
|
|
|
|
|
ArticleModel oldArticleModel = new();
|
|
|
ArticleModel articleModel = new();
|
|
|
+ AccountModel currentAcc = new();
|
|
|
string status;
|
|
|
string header;
|
|
|
string storageFolderPath;
|
|
@@ -107,6 +108,8 @@
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
{
|
|
|
+ currentAcc = await GetCurrentAcc();
|
|
|
+
|
|
|
string path = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
storageFolderPath = (Path.Combine(path, FOLDER_NAME));
|
|
|
|
|
@@ -124,14 +127,18 @@
|
|
|
oldArticleModel = await dbCon.SQLSelectArticle(stringSQL);
|
|
|
articleModel = (ArticleModel)oldArticleModel.Clone();
|
|
|
|
|
|
- status = $"Article ID={docID} loaded, status: {articleModel.Status}";
|
|
|
+ string initiator = await articleModel.GetInitiatorUUID();
|
|
|
+ status = $"Article ID={docID} loaded, status: {articleModel.Status}, initiatorUUID: {await articleModel.GetInitiatorUUID()}";
|
|
|
}
|
|
|
else
|
|
|
header = "Загрузка материала";
|
|
|
|
|
|
|
|
|
InitializeAccount();
|
|
|
- //header += $", uuid:{account.UUID}, name: {account.Name}";
|
|
|
+
|
|
|
+ //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 HandleValidSubmit()
|
|
@@ -158,10 +165,11 @@
|
|
|
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}', '{ACC_ID}')";
|
|
|
+ $"VALUES ('{id}', '{action_type}', '{currentAcc.UUID}')";
|
|
|
dbCon.SQLInsert(stringSQL);
|
|
|
|
|
|
Dictionary<string, PropertyInfo> propDict = Compare.SimpleCompare<ArticleModel>(articleModel, oldArticleModel);
|
|
@@ -170,7 +178,7 @@
|
|
|
//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}', '{ACC_ID}', '{prop.Key}', '{prop.Value.GetValue(oldArticleModel, null)}', '{prop.Value.GetValue(articleModel, null)}')";
|
|
|
+ $"VALUES ('{id}', '{currentAcc.UUID}', '{prop.Key}', '{prop.Value.GetValue(oldArticleModel, null)}', '{prop.Value.GetValue(articleModel, null)}')";
|
|
|
dbCon.SQLInsert(stringSQL);
|
|
|
}
|
|
|
|