Exemplo n.º 1
0
        public string GetRate(string id)
        {
            long idRate = JsonConvert.DeserializeObject <Int32>(id);

            ResponseRateData tmp = GetRateDic();

            return(JsonConvert.SerializeObject(tmp.RateDic[idRate]));
        }
Exemplo n.º 2
0
        ResponseRateData GetRateDic()
        {
            ResponseRateData result = new ResponseRateData();

            try
            {
                var rates = DataLayer.Repository.GetRates();

                foreach (var r in rates)
                {
                    if (r != null &&
                        !String.IsNullOrEmpty(r.ClassName) &&
                        QuantLibAdaptor.GetRateInformation(r)
                        )
                    {
                        result.RateDic[r.Id] = r;
                    }
                }
                DataLayer.Repository.RateDic = result.RateDic;
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }

                result.Error         = new CustomException();
                result.Error.Message = ex.Message + ex.StackTrace;
            }

            //we read from the database from te table Currencies
            // assumption is - if ClassName is not null then the rest of the parameters for each currency should be populated for Quantlib
            // otherwise it was manually added and everything should be coming from the database only

            return(result);
        }
Exemplo n.º 3
0
        public string GetRates()
        {
            ResponseRateData tmp = GetRateDic();

            return(JsonConvert.SerializeObject(tmp));
        }