Exemplo n.º 1
0
        internal static string BuildLifeURL(CommonLead cmnLead, LifeLead prodLead, MatchBuyer matchbuyer)
        {
            //initialise
            var ob = new
            {
                lp_campaign_id  = "5ac60d402aed5",
                lp_campaign_key = "GHdng47p3TkxmbWzJNML",
                //lp_test =1,
                first_name          = cmnLead.FirstName ?? string.Empty,
                last_name           = cmnLead.LastName ?? string.Empty,
                life_insurance_type = prodLead.ProductType,
                cover_for           = prodLead.SingleOwnership ? "Single" : "Joint",
                cover_size          = prodLead.CoverAmount.ToString(),
                cover_length        = prodLead.CoverPeriod.ToString(),
                tobacco             = prodLead.Smoker ? "yes" : "No",
                dob_day             = prodLead.DOB.Day,
                dob_month           = prodLead.DOB.Month,
                dob_year            = prodLead.DOB.Year,
                house_number        = cmnLead.Address,
                postcode            = cmnLead.PostCode,
                mobile        = cmnLead.HomePhone,
                email_address = cmnLead.Email,
            };

            string queryString = UtilityMethods.GetQueryString(ob);

            return(queryString);
        }
Exemplo n.º 2
0
        public ActionResult Index(CompleteFormModel model)
        {
            if (ModelState.IsValid)
            {
                FilterModel filData = TempData["FilterModel"] as FilterModel;

                var Dob = DateTime.Parse(SqlDateTime.MinValue.ToString());
                if (model.Day != 0 && model.Month != 0 && model.Year != 0)
                {
                    var daysOfMonth = DateTime.DaysInMonth(model.Year, model.Month);
                    if (daysOfMonth < model.Day)
                    {
                        model.Day = daysOfMonth;
                    }
                    Dob = new DateTime(model.Year, model.Month, model.Day);
                }
                LifeLead lead = new LifeLead()
                {
                    Address           = model.Address,
                    City              = string.Empty,
                    Email             = model.Email,
                    FirstName         = model.FirstName,
                    GeneratedDateTime = DateTime.Now,
                    HomePhone         = model.HomePhone,
                    Source            = Session["Source"] as string ?? null,
                    Keyword           = Session["Keyword"] as string ?? null,
                    MatchType         = Session["Match"] as string ?? null,
                    IpAddress         = Session["RemoteIPAddress"] as string ?? null,
                    LastName          = model.LastName,
                    PostCode          = model.PostCode,
                    ProductName       = "Life",
                    SiteId            = 1,
                    Status            = "New",
                    Title             = model.Title,
                    WorkPhone         = model.HomePhone ?? model.WorkPhone,
                    CoverAmount       = filData.CoverAmount,
                    CoverPeriod       = filData.CoverPeriod,
                    ProductType       = filData.ProductType,
                    Smoker            = model.Smoker,
                    SingleOwnership   = filData.SingleOwnership,
                    DOB = Dob,
                    Age = CalculateAge(Dob)
                };

                // var id = _captureService.NewAdminLeadCapture(lead, "http://localhost:3431/dataConverstion/capture");

                var id = _captureService.NewAdminLeadCapture(lead, "https://api.websearchmedia.co.uk/dataConverstion/capture");
                //  var id = _captureService.NewAdminLeadCapture(lead, "");
                if (id > 0)
                {
                    TempData["LeadId"] = id;
                }
                else
                {
                }
                return(RedirectToAction("Index", "Thank"));
            }
            return(View());
        }
Exemplo n.º 3
0
        public IHttpActionResult CaptureLead(AllFieldCapture lead)
        {
            try
            {
                string prodName = UtilityMethods.GetProductName(lead.ProductName);

                CommonLead cmnLead = Mapper.Map <CommonLead>(lead);
                if (cmnLead.FirstName.Contains("test") || cmnLead.LastName.Contains("test") || cmnLead.FirstName.ToLower().Contains("test"))
                {
                    cmnLead.Status = EntityObjects.Enaum.LeadType.test;
                }
                _dbContext.CommonLeads.Add(cmnLead);
                _dbContext.SaveChanges();
                if (prodName == GlobalConstant.Life)
                {
                    LifeLead lifeLead = Mapper.Map <LifeLead>(lead);
                    lifeLead.CommonLeadId = cmnLead.Id;
                    _dbContext.LifeLeads.Add(lifeLead);
                }
                else if (prodName == GlobalConstant.Funeral)
                {
                    FuneralLead funeralLead = Mapper.Map <FuneralLead>(lead);
                    funeralLead.CommonLeadId = cmnLead.Id;
                    _dbContext.FuneralLeads.Add(funeralLead);
                }
                else if (prodName == GlobalConstant.Health)
                {
                    HealthLead healthLead = Mapper.Map <HealthLead>(lead);
                    healthLead.CommonLeadId = cmnLead.Id;
                    _dbContext.HealthLeads.Add(healthLead);
                }
                else if (prodName == GlobalConstant.CorporateHealth)
                {
                    CorporateHealthLead corporateHealthLead = Mapper.Map <CorporateHealthLead>(lead);
                    corporateHealthLead.CommonLeadId = cmnLead.Id;
                    _dbContext.CorporateHealthLeads.Add(corporateHealthLead);
                }
                _dbContext.SaveChanges();
                if (cmnLead.FirstName.Contains("test"))
                {
                    return(Ok(new { result = "success", ref_id = cmnLead.Id }));
                }
                if (cmnLead.FirstName.Contains("Test"))
                {
                    return(Ok(new { result = "success", ref_id = cmnLead.Id }));
                }

                LeadTransfer(cmnLead.Id);

                return(Ok(new { result = "success", ref_id = cmnLead.Id }));
            }
            catch (Exception ex)
            {
                return(BadRequest("faild"));
            }
            return(Ok());
        }
Exemplo n.º 4
0
Arquivo: VM.cs Projeto: 6670/lifeAdmin
        internal static string BuildLifeURL(CommonLead cmnLead, LifeLead prodLead, MatchBuyer matchbuyer)
        {
            var src = "ppcsearch";

            try
            {
                if (!string.IsNullOrWhiteSpace(cmnLead.Source) && cmnLead.Source.Contains("facebook"))
                {
                    src = "facebook";
                }
            }
            catch (Exception ex)
            {
            }
            ;

            var obj = new
            {
                affiliate_campaign_id = 273,
                vmform_hash           = "03AEE",
                vmform_ip             = cmnLead.IpAddress.Trim(),
                vmform_referer        = "https://lifeinsurancedeal.co.uk",
                vmform_siteid         = 1406,
                vmform_source         = src,
                joint_application     = prodLead.SingleOwnership ? "No" : "Yes",
                insurance_type        = "Life Insurance only",
                cover_amount          = prodLead.CoverAmount,
                cover_length          = prodLead.CoverPeriod,
                first_name            = cmnLead.FirstName.Trim(),
                last_name             = cmnLead.LastName.Trim(),
                address_line_1        = cmnLead.Address.Trim(),
                postcode  = cmnLead.PostCode,
                dob       = prodLead.DOB.ToString("dd-MM-yyyy"),
                smoker    = prodLead.Smoker ? "Yes" : "No",
                telephone = cmnLead.HomePhone,
                mobile    = cmnLead.WorkPhone,
                email     = cmnLead.Email.Trim()
            };
            string queryString = UtilityMethods.GetQueryString(obj);

            return(queryString);
        }
Exemplo n.º 5
0
Arquivo: VM.cs Projeto: 6670/lifeAdmin
        internal static TransferLog SendXML(CommonLead cmnLead, MatchBuyer matchBuyer)
        {
            TransferLog tLog = null;
            DateTime    generatedDateTime = new DateTime();
            string      serverPost        = "";

            if (cmnLead.ProductName.Equals(GlobalConstant.Life))//Life
            {
                LifeLead prodLead = UtilityMethods.GetProductLeadByLeadId <LifeLead>(cmnLead.Id, cmnLead.ProductName);
                generatedDateTime = DateTime.Now;
                serverPost        = BuildLifeURL(cmnLead, prodLead, matchBuyer);
            }
            else if (cmnLead.ProductName.Equals(GlobalConstant.Funeral))// funeral
            {
                FuneralLead prodLead = UtilityMethods.GetProductLeadByLeadId <FuneralLead>(cmnLead.Id, cmnLead.ProductName);
                generatedDateTime = DateTime.Now;
                serverPost        = BuildFuneralURL(cmnLead, prodLead, matchBuyer);
            }
            else if (cmnLead.ProductName.Equals(GlobalConstant.Health))// Health
            {
                HealthLead prodLead = UtilityMethods.GetProductLeadByLeadId <HealthLead>(cmnLead.Id, cmnLead.ProductName);
                generatedDateTime = DateTime.Now;
                serverPost        = BuildHealthURL(cmnLead, prodLead, matchBuyer);
            }
            else if (cmnLead.ProductName.Equals(GlobalConstant.CorporateHealth))//Corporate Health
            {
                CorporateHealthLead prodLead = UtilityMethods.GetProductLeadByLeadId <CorporateHealthLead>(cmnLead.Id, cmnLead.ProductName);
                generatedDateTime = DateTime.Now;
                serverPost        = BuildaCorporateHealthURL(cmnLead, prodLead, matchBuyer);
            }
            if (serverPost != "")
            {
                tLog = SendResponse(cmnLead.Id, generatedDateTime, serverPost, matchBuyer);
                // Send text to customer and buyer after successful transferred

                return(tLog);
            }

            return(null);
        }
Exemplo n.º 6
0
        public static T GetProductLeadByLeadId <T>(int leadId, string parentProductName) where T : class
        {
            using (var context = new EFDbContext())
            {
                if (parentProductName == GlobalConstant.Life)
                {
                    LifeLead prodLead = context.LifeLeads.FirstOrDefault(x => x.CommonLeadId == leadId);
                    return((T)Convert.ChangeType(prodLead, typeof(T)));
                }
                else if (parentProductName.Equals(GlobalConstant.Funeral))
                {
                    FuneralLead prodLead = context.FuneralLeads.FirstOrDefault(x => x.CommonLeadId == leadId);
                    return((T)Convert.ChangeType(prodLead, typeof(T)));
                }
                else if (parentProductName.Equals(GlobalConstant.Health))
                {
                    HealthLead prodLead = context.HealthLeads.FirstOrDefault(x => x.CommonLeadId == leadId);
                    return((T)Convert.ChangeType(prodLead, typeof(T)));
                }

                //should add other product
                return((T)Convert.ChangeType(null, typeof(T)));
            }
        }