Retail_manager/RMDataManagerLibrary/ConfigHelper.cs

27 lines
637 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RMDataManagerLibrary
{
public class ConfigHelper
{
public static 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;
}
}
}