using Dfs.WayneChina.SinochemEps; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SinochemInternetPlusApp { public static class ConfigurationValues { private static readonly string needConfirmExpiration = SinochemEpsApp.AppSettings["NeedConfirmEpsTrxExpirationInMinutes"]; public static double NeedConfirmEpsTrxExpirationInMinutes { get { try { return double.Parse(needConfirmExpiration); } catch (Exception ex) { return 24 * 60; } } } private static readonly string doneEpsTrxCountPerDisplay = SinochemEpsApp.AppSettings["AlreadyDoneEpsTrxCountPerDisplay"]; public static int AlreadyDoneEpsTrxCountPerDisplay { get { try { return int.Parse(doneEpsTrxCountPerDisplay); } catch (Exception ex) { return 50; } } } private static readonly string fuelingPoints = SinochemEpsApp.AppSettings["ListOfFuelingPoints"]; public static IEnumerable ListOfFuelingPoints { get { try { return fuelingPoints.Split(',') .Where(str => !string.IsNullOrEmpty(str)) .Select(str => int.Parse(str)); } catch (Exception ex) { return new int[] { 1, 2 }; } } } private static readonly string fpAssociatedNozzles = SinochemEpsApp.AppSettings["AssociatedNozzlesForFuelingPoints"]; public static Dictionary> FuelingPointNozzlesDict { get { try { var list = fpAssociatedNozzles.Replace(" ", "").Split(';'); Dictionary> dict = new Dictionary>(); foreach (var item in list) { var subItems = item.Split('='); dict.Add(Convert.ToInt32(subItems[0]), subItems[1].Split(',').Select(Int32.Parse)); } return dict; } catch (Exception) { return null; } } } private static readonly string multiFusions = SinochemEpsApp.AppSettings["SupportMultiFusions"]; public static bool SupportMultiFusions { get { try { return bool.Parse(multiFusions); } catch (Exception ex) { return false; } } } private static readonly string resendPosNotifyExpire = SinochemEpsApp.AppSettings["ResendPosNotifyExpirationInMinutes"]; public static int ResendPosNotifyExpirationInMinutes { get { try { return int.Parse(resendPosNotifyExpire); } catch (Exception ex) { return 24 * 60; } } } private static readonly string epsTrxHistoryArchive = SinochemEpsApp.AppSettings["EpsTrxHistoryArchiveInDays"]; public static int EpsTrxHistoryArchiveInDays { get { try { return int.Parse(epsTrxHistoryArchive); } catch (Exception ex) { return 90; } } } private static readonly string icPaymentResultDisplayTO = SinochemEpsApp.AppSettings["ICCardPaymentResultDisplayTimeoutInSeconds"]; public static int ICCardPaymentResultDisplayTimeoutInSeconds { get { try { return int.Parse(icPaymentResultDisplayTO); } catch (Exception ex) { return 10; } } } private static readonly string receiptEnabled = SinochemEpsApp.AppSettings["PrintReceiptEnabled"]; public static bool PrintReceiptEnabled { get { try { return bool.Parse(receiptEnabled); } catch (Exception ex) { return true; } } } private static readonly string qrCodeEnabled = SinochemEpsApp.AppSettings["PrintQrCodeOnReceiptEnabled"]; public static bool PrintQrCodeOnReceiptEnabled { get { try { return bool.Parse(qrCodeEnabled); } catch (Exception ex) { return true; } } } } }