Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. public ActionResult GetMultiStoreNotifications()
  2. {
  3. //var urlHelper = new FposUrlHelper();
  4. //var endpoint = urlHelper.Api;
  5. //var groupID = CloudHelpers.GetGroupIdFromRemoteService(User.GetStoreId());
  6.  
  7. //var iapi = string.Format("{0}v1/multistoreOperation/status/{1}", endpoint, groupID);
  8.  
  9. //var logger = BowLogger.GetInstance();
  10.  
  11. //List<MultistoreOperation> opList = new List<MultistoreOperation>();
  12.  
  13. //try
  14. //{
  15. // using (var client = new HttpClient())
  16. // {
  17. // client.Timeout = new TimeSpan(0, 0, 30);
  18. // var response = client.GetAsync(iapi);
  19. // response.Wait();
  20. // if (response.IsFaulted)
  21. // {
  22. // logger.LogError("Back Office Web", response.Exception != null ? response.Exception.TargetSite.ToString() : "GetAsync()", response.Exception != null ? response.Exception.Message : "GetAsync to Cloud API Failed");
  23. // }
  24.  
  25. // var respJson = response.Result.Content.ReadAsStringAsync().Result;
  26. // opList = respJson.DeserializeJson<List<MultistoreOperation>>();
  27. // opList = opList.OrderByDescending(o => o.StartTime).ToList();
  28. // }
  29. //}
  30. //catch (Exception ex)
  31. //{
  32. // logger.LogError("Back Office Web", ex.TargetSite.ToString(), string.Format("Message:{0}", ex.Message));
  33. //}
  34.  
  35. List<MultistoreOperation> opList = new List<MultistoreOperation>
  36. {
  37. new MultistoreOperation
  38. {
  39. EntityType = "Item",
  40. OperationType = 1,
  41. Status = MOPStatus.Completed,
  42. MultistoreOperationId = Guid.NewGuid(),
  43. Responses = new List<MultistoreOperationResponse>
  44. {
  45. new MultistoreOperationResponse
  46. {
  47. Message = "stuff worked good",
  48. StoreId = 1,
  49. Status = MOPRStatus.Success
  50. },
  51. new MultistoreOperationResponse
  52. {
  53. Message = "good stuff, worked",
  54. StoreId = 2,
  55. Status = MOPRStatus.Success
  56. },
  57. new MultistoreOperationResponse
  58. {
  59. Message = "worked, stuff good",
  60. StoreId = 3,
  61. Status = MOPRStatus.Success
  62. }
  63. }
  64. },
  65. new MultistoreOperation
  66. {
  67. EntityType = "Department",
  68. OperationType = 3,
  69. Status = MOPStatus.Error,
  70. MultistoreOperationId = Guid.NewGuid(),
  71. Responses = new List<MultistoreOperationResponse>
  72. {
  73. new MultistoreOperationResponse
  74. {
  75. Message = "good stuff, worked",
  76. StoreId = 2,
  77. Status = MOPRStatus.Success
  78. },
  79. new MultistoreOperationResponse
  80. {
  81. Message = "DID NOT WORK GOOD",
  82. StoreId = 3,
  83. Status = MOPRStatus.Failure
  84. }
  85.  
  86. }
  87. },
  88. new MultistoreOperation
  89. {
  90. EntityType = "Customer",
  91. OperationType = 5,
  92. Status = MOPStatus.Error,
  93. MultistoreOperationId = Guid.NewGuid(),
  94. Responses = new List<MultistoreOperationResponse>
  95. {
  96. }
  97. }
  98. };
  99.  
  100. var model = new MultiStoreNotificationsModel
  101. {
  102. Operations = opList,
  103. Stores = new List<StoreInfo>
  104. {
  105. new StoreInfo
  106. {
  107. StoreId = 1,
  108. StoreName = "Store 1"
  109. },
  110. new StoreInfo
  111. {
  112. StoreId = 2,
  113. StoreName = "Store 2"
  114. },
  115. new StoreInfo
  116. {
  117. StoreId = 3,
  118. StoreName = "Store 3"
  119. }
  120. }
  121. };
  122.  
  123. return PartialView("MultistoreNotifications", model);
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement