27 lines
655 B
C#
27 lines
655 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Configuration;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace RMWPFInterfaceLibrary.Helpers
|
|||
|
{
|
|||
|
public class ConfigHelper : IConfigHelper
|
|||
|
{
|
|||
|
public decimal GetTaxRate()
|
|||
|
{
|
|||
|
string rateText = ConfigurationManager.AppSettings["taxRate"];
|
|||
|
|
|||
|
bool isValidTaxRate = Decimal.TryParse(rateText, out decimal output);
|
|||
|
|
|||
|
if (isValidTaxRate == false)
|
|||
|
{
|
|||
|
throw new ConfigurationErrorsException("The taxRate is not setup properly");
|
|||
|
}
|
|||
|
|
|||
|
return output;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|