ConfigurationValues.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using Dfs.WayneChina.SinochemEps;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace SinochemInternetPlusApp
  9. {
  10. public static class ConfigurationValues
  11. {
  12. private static readonly string needConfirmExpiration =
  13. SinochemEpsApp.AppSettings["NeedConfirmEpsTrxExpirationInMinutes"];
  14. public static double NeedConfirmEpsTrxExpirationInMinutes
  15. {
  16. get
  17. {
  18. try
  19. {
  20. return double.Parse(needConfirmExpiration);
  21. }
  22. catch (Exception ex)
  23. {
  24. return 24 * 60;
  25. }
  26. }
  27. }
  28. private static readonly string doneEpsTrxCountPerDisplay =
  29. SinochemEpsApp.AppSettings["AlreadyDoneEpsTrxCountPerDisplay"];
  30. public static int AlreadyDoneEpsTrxCountPerDisplay
  31. {
  32. get
  33. {
  34. try
  35. {
  36. return int.Parse(doneEpsTrxCountPerDisplay);
  37. }
  38. catch (Exception ex)
  39. {
  40. return 50;
  41. }
  42. }
  43. }
  44. private static readonly string fuelingPoints =
  45. SinochemEpsApp.AppSettings["ListOfFuelingPoints"];
  46. public static IEnumerable<int> ListOfFuelingPoints
  47. {
  48. get
  49. {
  50. try
  51. {
  52. return fuelingPoints.Split(',')
  53. .Where(str => !string.IsNullOrEmpty(str))
  54. .Select(str => int.Parse(str));
  55. }
  56. catch (Exception ex)
  57. {
  58. return new int[] { 1, 2 };
  59. }
  60. }
  61. }
  62. private static readonly string fpAssociatedNozzles =
  63. SinochemEpsApp.AppSettings["AssociatedNozzlesForFuelingPoints"];
  64. public static Dictionary<int, IEnumerable<int>> FuelingPointNozzlesDict
  65. {
  66. get
  67. {
  68. try
  69. {
  70. var list = fpAssociatedNozzles.Replace(" ", "").Split(';');
  71. Dictionary<int, IEnumerable<int>> dict = new Dictionary<int, IEnumerable<int>>();
  72. foreach (var item in list)
  73. {
  74. var subItems = item.Split('=');
  75. dict.Add(Convert.ToInt32(subItems[0]), subItems[1].Split(',').Select(Int32.Parse));
  76. }
  77. return dict;
  78. }
  79. catch (Exception)
  80. {
  81. return null;
  82. }
  83. }
  84. }
  85. private static readonly string multiFusions =
  86. SinochemEpsApp.AppSettings["SupportMultiFusions"];
  87. public static bool SupportMultiFusions
  88. {
  89. get
  90. {
  91. try
  92. {
  93. return bool.Parse(multiFusions);
  94. }
  95. catch (Exception ex)
  96. {
  97. return false;
  98. }
  99. }
  100. }
  101. private static readonly string resendPosNotifyExpire =
  102. SinochemEpsApp.AppSettings["ResendPosNotifyExpirationInMinutes"];
  103. public static int ResendPosNotifyExpirationInMinutes
  104. {
  105. get
  106. {
  107. try
  108. {
  109. return int.Parse(resendPosNotifyExpire);
  110. }
  111. catch (Exception ex)
  112. {
  113. return 24 * 60;
  114. }
  115. }
  116. }
  117. private static readonly string epsTrxHistoryArchive =
  118. SinochemEpsApp.AppSettings["EpsTrxHistoryArchiveInDays"];
  119. public static int EpsTrxHistoryArchiveInDays
  120. {
  121. get
  122. {
  123. try
  124. {
  125. return int.Parse(epsTrxHistoryArchive);
  126. }
  127. catch (Exception ex)
  128. {
  129. return 90;
  130. }
  131. }
  132. }
  133. private static readonly string icPaymentResultDisplayTO =
  134. SinochemEpsApp.AppSettings["ICCardPaymentResultDisplayTimeoutInSeconds"];
  135. public static int ICCardPaymentResultDisplayTimeoutInSeconds
  136. {
  137. get
  138. {
  139. try
  140. {
  141. return int.Parse(icPaymentResultDisplayTO);
  142. }
  143. catch (Exception ex)
  144. {
  145. return 10;
  146. }
  147. }
  148. }
  149. private static readonly string receiptEnabled =
  150. SinochemEpsApp.AppSettings["PrintReceiptEnabled"];
  151. public static bool PrintReceiptEnabled
  152. {
  153. get
  154. {
  155. try
  156. {
  157. return bool.Parse(receiptEnabled);
  158. }
  159. catch (Exception ex)
  160. {
  161. return true;
  162. }
  163. }
  164. }
  165. private static readonly string qrCodeEnabled =
  166. SinochemEpsApp.AppSettings["PrintQrCodeOnReceiptEnabled"];
  167. public static bool PrintQrCodeOnReceiptEnabled
  168. {
  169. get
  170. {
  171. try
  172. {
  173. return bool.Parse(qrCodeEnabled);
  174. }
  175. catch (Exception ex)
  176. {
  177. return true;
  178. }
  179. }
  180. }
  181. }
  182. }