public Lead AddOrUpdateCoregLead(Lead coreglead) { var lead = _db.CbrLeads.FirstOrDefault(l => l.EmailAddress == coreglead.Email && l.OfferId == coreglead.OfferId && l.AffiliateId == coreglead.AffiliateId); if (lead == null) { lead = new CbrLead(); lead.CountryId = GetCountry(coreglead.Ip); _db.CbrLeads.Add(lead); } else { if (coreglead.OfferId != "57048") { coreglead.IsDuplicate = true; } } if (string.IsNullOrEmpty(lead.CountryId)) { lead.CountryId = GetCountry(coreglead.Ip); } LeadMapper.Map(coreglead, lead); _db.SaveChanges(); coreglead.CBRLeadId = lead.CbrLeadId; return(coreglead); }
protected void UpdateLeadCityStateIP(XVerifyManager xvm, CbrLead lead, string ipAddress) { //Update state/city/ip if (string.IsNullOrWhiteSpace(lead.City) || string.IsNullOrWhiteSpace(lead.State)) { //used cached xverify info if available if (xvm.IpInfo?.ipdata != null) { lead.City = xvm.IpInfo.ipdata.city; lead.State = xvm.IpInfo.ipdata.region; } else { var ipInfo = xvm.GetIpVerification(ipAddress); lead.City = ipInfo.ipdata.city; lead.State = ipInfo.ipdata.region; } _db.SaveChanges(); } if (lead.Ip != ipAddress) { lead.Ip = ipAddress; _db.SaveChanges(); } }
protected string GenderGetSingleCharacter(CbrLead lead) { var gender = ""; if (!string.IsNullOrWhiteSpace(lead.Gender)) { gender = lead.Gender.Substring(0, 1).ToUpper(); } return(gender); }
internal static Lead Map(CbrLead cbrlead) { return(new Lead() { Address = cbrlead.Address, Address2 = cbrlead.Address2, AffiliateId = cbrlead.AffiliateId, BirthDate = GetBirthDate(cbrlead.BirthdayDay, cbrlead.BirthdayMonth, cbrlead.BirthdayYear) }); }
protected void UpdateLeadAccepted(CoregPostRequestBase postRequest, CbrLead lead) { var campaign = _db.CoregCampaigns.First(c => c.CoregCampaignId == (int)postRequest.CampaignCodeId); _db.CoregLeadAccepteds.Add(new CoregLeadAccepted() { CbrLeadId = lead.CbrLeadId, CoregCampaignId = (int)postRequest.CampaignCodeId, CoregPartnerId = campaign.CoregPartnerId }); _db.SaveChanges(); }
private void SwapSpacesForPlusSign(EngageIqRequest request, CbrLead lead) { int sso = (int)StringSplitOptions.None; //Lead if (!string.IsNullOrWhiteSpace(lead.Address)) { lead.Address = lead.Address.Replace(" ", "="); } //Questions if (!string.IsNullOrWhiteSpace(request.Q1)) { request.Q1 = request.Q1.Replace(" ", "+"); } if (!string.IsNullOrWhiteSpace(request.Q2)) { request.Q2 = request.Q2.Replace(" ", "+"); } if (!string.IsNullOrWhiteSpace(request.Q3)) { request.Q3 = request.Q3.Replace(" ", "+"); } if (!string.IsNullOrWhiteSpace(request.Q4)) { request.Q4 = request.Q4.Replace(" ", "+"); } if (!string.IsNullOrWhiteSpace(request.Q5)) { request.Q5 = request.Q5.Replace(" ", "+"); } if (!string.IsNullOrWhiteSpace(request.Q6)) { request.Q6 = request.Q6.Replace(" ", "+"); } // Comments if (!string.IsNullOrWhiteSpace(request.Comments1)) { request.Comments1 = request.Comments1.Replace(" ", "+"); } }
internal static void Map(Lead lead, CbrLead cbrLead) { cbrLead.Address = lead.Address; if (lead.BirthDate.HasValue) { cbrLead.BirthdayDay = lead.BirthDate.Value.Day; cbrLead.BirthdayMonth = lead.BirthDate.Value.Month; cbrLead.BirthdayYear = lead.BirthDate.Value.Year; } //cbrLead.CountryId = lead.CountryId; cbrLead.EmailAddress = lead.Email; cbrLead.Firstname = lead.Firstname; cbrLead.Lastname = lead.Lastname; cbrLead.Gender = lead.Gender?.Substring(0, 1); cbrLead.Phone = lead.Phone; cbrLead.State = lead.State; cbrLead.Zip = lead.Zip; cbrLead.OfferId = lead.OfferId; cbrLead.AffiliateId = lead.AffiliateId; cbrLead.SubId = lead.SubId; }