Просмотр исходного кода

Merge branch 'master' of http://dev.prmsys.net:3001/Rimmon/HyperCube

Rimmon 4 лет назад
Родитель
Сommit
5fb793b44b
1 измененных файлов с 18 добавлено и 17 удалено
  1. 18 17
      Pages/DocEdit.razor

+ 18 - 17
Pages/DocEdit.razor

@@ -15,8 +15,7 @@
     <div style="width: 50%;">
         @if (docID < 1)
         {
-            <p><InputFile id="inputDefault" OnChange="@HandleSelection"
-                           accept="application/pdf" /></p>
+            <p><InputFile id="inputDefault" OnChange="@HandleSelection" accept="application/pdf" /></p>
             //accept="application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
         }
         else
@@ -88,7 +87,7 @@
         long id = dbCon.SQLInsert(stringSQL);
 
         stringSQL = $"INSERT INTO actions_history (article_id, action_type, acc_id)" +
-        $"VALUES ('{id}', {1}, {1})";
+            $"VALUES ('{id}', {1}, {1})";
         dbCon.SQLInsert(stringSQL);
 
         dbCon.Close();
@@ -97,11 +96,13 @@
         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();
 
-        Console.WriteLine($"User has saved new article data, {id}_{articleModel.Filename}");
         status = "New article data saved.";
 
         bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Хотите загрузить еще статью?");
@@ -137,17 +138,17 @@
         }
     }
 
-    private async void DownloadDoc()
-    {
-        string fullpath = Path.Combine(storageFolderPath, $"{docID}_{articleModel.Filename}");
-        if (File.Exists(fullpath))
-        {
-            //await JsRuntime.InvokeAsync<string>("downloadFile", fullpath);
-        }
-        else
-        {
-            Console.WriteLine($"File {fullpath} not found.");
-            status = $"File {fullpath} not found.";
-        }
-    }
+    //private async void DownloadDoc()
+    //{
+    //    string fullpath = Path.Combine(storageFolderPath, $"{docID}_{articleModel.Filename}");
+    //    if (File.Exists(fullpath))
+    //    {
+    //        //await JsRuntime.InvokeAsync<string>("downloadFile", fullpath);
+    //    }
+    //    else
+    //    {
+    //        Console.WriteLine($"File {fullpath} not found.");
+    //        status = $"File {fullpath} not found.";
+    //    }
+    //}
 }