コード例 #1
0
        /// <summary>
        /// Get the withdrawal information from the user.
        /// </summary>
        /// <returns></returns>
        private decimal GetWithdrawal()
        {
            _srw.WriteString(string.Format(Prompt.EnterWithdrawal, Validation.WithdrawalMax));
            var withdrawal = _srw.ReadString();

            var success = decimal.TryParse(withdrawal, out var d) && d <Validation.WithdrawalMax && d> Validation.WithdrawalMin;

            var message = success ? string.Format(Validation.WithdrawalSuccess, d.ToString(FormatString.CurrencyFormat)) :
                          string.Format(ErrorString.WithdrawalEntry, Validation.WithdrawalMax.ToString(FormatString.CurrencyFormat),
                                        Validation.WithdrawalMin.ToString(FormatString.CurrencyFormat));

            _srw.DisplayMessageWithDelay(message);

            return(d);
        }
コード例 #2
0
 protected string GetResponse()
 {
     return(_srw.ReadString());
 }
コード例 #3
0
 /// <summary>
 /// Get the name from the user.
 /// </summary>
 /// <returns></returns>
 private string GetNameFromUser()
 {
     _srw.WriteString(Prompt.EnterUserName);
     return(_srw.ReadString());
 }