コード例 #1
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            ExportParameter exportParameter = new ExportParameter();

            int leadID = Convert.ToInt32(Session["LeadIds"]);

            //string filepath = Server.MapPath("~/Temp");
            string finalReportPath = null;

            exportParameter.isClaimLogo = cbxClaimLog.Checked;
            exportParameter.isCoverage = cbxCoverage.Checked;
            exportParameter.isDemographics = cbxDemographics.Checked;
            exportParameter.isDocuments = cbxDocuments.Checked;
            exportParameter.isPhotos = cbxPhotos.Checked;

            exportParameter.policyTypeID = Convert.ToInt32(ddlPolicyType.SelectedValue);

            try {
                finalReportPath = ExportLeadHelper.exportLead(exportParameter, leadID);

                emailDocumentLink(finalReportPath, txtEmailTo.Text.Trim());

                lblMessage.Text = "Claim has been successfully exported.";
                lblMessage.CssClass = "ok";
            }
            catch (Exception ex) {
                lblMessage.Text = "Error while exporting claim.";
                lblMessage.CssClass = "error";

                Core.EmailHelper.emailError(ex);
            }

            //renderToClient(finalReportPath);
        }
コード例 #2
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            ExportParameter exportParameter = new ExportParameter();

            int claimID = SessionHelper.getClaimID();
            int leadID = SessionHelper.getLeadId();

            //string filepath = Server.MapPath("~/Temp");
            string finalReportPath = null;

            exportParameter.isClaimLogo = cbxClaimLog.Checked;
            exportParameter.isCoverage = cbxCoverage.Checked;
            exportParameter.isDemographics = cbxDemographics.Checked;
            exportParameter.isDocuments = cbxDocuments.Checked;
            exportParameter.isPhotos = cbxPhotos.Checked;

            try {
                finalReportPath = ExportLeadHelper.exportLead(exportParameter, claimID);

                //generateSharedDocumentPage(claimID, leadID);

                emailDocumentLink(finalReportPath, txtEmailTo.Text.Trim(), claimID);

                addReportToClaimDocument(finalReportPath, claimID);

                lblMessage.Text = "Claim report has been printed and emailed successfully.";
                lblMessage.CssClass = "ok";
            }
            catch (Exception ex) {
                lblMessage.Text = ex.Message;
                lblMessage.CssClass = "error";

                Core.EmailHelper.emailError(ex);
            }
        }
コード例 #3
0
        protected void btnPrintOnly_Click(object sender, EventArgs e)
        {
            ExportParameter exportParameter = new ExportParameter();

            int claimID = SessionHelper.getClaimID();
            int leadID = SessionHelper.getLeadId();

            //string filepath = Server.MapPath("~/Temp");
            string finalReportPath = null;

            exportParameter.isClaimLogo = cbxClaimLog.Checked;
            exportParameter.isCoverage = cbxCoverage.Checked;
            exportParameter.isDemographics = cbxDemographics.Checked;
            exportParameter.isDocuments = cbxDocuments.Checked;
            exportParameter.isPhotos = cbxPhotos.Checked;

            try {
                finalReportPath = ExportLeadHelper.exportLead(exportParameter, claimID);

                addReportToClaimDocument(finalReportPath, claimID);

                string siteURL = ConfigurationManager.AppSettings["siteURL"].ToString();

                string path = siteURL + "/Temp/" + Path.GetFileName(finalReportPath);

                string js = string.Format("window.open('{0}', '_blank','height=800,width=800,titlebar=yes,top=25,left=25, scrollbars=yes,status=no,resizable=yes');", path);

                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "report", js, true);

            }
            catch (Exception ex) {
                lblMessage.Text = ex.Message;
                lblMessage.CssClass = "error";

                Core.EmailHelper.emailError(ex);
            }
        }
コード例 #4
0
        public static string exportLead(ExportParameter exportParamaters, int claimID)
        {
            string finalReportPath = null;
            //tempPath = path;
            Claim claim = null;
            Leads lead = null;
            LeadPolicy policy = null;

            claim = ClaimsManager.Get(claimID);

            lead = claim.LeadPolicy.Leads;

            policy = claim.LeadPolicy;

            // fully qualified path

            //string reportPath = HttpContext.Current.Server.MapPath(string.Format("~/Temp/{0}.pdf", Guid.NewGuid().ToString()));

            string reportPath = HttpContext.Current.Server.MapPath(string.Format("~/Temp/ClaimReport_{0}_{1}_{2:yyyyMMddhhmmss}.pdf", lead.insuredName.Replace(" ", "_"), claim.InsurerClaimNumber, DateTime.Now));

            doc = new Document(iTextSharp.text.PageSize.LETTER, 25, 25, 25, 25);

            PdfWriter w = PdfWriter.GetInstance(doc, new FileStream(reportPath, FileMode.Create));

            Rectangle rect = new Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height);
            rect.BackgroundColor = BaseColor.WHITE;
            doc.SetPageSize(rect);
            doc.Open();

            setClientLogoHeader(lead.Client);

            if (exportParamaters.isAll) {
                exportDemographics(lead, claim);

                exportCoverage(policy);

                exportClaimLog(policy);

                exportPhotos(policy);
            }
            else {

                exportDemographics(lead, claim);

                if (exportParamaters.isCoverage)
                    exportCoverage(policy);

                if (exportParamaters.isClaimLogo) {
                    // legacy comments
                    exportClaimLog(policy);
                    exportClaimLog(claimID, claim.AdjusterClaimNumber);
                }

                if (exportParamaters.isPhotos) {
                    // legacy
                    exportPhotos(policy);
                    exportPhotos(claimID, claim.AdjusterClaimNumber);
                }

            }

            doc.Close();

            // include any pdf documents uploaded
            if (exportParamaters.isAll || exportParamaters.isDocuments) {
                string reportMergePath = HttpContext.Current.Server.MapPath(string.Format("~/Temp/ClaimReport_{0}_{1}_{2:yyyyMMddhhmmss}.pdf", lead.insuredName.Replace(" ", "_"), claim.AdjusterClaimNumber, DateTime.Now.AddMinutes(1)));

                finalReportPath = mergeDocuments(reportPath, reportMergePath, lead.LeadId, claimID);
            }
            else
                finalReportPath = reportPath;

            return finalReportPath;
        }