static public LeadPolicyType Get(int id) { LeadPolicyType policyType = null; policyType = (from x in DbContextHelper.DbContext.LeadPolicyType where x.LeadPolicyTypeID == id orderby x.Description select x ).FirstOrDefault <LeadPolicyType>(); return(policyType); }
static protected void exportCoverage(LeadPolicy policy) { string coverageHeder = string.Empty; int policyTypeID = (int)policy.PolicyType; LeadPolicyType policyType = null; // create header policyType = LeadPolicyTypeManager.Get(policyTypeID); if (policyType != null) { coverageHeder = policyType.Description + " - Coverages"; } doc.NewPage(); PdfPTable tblHeader = new PdfPTable(new float[] { 30, 60 }); tblHeader.WidthPercentage = 90; PdfPCell headerCell = new PdfPCell(new Phrase(coverageHeder)); headerCell.Colspan = 2; headerCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; tblHeader.AddCell(headerCell); doc.Add(tblHeader); PdfPTable ptable = new PdfPTable(new float[] { 30, 60 }); string typeDescripion = ""; string cityName = null; string stateName = null; string zipCode = null; string inspectionCompleted = null; //foreach (LeadPolicy policy in policies) { if (!string.IsNullOrEmpty(policy.InsuranceCompanyName)) { addTableCell(ptable, "Insurance Type"); if (policy.PolicyType != null) { typeDescripion = policy.LeadPolicyType.Description; } addTableCell(ptable, typeDescripion); addTableCell(ptable, "Insurance Company"); addTableCell(ptable, policy.InsuranceCompanyName); addTableCell(ptable, "Address"); addTableCell(ptable, policy.InsuranceAddress ?? " "); addTableCell(ptable, " "); cityName = policy.CityMaster == null ? " " : policy.CityMaster.CityName; stateName = policy.StateMaster == null ? " " : policy.StateMaster.StateCode; zipCode = policy.InsuranceZipCode ?? " "; addTableCell(ptable, cityName + " " + stateName + " " + zipCode); addTableCell(ptable, "Policy Number"); addTableCell(ptable, policy.PolicyNumber ?? " "); //addTableCell(ptable, "Claim Number"); //addTableCell(ptable, policy.ClaimNumber ?? " "); //addTableCell(ptable, "Status"); //addTableCell(ptable, policy.StateMaster == null ? " " : policy.StateMaster.StateName); //addTableCell(ptable, "SubStatus"); //addTableCell(ptable, policy.SubStatusMaster == null ? " " : policy.SubStatusMaster.SubStatusName); //addTableCell(ptable, "Site Survey Date"); //addTableCell(ptable, policy.SiteSurveyDate == null ? " " : Convert.ToDateTime(policy.SiteSurveyDate).ToShortDateString()); //addTableCell(ptable, "Site Inspection Complete"); //if (policy.SiteInspectionCompleted == null) // inspectionCompleted = "No"; //else // inspectionCompleted = policy.SiteInspectionCompleted == 1 ? "Yes" : "No"; addTableCell(ptable, inspectionCompleted); // blank row addTableCell(ptable, " "); addTableCell(ptable, " "); } //} doc.Add(ptable); }