Пример #1
0
        public GenerateReportResponse GenerateReport(string platform, int?organizationId, int?userId, SearchRequest request)
        {
            var result = new GenerateReportResponse {
                Request = request
            };

            try
            {
                // POST
                var apiRequest = CreateRequest(Method.POST, "{platform}/reports");
                apiRequest.AddUrlSegment("platform", platform);
                apiRequest.AddParameter("organizationid", organizationId, ParameterType.QueryString);
                if (userId != null)
                {
                    apiRequest.AddParameter("userid", userId, ParameterType.QueryString);
                }
                apiRequest.AddBody(request);

                var response = Execute <GenerateReportResponse>(apiRequest);
                return(response);
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
            }
            return(result);
        }
Пример #2
0
    private string SendExternalReport(int ContactID, int UserID, bool External)
    {
        string         ReturnMessage = string.Empty;
        ServiceManager sm            = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            GenerateReportRequest req = new GenerateReportRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.External          = External;
            req.FileId            = this.iLoanID;
            req.TemplReportId     = GetTemplReportId();

            GenerateReportResponse respone = null;
            try
            {
                respone = service.GenerateReport(req);
                string SendEmailReturnMessage = string.Empty;
                if (respone.hdr.Successful)
                {
                    ReturnMessage = SendEmail(ContactID, UserID, respone.ReportContent);
                }
                else
                {
                    ReturnMessage = respone.hdr.StatusInfo;
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                string sExMsg = string.Format("Exception happened when Send Report (FileID={0}): {1}", this.iLoanID, "Point Manager is not running.");
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                ReturnMessage = sExMsg;
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Exception happened when Send Report (FileID={0}): {1}", this.iLoanID, ex.Message);
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                ReturnMessage = sExMsg;
            }

            return(ReturnMessage);
        }
    }
Пример #3
0
        public GenerateReportResponse GenerateReport(string platform, int?organizationId, int?userId, SearchRequest request)
        {
            var result = new GenerateReportResponse {
                Request = request
            };

            try
            {
                using (new RequestTimer(result))
                {
                    string filePath = Configuration.Exports.FilePath;
                    _searchRequestValidator.Validate(platform, organizationId, request);
                    result.Data = _asyncReportGeneratorService.Setup(platform, organizationId, userId, request, filePath);
                }
            }
            catch (Exception ex)
            {
                result.Error = new ResponseError().Load(ex);
                _logger.LogException(ex);
            }
            return(result);
        }