public GetFilingRatiosResponse PostGetFilingRatios(GetFilingRatios request) { var response = Post <GetFilingRatios, GetFilingRatiosResponse>("GetFilingRatios", request); return(response); }
public object Any(GetFilingRatios request) { DateTime dtStart = DateTime.UtcNow; _logger.Log(EErrorType.Info, " ****** Call start: GetFilingRatios"); GetFilingRatiosResponse response = new GetFilingRatiosResponse(); TransferHeader(request, response); _logger.Log(EErrorType.Info, string.Format("ValidateSession({0})", request.SessionToken)); EErrorCodes valSession = ValidateSession(request.SessionToken); if (valSession == EErrorCodes.Success) { try { Interfaces.DAL.GetCompanyFilingRatiosParams filingRatiosParams = new Interfaces.DAL.GetCompanyFilingRatiosParams(request.RatioCodes.ToArray()) { CompanyCode = request.CompanyCode, Name = request.FilingName, RegulatorCode = request.RegulatorCode, }; Interfaces.DAL.GetCompanyFilingRatiosResult filingRatiosResult = _dal.GetCompanyFilingRatios(filingRatiosParams); response.Payload.CompanyCode = request.CompanyCode; response.Payload.RegulatorCode = request.RegulatorCode; response.Payload.FilingName = request.FilingName; foreach (var fd in filingRatiosResult.Data) { response.Payload.Ratios.Add(new DTO.RatioRecord() { Code = fd.Code, Value = fd.Value != null ? (decimal)fd.Value : 0, UnitName = fd.Unit, PeriodEnd = fd.PeriodEnd, PeriodStart = fd.PeriodStart }); } response.Success = true; } catch (Exception ex) { _logger.Log(ex); response.Success = false; response.Errors.Add(new Error() { Code = EErrorCodes.GeneralError, Type = EErrorType.Error, Message = string.Format("Unpexcted error: {0}", ex.Message) }); } } else { response.Success = false; response.Errors.Add(new Error() { Code = EErrorCodes.InvalidSession, Type = EErrorType.Error, Message = string.Format("Invalid session") }); } DateTime dtEnd = DateTime.UtcNow; _logger.Log(EErrorType.Info, string.Format(" ****** Call end: GetFilingRatios\tTime:{0}", dtEnd - dtStart)); return(response); }