public void CheckMaxDate() { DataManager dataManager = new DataManager(connectionString); foreach (string pawnID in allTypesTransactionIdList) { dateDictionary = dataManager.GetAllTypesMaxDate(pawnID); DateTime maxDate; foreach (KeyValuePair<string, DateTime> pair in dateDictionary) { maxDate = pair.Value; DateTime today = DateTime.Today; TimeSpan diffDays = today - maxDate; double loanDays = diffDays.TotalDays; string typeTest = pair.Key.Substring(0, 10); if (typeTest == "PaymentDat") { if (loanDays >= 31) { ApplyPaymentCharge(pawnID); } } if (typeTest == "ChargeDate") { if (loanDays >= 31) { ApplyChargedFinanceCharge(pawnID); } } } } }