DocsLoad.razor.g.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // <auto-generated/>
  2. #pragma warning disable 1591
  3. #pragma warning disable 0414
  4. #pragma warning disable 0649
  5. #pragma warning disable 0169
  6. namespace HyperCube.Pages
  7. {
  8. #line hidden
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Threading.Tasks;
  13. using Microsoft.AspNetCore.Components;
  14. #nullable restore
  15. #line 1 "c:\ProjectHyperCube\_Imports.razor"
  16. using System.Net.Http;
  17. #line default
  18. #line hidden
  19. #nullable disable
  20. #nullable restore
  21. #line 2 "c:\ProjectHyperCube\_Imports.razor"
  22. using Microsoft.AspNetCore.Authorization;
  23. #line default
  24. #line hidden
  25. #nullable disable
  26. #nullable restore
  27. #line 3 "c:\ProjectHyperCube\_Imports.razor"
  28. using Microsoft.AspNetCore.Components.Authorization;
  29. #line default
  30. #line hidden
  31. #nullable disable
  32. #nullable restore
  33. #line 4 "c:\ProjectHyperCube\_Imports.razor"
  34. using Microsoft.AspNetCore.Components.Forms;
  35. #line default
  36. #line hidden
  37. #nullable disable
  38. #nullable restore
  39. #line 5 "c:\ProjectHyperCube\_Imports.razor"
  40. using Microsoft.AspNetCore.Components.Routing;
  41. #line default
  42. #line hidden
  43. #nullable disable
  44. #nullable restore
  45. #line 6 "c:\ProjectHyperCube\_Imports.razor"
  46. using Microsoft.AspNetCore.Components.Web;
  47. #line default
  48. #line hidden
  49. #nullable disable
  50. #nullable restore
  51. #line 7 "c:\ProjectHyperCube\_Imports.razor"
  52. using Microsoft.AspNetCore.Components.Web.Virtualization;
  53. #line default
  54. #line hidden
  55. #nullable disable
  56. #nullable restore
  57. #line 8 "c:\ProjectHyperCube\_Imports.razor"
  58. using Microsoft.JSInterop;
  59. #line default
  60. #line hidden
  61. #nullable disable
  62. #nullable restore
  63. #line 9 "c:\ProjectHyperCube\_Imports.razor"
  64. using HyperCube;
  65. #line default
  66. #line hidden
  67. #nullable disable
  68. #nullable restore
  69. #line 10 "c:\ProjectHyperCube\_Imports.razor"
  70. using HyperCube.Shared;
  71. #line default
  72. #line hidden
  73. #nullable disable
  74. #nullable restore
  75. #line 2 "c:\ProjectHyperCube\Pages\DocsLoad.razor"
  76. using System.IO;
  77. #line default
  78. #line hidden
  79. #nullable disable
  80. [Microsoft.AspNetCore.Components.RouteAttribute("/docsload")]
  81. public partial class DocsLoad : Microsoft.AspNetCore.Components.ComponentBase
  82. {
  83. #pragma warning disable 1998
  84. protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
  85. {
  86. }
  87. #pragma warning restore 1998
  88. #nullable restore
  89. #line 42 "c:\ProjectHyperCube\Pages\DocsLoad.razor"
  90. private Models.ArticleModel articleModel = new Models.ArticleModel();
  91. string status;
  92. string text;
  93. private void HandleValidSubmit()
  94. {
  95. MySQLConnector dbCon = MySQLConnector.Instance();
  96. string stringSQL = $"INSERT INTO articles (filename, article_name, authors)" +
  97. $"VALUES ('{articleModel.Filename}', '{articleModel.Name}', '{articleModel.Author}')";
  98. long id = dbCon.SQLInsert(stringSQL);
  99. stringSQL = $"INSERT INTO actions_history (article_id, action_type, acc_id)" +
  100. $"VALUES ('{id}', {1}, {1})";
  101. dbCon.SQLInsert(stringSQL);
  102. dbCon.Close();
  103. status = "Data sent";
  104. }
  105. async Task HandleSelection(InputFileChangeEventArgs e)
  106. {
  107. IBrowserFile file = e.File;
  108. if (file != null)
  109. {
  110. status = $"Finished loading {file.Size} bytes from {file.Name}";
  111. //передавать из парсинга ArticleModel!!!
  112. DocParse docParse = new DocParse();
  113. Dictionary<string, string> docFields = await DocParse.ReadPDF(file);
  114. articleModel.Filename = file.Name;
  115. articleModel.Name = docFields["name"];
  116. //articleModel.PublishDate = docFields["date"];
  117. articleModel.Author = docFields["authors"];
  118. articleModel.Keywords = docFields["keywords"];
  119. articleModel.Annotation = docFields["annotation"];
  120. text = docFields["text"];
  121. //Console.WriteLine("HandleSelection finished");
  122. }
  123. }
  124. #line default
  125. #line hidden
  126. #nullable disable
  127. }
  128. }
  129. #pragma warning restore 1591