ConfigurationValues.cs 6.0 KB

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