protected void gvSearchResult_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LeadView leadView = e.Row.DataItem as LeadView; HiddenField hf_lossLocation = e.Row.FindControl("hf_lossLocation") as HiddenField; HyperLink lnkLead = e.Row.FindControl("hlnkLead") as HyperLink; // navigation link to lead lnkLead.NavigateUrl = "~/Protected/NewLead.aspx?id=" + leadView.LeadId.ToString(); lnkLead.Text = leadView.InsuredName;// string.Format("{0}, {1}", leadView.ClaimantLastName, leadView.ClaimantFirstName); // loss address information for map hf_lossLocation.Value = string.Format("{0} {1}|{2} {3} {4} {5}", leadView.ClaimantFirstName, leadView.ClaimantLastName, leadView.LossAddress, leadView.CityName, leadView.StateName, leadView.Zip); if (string.IsNullOrEmpty(leadView.Email)) { e.Row.CssClass = "red"; } } }
public static List <LeadView> GetLeads(Expression <Func <Leads, bool> > predicate) { List <Leads> leads = GetPredicate(predicate); List <LeadView> listView = null; LeadView leadView = null; string[] claimNumbers = null; string[] companynames = null; string[] statusNames = null; string[] statusCodes = null; if (leads != null) { listView = new List <LeadView>(); foreach (Leads x in leads) { leadView = new LeadView(); leadView.LeadId = x.LeadId; leadView.ClaimantLastName = x.ClaimantLastName; leadView.ClaimantFirstName = x.ClaimantFirstName; leadView.InsuredName = x.InsuredName; leadView.BusinessName = x.BusinessName; leadView.Email = x.EmailAddress; leadView.OriginalLeadDate = x.OriginalLeadDate; // get claim numbers claimNumbers = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true select c.AdjusterClaimNumber).ToArray(); leadView.ClaimNumber = string.Join("<br>", claimNumbers); // get claim status statusNames = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.StatusMaster != null select c.StatusMaster.StatusName).ToArray(); leadView.StatusName = string.Join("<br>", statusNames); // get claim status code statusCodes = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.StatusMaster != null select c.StatusMaster.StatusId.ToString()).ToArray(); leadView.StatusCodes = string.Join("<br>", statusNames); // loss date leadView.LossDates = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.LossDate != null select c.LossDate).ToArray(); string[] adjusterNames = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.AdjusterMaster != null select c.AdjusterMaster.adjusterName).ToArray(); leadView.AdjusterName = string.Join("<br>", adjusterNames); string[] coverages = (from e in x.LeadPolicy where e.IsActive && e.PolicyType != null select e.LeadPolicyType.Description).ToArray(); leadView.Coverage = string.Join("<br>", coverages); string[] claimSubStatues = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.SubStatusMaster != null select c.SubStatusMaster.SubStatusName).ToArray(); leadView.SubStatusName = string.Join(" ", claimSubStatues); //companynames = (from p in x.LeadPolicies where p.IsActive && p.Carrier != null select p.Carrier.CarrierName).ToArray(); companynames = (from p in x.LeadPolicy where p.IsActive && p.InsuranceCompanyName != null select p.InsuranceCompanyName).ToArray(); leadView.InsuranceCompanyName = string.Join("<br>", companynames); string[] claimWorkFlowTypes = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.ClaimWorkflowType != null select c.ClaimWorkflowType).ToArray(); leadView.ClaimWorkflowType = string.Join("<br>", claimWorkFlowTypes); string[] eventTypes = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.EventType != null select c.EventType).ToArray(); leadView.EventType = string.Join("<br>", eventTypes); string[] eventNames = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.EventName != null select c.EventName).ToArray(); leadView.EventName = string.Join("<br>", eventNames); int[] severities = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.SeverityNumber != null select c.SeverityNumber).Cast <int>().ToArray(); //leadView.Severity = string.Join("<br>", severities.Select(s => s.ToString()).ToArray()); // get it from claim string[] causeOfLoss = (from p in x.LeadPolicy from c in p.Claim where c.IsActive == true && c.CauseOfLoss != null select c.CauseOfLoss).ToArray(); if (causeOfLoss != null && causeOfLoss.Length > 0) { // get it from claim leadView.TypeofDamageText = ""; foreach (string idList in causeOfLoss) { if (!string.IsNullOrEmpty(idList)) { string[] damageDescriptions = TypeofDamageManager.GetDescriptions(idList); leadView.TypeofDamageText = string.Join("<br>", damageDescriptions); } } } else if (!string.IsNullOrEmpty(x.TypeOfDamage)) { // get it from Lead leadView.TypeofDamageText = string.Join("<br>", x.TypeofDamageText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); } leadView.CityName = x.CityName; leadView.StateName = x.StateName; leadView.Zip = x.Zip; leadView.MailingCity = x.MailingCity; leadView.MailingState = x.MailingState; leadView.MailingZip = x.MailingZip; leadView.LeadSourceName = x.LeadSourceMaster == null ? "" : x.LeadSourceMaster.LeadSourceName; leadView.TypeOfProperty = x.TypeOfPropertyMaster == null ? "" : x.TypeOfPropertyMaster.TypeOfProperty; leadView.ContractorName = x.ContractorMaster == null ? "" : x.ContractorMaster.ContractorName; leadView.AppraiserName = x.AppraiserMaster == null ? "" : x.AppraiserMaster.AppraiserName; leadView.UmpireName = x.UmpireMaster == null ? "" : x.UmpireMaster.UmpireName; leadView.ProducerName = x.ProducerMaster == null ? "" : x.ProducerMaster.ProducerName; leadView.UserName = x.SecUser == null ? "" : x.SecUser.UserName; //leadView.LossDate = x.LossDate; leadView.SiteSurveyDate = x.SiteSurveyDate; leadView.LastActivityDate = x.LastActivityDate; listView.Add(leadView); } } return(listView); }