public float LoanPayment(float principle, float rate, int payments)
        {
            try
            {
                float result = 0f;

                logger.LogStuff("principle: " + principle + ", rate: " + rate + ", payments: " + payments);

                if (principle <= 0)
                {
                    throw new SoapException("Principle must be greater than 0.", Soap12FaultCodes.RpcBadArgumentsFaultCode);
                }
                else if (rate <= 0 || rate > 1)
                {
                    throw new SoapException("Rate must be between 0 and 1.", Soap12FaultCodes.RpcBadArgumentsFaultCode);
                }
                else
                {
                    result = LoanCalculator.CalculateLoan(principle, rate, payments);
                }

                return(result);
            }
            catch (SoapException ex)
            {
                logger.LogFault(ex);
                throw ex;
            }
            catch (Exception ex)
            {
                logger.LogException(ex);
                throw new Exception("Unknown Internal Error");
            }
        }
Exemple #2
0
        public string CaseConvert(string incoming, uint flag)
        {
            try
            {
                string result = string.Empty;

                if (incoming.Length == 0)
                {
                    throw new SoapException("The length of the incoming string must be greater than 0.", Soap12FaultCodes.RpcBadArgumentsFaultCode);
                }
                else if (flag == 0 || flag > 2)
                {
                    logger.LogThroughService();
                    throw new SoapException("The flag must be either 1 or 2.", Soap12FaultCodes.RpcBadArgumentsFaultCode);
                }
                else
                {
                    result = TextServiceLogic.CaseConvert(incoming, flag);
                }

                return(result);
            }
            catch (SoapException ex)
            {
                logger.LogFault(ex);
                throw ex;
            }
            catch (Exception ex)
            {
                logger.LogException(ex);
                throw new Exception("Unknown Internal Error");
            }
        }
Exemple #3
0
 public IPResolver.IPInfo GetInfo(string ip)
 {
     try
     {
         if (!isValidIP(ip))
         {
             throw new SoapException("Incorrect IP address format.", Soap12FaultCodes.RpcBadArgumentsFaultCode);
         }
         return(IPResolver.GetInfo(ip).Result);
     }
     catch (SoapException ex)
     {
         logger.LogFault(ex);
         throw ex;
     }
     catch (Exception ex)
     {
         logger.LogException(ex);
         throw new Exception("Unknown Internal Error");
     }
 }