TranslationService.cs 2.9 KB

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