コード例 #1
0
        static protected void exportClaimLog(LeadPolicy policy)
        {
            int leadID     = (int)policy.LeadId;
            int policyType = (int)policy.PolicyType;

            string policyDescription = policy.LeadPolicyType != null ? policy.LeadPolicyType.Description : "";

            List <LeadComment> policyComments = LeadCommentManager.getLeadCommentByLeadID(leadID, policyType);

            if (policyComments == null || policyComments.Count == 0)
            {
                return;
            }

            // create table 2 cells
            PdfPTable ptable = new PdfPTable(new float[] { 20, 80 });

            ptable.WidthPercentage = 90;


            addPolicyComments(ptable, policyComments, policyDescription);


            doc.Add(ptable);
        }
コード例 #2
0
ファイル: ClaimManager.cs プロジェクト: Antoniotoress1992/asp
        public void UpdateCarrierId(LeadPolicy objLeadPolicy)
        {
            LeadPolicy objLeadPolicy2 = DbContextHelper.DbContext.LeadPolicy.First(x => x.Id == objLeadPolicy.Id);

            objLeadPolicy2.CarrierID = objLeadPolicy.CarrierID;
            DbContextHelper.DbContext.SaveChanges();
        }
コード例 #3
0
        public async Task <IActionResult> sendEmail([FromBody] LeadDebitVM debitNotePdf)
        {
            try
            {
                LeadPolicy leadPolicy      = _context.LeadPolicies.Where(l => l.Id == Guid.Parse(debitNotePdf.leadPolicyId)).FirstOrDefault();
                Client     client          = _context.Clients.Where(l => l.Id == leadPolicy.ClientId).FirstOrDefault();
                string     clientName      = string.Empty;
                string     clientEmail     = string.Empty;
                string     policyName      = string.Empty;
                string     agentName       = string.Empty;
                string[]   directorsEmails = new string[2];
                if (client.Type == "Individual")
                {
                    clientName = client.Title + " " + client.Name + " " + client.Surname;
                }
                else
                {
                    clientName = client.Name;
                }
                clientEmail = client.Email;
                var policyMasters = _context.PolicyClassMaster.ToList();
                policyName = Util.GetPolicyName(policyMasters, leadPolicy.PolicyClassId);
                var agent = _context.Users.Where(x => x.Id == leadPolicy.CreatedBy.ToString()).FirstOrDefault();
                agentName = agent.FirstName + " " + agent.LastName;
                var directors = await _context.CorporateDirectors.Where(x => x.ClientId == leadPolicy.ClientId && x.IsDeleted == false).ToListAsync();

                if (directors != null && directors.Count() > 0)
                {
                    directorsEmails[0] = directors[0].Email;
                    if (directors.Count() == 2)
                    {
                        directorsEmails[1] = directors[1].Email;
                    }
                }


                string message = StaticContent.DEBITNOTE_BODY_TEMPLATE.Replace("@reciever", clientName)
                                 .Replace("@policyname", policyName)
                                 .Replace("@agentname", agentName)
                                 .Replace("@organization", agent.OrganisationName)
                                 .Replace("@Greet", client.Type == "Individual" ? "Dear" : "M/s");



                string debitnoteFile = debitNotePdf.debitNoteBase64.Replace("data:application/pdf;base64,", "");
                await _emailSender.SendGridEmailWithAttachmentAsync(clientEmail, directorsEmails, StaticContent.DEBITNOTE_SUBJECT_TEMPLATE.Replace("@policyname", policyName), message, debitnoteFile, "DebitNote.pdf");

                return(Json(new
                {
                    msg = "Success"
                }));
            }
            catch (Exception xe)
            {
                return(Json(new
                {
                    msg = "Fail"
                }));
            }
        }
コード例 #4
0
        static public LeadPolicy GetByID(int id)
        {
            LeadPolicy policy = null;

            policy = (from x in DbContextHelper.DbContext.LeadPolicy
                      where x.Id == id
                      select x
                      ).FirstOrDefault <LeadPolicy>();

            return(policy);
        }
コード例 #5
0
        static public int Save(LeadPolicy policy)
        {
            if (policy.Id == 0)
            {
                DbContextHelper.DbContext.Add(policy);
            }

            DbContextHelper.DbContext.SaveChanges();

            return(policy.Id);
        }
コード例 #6
0
        static public int Update(LeadPolicy policy)
        {
            LeadPolicy policy2 = DbContextHelper.DbContext.LeadPolicy.First(x => x.Id == policy.Id);

            if (policy2 != null)
            {
                policy2.ApplyAcrossAllCoverage = policy.ApplyAcrossAllCoverage;
                DbContextHelper.DbContext.SaveChanges();
            }

            return(policy.Id);
        }
コード例 #7
0
ファイル: ClaimManager.cs プロジェクト: Antoniotoress1992/asp
        public int GetLeadPolicyId(int id)
        {
            LeadPolicy objLeadPolicy = null;

            objLeadPolicy = (from clm in claimRulerDBContext.Claim
                             join leadpolicy in claimRulerDBContext.LeadPolicy on clm.PolicyID equals leadpolicy.Id
                             //join lead in claimRulerDBContext.LeadPolicy on leadpolicy.LeadId equals lead.LeadId
                             where clm.ClaimID == id
                             select leadpolicy
                             ).FirstOrDefault();

            return(objLeadPolicy.Id);
        }
コード例 #8
0
        static protected void exportPhotos(LeadPolicy policy)
        {
            int    leadID            = (int)policy.LeadId;
            int    policyTypeID      = (int)policy.PolicyType;
            string policyDescription = policy.LeadPolicyType != null ? policy.LeadPolicyType.Description : "";

            List <LeadsImage> images = LeadsUploadManager.getLeadsImageByLeadID(leadID, policyTypeID);


            if (images == null || images.Count == 0)
            {
                return;
            }


            addPhotos(images, policyDescription);
        }
コード例 #9
0
        static public LeadPolicy GetWithLeadCarrier(int id)
        {
            LeadPolicy policy = null;

            policy = (from x in DbContextHelper.DbContext.LeadPolicy
                      .Include("StatusMaster")
                      .Include("SubStatusMaster")
                      .Include("LeadPolicyType")
                      .Include("Carrier")
                      .Include("Carrier.StateMaster")
                      .Include("Carrier.CityMaster")
                      .Include("Leads")
                      where x.Id == id
                      select x
                      ).FirstOrDefault <LeadPolicy>();

            return(policy);
        }
コード例 #10
0
        static public void loadFieldValues(Claim claim)
        {
            Leads      lead    = claim.LeadPolicy.Leads;
            LeadPolicy policy  = claim.LeadPolicy;
            Carrier    carrier = policy.Carrier;
            Client     portal  = portal = lead.Client;

            PolicyLienholder lienHolder = policy.PolicyLienholder as PolicyLienholder;
            //PolicyLienholder lienHolder = policy.PolicyLienholder as PolicyLienholder;

            List <vw_ClaimLimit> limits = null;

            limits = ClaimLimitManager.GetAll(claim.ClaimID, LimitType.LIMIT_TYPE_PROPERTY);
            if (limits != null && limits.Count == 0)
            {
                limits = primePropertyLimits();
            }

            List <vw_ClaimLimit> limitsCasuality = ClaimLimitManager.GetAll(claim.ClaimID, LimitType.LIMIT_TYPE_CASUALTY);

            if (limitsCasuality != null && limitsCasuality.Count == 0)
            {
                limitsCasuality = primeCasualtyLimits();
            }


            //decimal p= limits[0].Depreciation??0;

            string policy_number = null;
            string claim_number  = null;

            string insurance_company      = null;
            string insurance_address      = null;
            string insurance_address2     = null;
            string insurance_city         = null;
            string insurance_state        = null;
            string insurance_zipcode      = null;
            string insurance_phone_number = null;

            decimal recovDepreA              = 0;
            decimal recovDepreB              = 0;
            decimal recovDepreC              = 0;
            decimal recovDepreTotal          = 0;
            decimal nonRecovDepreA           = 0;
            decimal nonRecovDepreB           = 0;
            decimal nonRecovDepreC           = 0;
            decimal nonRecovDepreTotal       = 0;
            decimal deductibleA              = 0;
            decimal deductibleB              = 0;
            decimal deductibleC              = 0;
            decimal deductibleTotal          = 0;
            decimal limitA                   = 0;
            decimal limitB                   = 0;
            decimal limitC                   = 0;
            decimal limitD                   = 0;
            decimal limitE                   = 0;
            decimal limitF                   = 0;
            decimal lossAmountRCVA           = 0;
            decimal lossAmountRCVB           = 0;
            decimal lossAmountRCVC           = 0;
            decimal lossAmountRCVD           = 0;
            decimal totalLossAmountRCVAThruD = 0;

            decimal lossAmountACVA           = 0;
            decimal lossAmountACVB           = 0;
            decimal lossAmountACVC           = 0;
            decimal lossAmountACVD           = 0;
            decimal lossAmountACVE           = 0;
            decimal lossAmountACVF           = 0;
            decimal totalLossAmountACVAThruD = 0;
            decimal totalLossAmountACVEThruF = 0;


            CityMaster  cityMaster  = null;
            StateMaster stateMaster = null;

            string loss_date               = null;
            string dateOpenReported        = string.Empty;
            string dateContacted           = string.Empty;
            string dateInspectionCompleted = string.Empty;



            if (limits.Count >= 4)
            {
                recovDepreA     = limits[0].Depreciation ?? 0;
                recovDepreB     = limits[1].Depreciation ?? 0;
                recovDepreC     = limits[2].Depreciation ?? 0;
                recovDepreTotal = recovDepreA + recovDepreB + recovDepreC;

                nonRecovDepreA     = limits[0].NonRecoverableDepreciation ?? 0;
                nonRecovDepreB     = limits[1].NonRecoverableDepreciation ?? 0;
                nonRecovDepreC     = limits[2].NonRecoverableDepreciation ?? 0;
                nonRecovDepreTotal = nonRecovDepreA + nonRecovDepreB + nonRecovDepreC;

                deductibleA     = limits[0].LimitDeductible ?? 0;
                deductibleB     = limits[1].LimitDeductible ?? 0;
                deductibleC     = limits[2].LimitDeductible ?? 0;
                deductibleTotal = deductibleA + deductibleB + deductibleC;

                limitA = limits[0].LimitAmount ?? 0;
                limitB = limits[1].LimitAmount ?? 0;
                limitC = limits[2].LimitAmount ?? 0;
                limitD = limits[3].LimitAmount ?? 0;

                lossAmountRCVA           = limits[0].LossAmountRCV ?? 0;
                lossAmountRCVB           = limits[1].LossAmountRCV ?? 0;
                lossAmountRCVC           = limits[2].LossAmountRCV ?? 0;
                lossAmountRCVD           = limits[3].LossAmountRCV ?? 0;
                totalLossAmountRCVAThruD = lossAmountRCVA + lossAmountRCVB + lossAmountRCVC + lossAmountRCVD;

                lossAmountACVA           = limits[0].LossAmountACV ?? 0;
                lossAmountACVB           = limits[1].LossAmountACV ?? 0;
                lossAmountACVC           = limits[2].LossAmountACV ?? 0;
                lossAmountACVD           = limits[3].LossAmountACV ?? 0;
                totalLossAmountACVAThruD = lossAmountACVA + lossAmountACVB + lossAmountACVC + lossAmountACVD;
            }

            if (limitsCasuality.Count >= 2)
            {
                limitE = limitsCasuality[0].LimitAmount ?? 0;
                limitF = limitsCasuality[1].LimitAmount ?? 0;

                lossAmountACVE           = limitsCasuality[0].LossAmountACV ?? 0;
                lossAmountACVF           = limitsCasuality[1].LossAmountACV ?? 0;
                totalLossAmountACVEThruF = lossAmountACVE + lossAmountACVF;
            }



            // policy info
            policy_number = policy.PolicyNumber;

            if (carrier != null)
            {
                insurance_company  = carrier.CarrierName;
                insurance_address  = carrier.AddressLine1;
                insurance_address2 = carrier.AddressLine2;
                cityMaster         = carrier.CityMaster;
                insurance_city     = cityMaster == null ? "" : cityMaster.CityName;

                stateMaster       = carrier.StateMaster;
                insurance_state   = stateMaster == null ? "" : stateMaster.StateName;
                insurance_zipcode = carrier.ZipCode;
            }

            // claim info
            claim_number = claim.AdjusterClaimNumber;
            if (claim.LossDate != null)
            {
                loss_date = string.Format("{0:MM-dd-yyyy}", claim.LossDate);
            }

            if (claim.DateOpenedReported != null)
            {
                dateOpenReported = string.Format("{0:MM-dd-yyyy}", claim.DateOpenedReported);
            }

            if (claim.DateContacted != null)
            {
                dateContacted = string.Format("{0:MM-dd-yyyy}", claim.DateContacted);
            }

            if (claim.DateInspectionCompleted != null)
            {
                dateInspectionCompleted = string.Format("{0:MM-dd-yyyy}", claim.DateInspectionCompleted);
            }

            // remove existing fields
            mergeFields.Clear();

            mergeFields.Add(new mergeField("TODAYS_DATE", DateTime.Now.ToShortDateString()));
            mergeFields.Add(new mergeField("CLAIMANT_FIRST_NAME", lead.ClaimantFirstName));
            mergeFields.Add(new mergeField("CLAIMANT_LAST_NAME", lead.ClaimantLastName));



            /////
            mergeFields.Add(new mergeField("LOSS_ADDRESS", lead.LossAddress));
            mergeFields.Add(new mergeField("LOSS_ADDRESS 2", lead.LossAddress2));
            mergeFields.Add(new mergeField("LOSS_STATE", lead.StateName));
            mergeFields.Add(new mergeField("LOSS_CITY", lead.CityName));
            mergeFields.Add(new mergeField("LOSS_ZIPCODE", lead.Zip));
            /////
            mergeFields.Add(new mergeField("CLAIMANT_MAILING_ADDRESS", lead.MailingAddress));
            mergeFields.Add(new mergeField("CLAIMANT_MAILING_STATE", lead.MailingState));
            mergeFields.Add(new mergeField("CLAIMANT_MAILING_CITY", lead.MailingCity));
            mergeFields.Add(new mergeField("CLAIMANT_MAILING_ZIPCODE", lead.MailingZip));

            mergeFields.Add(new mergeField("CLAIMANT_PHONE_NUMBER", lead.PhoneNumber));
            mergeFields.Add(new mergeField("CLAIMANT_EMAIL", lead.EmailAddress));

            mergeFields.Add(new mergeField("POLICY_NO", policy_number));
            mergeFields.Add(new mergeField("CLAIM_NUMBER", claim_number));
            mergeFields.Add(new mergeField("INSURANCE_CO", insurance_company));
            mergeFields.Add(new mergeField("INSURANCE_ADDRESS", insurance_address));
            mergeFields.Add(new mergeField("INSURANCE_ADDRESS2", insurance_address2));
            mergeFields.Add(new mergeField("INSURANCE_CITY", insurance_city));
            mergeFields.Add(new mergeField("INSURANCE_STATE", insurance_state));
            mergeFields.Add(new mergeField("INSURANCE_ZIPCODE", insurance_zipcode));
            mergeFields.Add(new mergeField("INSURANCE_PHONE", insurance_phone_number));

            mergeFields.Add(new mergeField("HOMEOWNER_POLICY_NO", policy_number));
            mergeFields.Add(new mergeField("COMMERCIAL_POLICY_NO", policy_number));
            mergeFields.Add(new mergeField("FLOOD_POLICY_NO", policy_number));
            mergeFields.Add(new mergeField("EARTHQUAKE_POLICY_NO", policy_number));

            mergeFields.Add(new mergeField("HOMEOWNER_CLAIM_NUMBER", claim_number));
            mergeFields.Add(new mergeField("COMMERCIAL_CLAIM_NUMBER", claim_number));
            mergeFields.Add(new mergeField("FLOOD_CLAIM_NUMBER", claim_number));
            mergeFields.Add(new mergeField("EARTHQUAKE_CLAIM_NUMBER", claim_number));

            mergeFields.Add(new mergeField("HOMEOWNER_INSURANCE_CO", insurance_company));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_ADDRESS", insurance_address));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_ADDRESS2", insurance_address2));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_CITY", insurance_city));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_STATE", insurance_state));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_ZIPCODE", insurance_zipcode));
            mergeFields.Add(new mergeField("HOMEONWER_INSURANCE_PHONE", insurance_phone_number));


            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_CO", insurance_company));
            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_ADDRESS", insurance_address));
            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_CITY", insurance_city));
            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_STATE", insurance_state));
            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_ZIPCODE", insurance_zipcode));
            mergeFields.Add(new mergeField("COMMERCIAL_INSURANCE_PHONE", insurance_phone_number));

            mergeFields.Add(new mergeField("FLOOD_INSURANCE_CO", insurance_company));
            mergeFields.Add(new mergeField("FLOOD_INSURANCE_ADDRESS", insurance_address));
            mergeFields.Add(new mergeField("FLOOD_INSURANCE_CITY", insurance_city));
            mergeFields.Add(new mergeField("FLOOD_INSURANCE_STATE", insurance_state));
            mergeFields.Add(new mergeField("FLOOD_INSURANCE_ZIPCODE", insurance_zipcode));
            mergeFields.Add(new mergeField("FLOOD_INSURANCE_PHONE", insurance_phone_number));

            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_CO", insurance_company));
            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_ADDRESS", insurance_address));
            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_CITY", insurance_city));
            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_STATE", insurance_state));
            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_ZIPCODE", insurance_zipcode));
            mergeFields.Add(new mergeField("EARTHQUAKE_INSURANCE_PHONE", insurance_phone_number));



            mergeFields.Add(new mergeField("LOSS_DATE", loss_date));

            if (!string.IsNullOrEmpty(claim.CauseOfLoss))
            {
                string[] causeOfLossDescriptions = TypeofDamageManager.GetDescriptions(claim.CauseOfLoss);

                mergeFields.Add(new mergeField("DAMAGE_CAUSE", string.Join(",", causeOfLossDescriptions)));
            }

            if (portal != null)
            {
                mergeFields.Add(new mergeField("OFFICE_NAME", portal.BusinessName));
                mergeFields.Add(new mergeField("FEDERAL_ID_NO", portal.FederalIDNo));
                mergeFields.Add(new mergeField("OFFICE_ADDRESS", portal.StreetAddress1 ?? "" + " " + lead.Client.StreetAddress2 ?? ""));
                mergeFields.Add(new mergeField("OFFICE_CITY", portal.CityMaster == null ? "" : lead.Client.CityMaster.CityName));
                mergeFields.Add(new mergeField("OFFICE_STATE", portal.StateMaster == null ? "" : lead.Client.StateMaster.StateName));
                if (portal.ZipCode != null)
                {
                    mergeFields.Add(new mergeField("OFFICE_ZIPCODE", getZipCode(portal.ZipCode)));
                }
            }

            ///// ADD BY CHETU TEAM
            mergeFields.Add(new mergeField("INSURED_NAME", lead.InsuredName));
            mergeFields.Add(new mergeField("INSURER_CLAIM_NUMBER", claim.InsurerClaimNumber));


            mergeFields.Add(new mergeField("ESTIMATOR_NAME", claim.AdjusterMaster.AdjusterName));
            mergeFields.Add(new mergeField("ESTIMATOR_CELL_PHONE", claim.AdjusterMaster.PhoneNumber));
            mergeFields.Add(new mergeField("ESTIMATOR_EMAIL", claim.AdjusterMaster.email));
            mergeFields.Add(new mergeField("TYPE_OF_LOSS", claim.TypeofLoss));
            string carrierExaminer = ClaimsManager.GetContactByContactID(claim.ManagerID ?? 0);

            mergeFields.Add(new mergeField("CARRIER_EXAMINER", carrierExaminer));
            mergeFields.Add(new mergeField("RECOVERABLEDEPRECIATION", Convert.ToString(claim.Depreciation)));
            mergeFields.Add(new mergeField("NONRECOVERABLEDEPRECIATION", Convert.ToString(claim.NonRecoverableDepreciation)));
            mergeFields.Add(new mergeField("MORTGAGEENAME", Convert.ToString(lienHolder.Mortgagee.MortageeName)));
            mergeFields.Add(new mergeField("LOANNUMBER", Convert.ToString(lienHolder.LoanNumber)));
            /////////////
            mergeFields.Add(new mergeField("RECOVERABLEDEPRECIATION_A", Convert.ToString(recovDepreA)));
            mergeFields.Add(new mergeField("RECOVERABLEDEPRECIATION_B", Convert.ToString(recovDepreB)));
            mergeFields.Add(new mergeField("RECOVERABLEDEPRECIATION_C", Convert.ToString(recovDepreC)));
            mergeFields.Add(new mergeField("RECOVERABLEDEPRECIATION_TOTAL", Convert.ToString(recovDepreTotal)));

            mergeFields.Add(new mergeField("NONRECOVERABLEDEPRECIATION_A", Convert.ToString(nonRecovDepreA)));
            mergeFields.Add(new mergeField("NONRECOVERABLEDEPRECIATION_B", Convert.ToString(nonRecovDepreB)));
            mergeFields.Add(new mergeField("NONRECOVERABLEDEPRECIATION_C", Convert.ToString(nonRecovDepreC)));
            mergeFields.Add(new mergeField("NONRECOVERABLEDEPRECIATION_Total", Convert.ToString(nonRecovDepreTotal)));

            mergeFields.Add(new mergeField("DEDUCTIBLE_A", Convert.ToString(deductibleA)));
            mergeFields.Add(new mergeField("DEDUCTIBLE_B", Convert.ToString(deductibleB)));
            mergeFields.Add(new mergeField("DEDUCTIBLE_C", Convert.ToString(deductibleC)));
            mergeFields.Add(new mergeField("DEDUCTIBLE_Total", Convert.ToString(deductibleTotal)));

            mergeFields.Add(new mergeField("LIMIT_A", Convert.ToString(limitA)));
            mergeFields.Add(new mergeField("LIMIT_B", Convert.ToString(limitB)));
            mergeFields.Add(new mergeField("LIMIT_C", Convert.ToString(limitC)));
            mergeFields.Add(new mergeField("LIMIT_D", Convert.ToString(limitD)));

            mergeFields.Add(new mergeField("LOSSAMOUNT_RCV_A", Convert.ToString(lossAmountRCVA)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_RCV_B", Convert.ToString(lossAmountRCVB)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_RCV_C", Convert.ToString(lossAmountRCVC)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_RCV_D", Convert.ToString(lossAmountRCVD)));
            mergeFields.Add(new mergeField("TOTAL_LOSS_AMOUNT_A_THRU_DRCV", Convert.ToString(totalLossAmountRCVAThruD)));

            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_A", Convert.ToString(lossAmountACVA)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_B", Convert.ToString(lossAmountACVB)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_C", Convert.ToString(lossAmountACVC)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_D", Convert.ToString(lossAmountACVD)));
            mergeFields.Add(new mergeField("TOTAL_LOSS_AMOUNT_A_THRU_DACV", Convert.ToString(totalLossAmountACVAThruD)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_E", Convert.ToString(lossAmountACVE)));
            mergeFields.Add(new mergeField("LOSSAMOUNT_ACV_F", Convert.ToString(lossAmountACVF)));
            mergeFields.Add(new mergeField("TOTAL_LOSS_AMOUNT_E_THRU_FACV", Convert.ToString(totalLossAmountACVAThruD)));

            mergeFields.Add(new mergeField("DATEOPEN_REPORTED", dateOpenReported));
            mergeFields.Add(new mergeField("DATE_CONTACTED", dateContacted));
            mergeFields.Add(new mergeField("DATE_INSPECTION_COMPLETED", dateInspectionCompleted));
            mergeFields.Add(new mergeField("EFFECTIVE_DATE", ""));
            mergeFields.Add(new mergeField("EXPIRY_DATE", ""));



            // build field name arrays
            fieldNames = mergeFields.Select(x => x.fieldName).ToArray();

            // build field value arrays
            fieldValues = mergeFields.Select(x => x.fieldValue).ToArray();
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        static public 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);
        }
コード例 #13
0
        public async Task <ActionResult> GetLeadPolicyData(Guid?lid)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var orgId  = _context.Users.Where(x => x.Id == userId).FirstOrDefault().OrganisationId;

            var leadDebitVM = new LeadDebitVM();

            LeadPolicy leadPolicy = _context.LeadPolicies.Where(l => l.Id == lid).FirstOrDefault();

            Client client = _context.Clients.Where(c => c.Id == leadPolicy.ClientId).FirstOrDefault();

            Branch branch = _context.Branches.Where(b => b.OrganisationId == orgId).FirstOrDefault();

            Organisation organisation = _context.Organisations.Where(o => o.Id == orgId).FirstOrDefault();

            var leadPaymentDetail = _context.LeadPaymentDetails.Where(d => d.DebitNoteId == leadPolicy.DebitNoteId).FirstOrDefault();
            var insurerId         = _context.InsurerMasters.Where(i => i.Id == leadPolicy.InsurerMasterId).FirstOrDefault().GlobalInsurerId;
            var policyMasters     = _context.PolicyClassMaster.ToList();

            leadDebitVM.leadPolicy       = leadPolicy;
            leadDebitVM.addresss         = organisation.Address;
            leadDebitVM.organisationName = organisation.OrganisationName;
            leadDebitVM.amountReceived   = "";
            leadDebitVM.city             = organisation.City;
            leadDebitVM.currency         = "";
            leadDebitVM.customerAddress  = client.Address;
            leadDebitVM.clientId         = client.Id.ToString();
            leadDebitVM.email            = organisation.Email;
            leadDebitVM.endorsementNo    = "";

            leadDebitVM.leadPolicy  = leadPolicy;
            leadDebitVM.paymentMode = "";
            leadDebitVM.phone       = organisation.PhoneNumber;
            leadDebitVM.policyName  = Util.GetPolicyName(policyMasters, leadPolicy.PolicyClassId);
            if (string.IsNullOrEmpty(leadDebitVM.leadPolicy.PolicyNo))
            {
                leadDebitVM.policyNo = "TBA";
            }
            else
            {
                leadDebitVM.policyNo = leadDebitVM.leadPolicy.PolicyNo;
            }
            leadDebitVM.riskType        = "";
            leadDebitVM.transcationType = "";
            leadDebitVM.branchName      = branch.BranchName;
            leadDebitVM.customerNo      = client.ClientCode.ToString();
            leadDebitVM.insurerName     = Util.GetInsurerName(_context, insurerId);
            leadDebitVM.imageUrl        = Util.GetImageUrl(organisation.ImageUrl);
            leadDebitVM.Client          = client;

            var leadPolicyDebitNote = new LeadPolicyDebitNote();

            leadDebitVM.isNew = false;
            if (leadPolicy.DebitNoteId == null || leadPolicy.DebitNoteId == Guid.Empty)
            {
                leadPolicyDebitNote.PolicyNo       = leadPolicy.PolicyNo;
                leadPolicyDebitNote.EndorsementNo  = leadPolicy.EndorsementNo;
                leadPolicyDebitNote.ID             = Guid.NewGuid();
                leadPolicyDebitNote.CreatedBy      = Guid.Parse(userId);
                leadPolicyDebitNote.ModifiedBy     = Guid.Parse(userId);
                leadPolicyDebitNote.LeadId         = leadPolicy.Id;
                leadPolicyDebitNote.OrganisationId = orgId;
                _context.Add(leadPolicyDebitNote);

                leadPolicy.DebitNoteId = leadPolicyDebitNote.ID;

                _context.Update(leadPolicy);
                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                }
                leadDebitVM.isNew = true;

                StatusMessage             = StaticContent.DEBITNOTE_GENERATE_SUCCESS_MSG;
                ViewData["StatusMessage"] = StatusMessage;
            }

            leadDebitVM.leadPolicyDebitNote = _context.LeadPolicyDebitNotes.Where(l => l.ID == leadPolicy.DebitNoteId).OrderByDescending(a => a.DateCreated).SingleOrDefault();
            leadDebitVM.preparedBy          = _context.Users.Where(x => x.Id == leadDebitVM.leadPolicyDebitNote.CreatedBy.ToString()).FirstOrDefault().FirstName;


            return(PartialView("DebitNotePartial", leadDebitVM));
        }
コード例 #14
0
        public static int Update(LeadPolicy policy)
        {
            LeadPolicy policy2 = DbContextHelper.DbContext.LeadPolicy.First(x=>x.Id==policy.Id);
            if (policy2!=null)
            {
            policy2.ApplyAcrossAllCoverage = policy.ApplyAcrossAllCoverage;
            DbContextHelper.DbContext.SaveChanges();
            }

            return policy.Id;
        }
コード例 #15
0
        public static int Save(LeadPolicy policy)
        {
            if (policy.Id == 0) {
                DbContextHelper.DbContext.Add(policy);
            }

            DbContextHelper.DbContext.SaveChanges();

            return policy.Id;
        }
コード例 #16
0
        static public List <InvoiceView> GetInvoiceForReport(int invoiceID)
        {
            InvoiceView        invoice      = null;
            List <InvoiceView> invoices     = new List <InvoiceView>();
            Invoice            claimInvoice = null;
            Client             client       = null;
            LeadPolicy         policy       = null;
            Leads         lead          = null;
            ZipCodeMaster zipCodeMaster = null;

            //ClaimService mActivity = null;


            claimInvoice = (from x in DbContextHelper.DbContext
                            .Invoice
                            .Include("InvoiceDetail")
                            .Include("InvoiceDetail.InvoiceServiceType")
                            .Include("InvoiceDetail.InvoiceServiceType.InvoiceServiceUnit")
                            .Include("Claim")
                            .Include("Claim.LeadPolicy.Leads.Client")
                            .Include("Claim.LeadPolicy.Leads.Client.StateMaster")
                            .Include("Claim.LeadPolicy.Leads.Client.CityMaster")
                            .Include("Claim.LeadPolicy")
                            .Include("Claim.LeadPolicy.LeadPolicyType")
                            .Include("Claim.ClaimService")
                            where x.InvoiceID == invoiceID

                            select x
                            ).FirstOrDefault <Invoice>();

            if (claimInvoice != null)
            {
                invoice               = new InvoiceView();
                invoice.invoiceID     = claimInvoice.InvoiceID;
                invoice.invoiceDate   = (DateTime)claimInvoice.InvoiceDate;
                invoice.dueDate       = claimInvoice.DueDate == null ? DateTime.Now : (DateTime)claimInvoice.DueDate;
                invoice.invoiceNumber = (int)(claimInvoice.InvoiceNumber ?? 0);

                invoice.billTo         = claimInvoice.BillToName;
                invoice.billToAddress1 = claimInvoice.BillToAddress1;
                invoice.billToAddress2 = claimInvoice.BillToAddress2;
                invoice.billToAddress3 = claimInvoice.BillToAddress3;
                invoice.totalAmount    = claimInvoice.TotalAmount ?? 0;

                //invoice.activity = claimInvoice.Claim.ClaimService NEW OC 9/30/14

                //invoice.adjusterInvoiceNumber = claimInvoice.AdjusterInvoiceNumber;

                // get policy type associated with invoice
                //claimInvoice.Lead.LeadPolicies.FirstOrDefault(x => x.PolicyType == claimInvoice.PolicyTypeID);

                //mActivity = claimInvoice.Claim.ClaimService.FirstOrDefault();
                //invoice.activity = mActivity.Activity;

                policy = claimInvoice.Claim.LeadPolicy;
                if (policy != null)
                {
                    invoice.policyType   = policy.LeadPolicyType == null ? "" : policy.LeadPolicyType.Description;
                    invoice.policyNumber = policy.PolicyNumber;

                    lead = policy.Leads;
                }

                invoice.claimNumber           = claimInvoice.Claim.AdjusterClaimNumber;
                invoice.insurerFileNo         = claimInvoice.Claim.InsurerClaimNumber;
                invoice.adjusterInvoiceNumber = claimInvoice.InvoiceNumber.ToString();

                if (lead != null)
                {
                    invoice.claimantName     = lead.InsuredName;//policyHolderName; OC  9/30/14
                    invoice.claimantAddress1 = lead.LossAddress;
                    invoice.claimantAddress2 = lead.LossAddress2;
                    invoice.claimantAddress3 = string.Format("{0}, {1} {2}",
                                                             lead.CityName ?? "",
                                                             lead.StateName ?? "",
                                                             lead.Zip ?? "");

                    client = lead.Client;
                }

                invoice.taxRate = claimInvoice.TaxRate;

                if (claimInvoice.Claim.LossDate != null)
                {
                    invoice.claimDate = (DateTime)claimInvoice.Claim.LossDate;
                }

                invoice.invoiceLines = claimInvoice.InvoiceDetail.ToList();

                // add sales tax
                if (invoice.taxRate > 0)
                {
                    InvoiceDetail invoiceTaxLine = new InvoiceDetail();
                    invoiceTaxLine.InvoiceID       = invoice.invoiceID;
                    invoiceTaxLine.LineDescription = "Sales Tax";
                    //invoiceTaxLine.isBillable = true;
                    invoiceTaxLine.LineAmount = invoice.totalAmount * (invoice.taxRate / 100);
                    invoiceTaxLine.Activity   = invoice.activity;
                    invoice.invoiceLines.Add(invoiceTaxLine);
                }

                if (client != null)
                {
                    client = lead.Client;

                    invoice.clientName     = client.BusinessName;
                    invoice.clientAddress1 = client.StreetAddress1;
                    invoice.clientAddress2 = client.StreetAddress2;

                    string stateName = client.StateMaster != null ? client.StateMaster.StateCode : "";
                    string cityName  = client.CityMaster != null ? client.CityMaster.CityName : "";
                    string zipCode   = client.ZipCode ?? "";

                    // this is badly designed.
                    if (!string.IsNullOrEmpty(zipCode))
                    {
                        zipCodeMaster = ZipCode.Get(zipCode);
                        if (zipCodeMaster != null)
                        {
                            zipCode = zipCodeMaster.ZipCode;
                        }
                    }

                    invoice.clientAddress3 = cityName + ", " + stateName + " " + zipCode;

                    invoice.clientPhone = client.PrimaryPhoneNo;
                    invoice.clientFax   = client.SecondaryPhoneNo;
                    invoice.clientEmail = client.PrimaryEmailId;
                    invoice.federalIDNo = client.FederalIDNo;

                    invoice.logoPath = string.Format("{0}/ClientLogo/{1}.jpg", ConfigurationManager.AppSettings["appURL"].ToString(), client.ClientId);
                }
                else
                {
                    invoice.logoPath       = ConfigurationManager.AppSettings["appURL"].ToString() + "/images/claim_ruler_logo.jpg";
                    invoice.clientName     = "Claim Ruler Demo";
                    invoice.clientAddress1 = "400 East Las Olas Blvd";
                    invoice.clientAddress2 = "Suite 404";
                    invoice.clientAddress3 = "Ft. Lauderdale, FL 33301";
                    invoice.clientPhone    = "999-999-9999";
                    invoice.clientFax      = "999-999-9999";
                    invoice.clientEmail    = "*****@*****.**";
                    invoice.federalIDNo    = "99999999";
                }

                invoices.Add(invoice);
            }

            return(invoices);
        }