TranslationService.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Net;
  5. using System.Text;
  6. using System.Threading;
  7. using System.Web.Http;
  8. using System.Web.UI;
  9. using AutoMapper;
  10. using DataTransfersLibs.Models;
  11. using DataTransfersLibs.Service;
  12. using Gs.TransData.WebApi.Models;
  13. using Newtonsoft.Json;
  14. using SysBaseLibs;
  15. using SysDataLibs.TableClass;
  16. namespace Gs.TransData.WebApi.Service
  17. {
  18. public class TranslationService
  19. {
  20. public static TranslationService Instance => new TranslationService();
  21. public JsonResult DataUpload(string xmlStr)
  22. {
  23. DataUpdateService loDataUpData = new DataUpdateService(xmlStr);
  24. var result = new DataUploadResult();
  25. if (loDataUpData.CheckUserValid())
  26. {
  27. result.Result = loDataUpData.UpdateAllRecords();
  28. result.Total = loDataUpData.Total;
  29. result.Successed = loDataUpData.Successed;
  30. result.Failed = loDataUpData.Failed;
  31. }
  32. if (!string.IsNullOrEmpty(loDataUpData.ErrorMsg))
  33. {
  34. result.Msg = loDataUpData.ErrorMsg;
  35. }
  36. return new JsonResult(result);
  37. }
  38. public JsonResult GetSampleInfo(AccountInfo poAccount)
  39. {
  40. var result = new JsonResult {Success = true};
  41. try
  42. {
  43. string lcRetVal = QueryDataService.Instance.GetSampleInfo(poAccount);
  44. result.Result= JsonConvert.DeserializeObject(lcRetVal);
  45. }
  46. catch (Exception e)
  47. {
  48. this.LogError(e);
  49. result.Msg = e.Message;
  50. }
  51. return result;
  52. }
  53. public JsonResult GetCheckItemInfo(AccountInfo poAccount)
  54. {
  55. var result = new JsonResult {Success = true};
  56. try
  57. {
  58. string lcRetVal = QueryDataService.Instance.GetCheckItemInfo(poAccount);
  59. result.Result= JsonConvert.DeserializeObject(lcRetVal);
  60. }
  61. catch (Exception e)
  62. {
  63. this.LogError(e);
  64. result.Msg = e.Message;
  65. }
  66. return result;
  67. }
  68. public JsonResult GetCheckMethodInfo(AccountInfo poAccount)
  69. {
  70. var result = new JsonResult {Success = true};
  71. try
  72. {
  73. string lcRetVal = QueryDataService.Instance.GetCheckMethodInfo(poAccount);
  74. result.Result= JsonConvert.DeserializeObject(lcRetVal);
  75. }
  76. catch (Exception e)
  77. {
  78. this.LogError(e);
  79. result.Msg = e.Message;
  80. }
  81. return result;
  82. }
  83. public JsonResult GetDistrictInfo(AccountInfo poAccount)
  84. {
  85. var result = new JsonResult {Success = true};
  86. try
  87. {
  88. string lcRetVal = QueryDataService.Instance.GetSampleInfo(poAccount);
  89. result.Result= JsonConvert.DeserializeObject(lcRetVal);
  90. }
  91. catch (Exception e)
  92. {
  93. this.LogError(e);
  94. result.Msg = e.Message;
  95. }
  96. return result;
  97. }
  98. }
  99. }