コード例 #1
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);
        }
    }