public static DateTime GetSettlementDate(SettlementCurrencyEnum settlementCurrency) { Console.WriteLine("Please indicate the date you would like the settlement completed for (dd/mmm/yyyy)."); DateTime settlementDateValue = new DateTime(); string settlementDate = Console.ReadLine(); try { settlementDateValue = DateTime.Parse(settlementDate); if (settlementDateValue <= DateTime.Now) { Console.WriteLine("The settlement date cannot be less than or equal to the current date."); GetSettlementDate(settlementCurrency); Console.WriteLine(); } if (settlementCurrency == SettlementCurrencyEnum.SGP || settlementCurrency == SettlementCurrencyEnum.AED) { // SUN - THURS if (settlementDateValue.DayOfWeek == DayOfWeek.Friday) { settlementDateValue = settlementDateValue.AddDays(2); Console.WriteLine("The date you selected was a {0}", DayOfWeek.Friday); Console.WriteLine("We have updated your settlement date to: {0}", settlementDateValue.ToString("dd/M/yyyy")); Console.WriteLine(); } else if (settlementDateValue.DayOfWeek == DayOfWeek.Saturday) { settlementDateValue = settlementDateValue.AddDays(1); Console.WriteLine("The date you selected was a {0}", DayOfWeek.Saturday); Console.WriteLine("We have updated your settlement date to: {0:dd/M/yyyy}", settlementDateValue); Console.WriteLine(); } } else { // MON - FRI if (settlementDateValue.DayOfWeek == DayOfWeek.Saturday) { settlementDateValue = settlementDateValue.AddDays(2); Console.WriteLine("The date you selected was a {0}", DayOfWeek.Saturday); Console.WriteLine("We have updated your settlement date to: {0:dd/M/yyyy}", settlementDateValue); Console.WriteLine(); } else if (settlementDateValue.DayOfWeek == DayOfWeek.Sunday) { settlementDateValue = settlementDateValue.AddDays(1); Console.WriteLine("The date you selected was a {0}", DayOfWeek.Sunday); Console.WriteLine("We have updated your settlement date to: {0:dd/M/yyyy}", settlementDateValue); Console.WriteLine(); } } } catch { Console.WriteLine("You did not enter a valid date, please try again using the correct format (dd/mm/yyyy)!"); GetSettlementDate(settlementCurrency); Console.WriteLine(); } return(Convert.ToDateTime(settlementDateValue)); }
public static SettlementCurrencyEnum GetSettlementCurrency() { SettlementCurrencyEnum settlementCurrencyAgreement = 0; Console.WriteLine("Please choose the currency you wish to make your settlement in:"); Console.WriteLine("- SGP"); Console.WriteLine("- GBP"); Console.WriteLine("- AED"); Console.WriteLine(); var currency = Console.ReadLine(); Console.WriteLine("You have entered {0}", currency); Console.WriteLine(); switch (currency.ToLower()) { case "sgp": settlementCurrencyAgreement = SettlementCurrencyEnum.SGP; break; case "aed": settlementCurrencyAgreement = SettlementCurrencyEnum.AED; break; case "gbp": settlementCurrencyAgreement = SettlementCurrencyEnum.GBP; break; default: Console.WriteLine("You did not enter a valid currency, please try again!"); GetSettlementCurrency(); break; } return(settlementCurrencyAgreement); }