Beispiel #1
0
        private static string BuildaCorporateHealthURL(CommonLead cmnLead, CorporateHealthLead prodLead, MatchBuyer matchBuyer)
        {
            //Product-Specific Fields
            var obj = new
            {
                affiliate_campaign_id = 340,
                vmform_hash           = "06488",
                vmform_ip             = cmnLead.IpAddress.Trim(),
                vmform_referer        = "https://www.bestmedicalplan.co.uk/gbu/business-medical-plan",
                vmform_siteid         = 1567,
                vmform_source         = "ppcsearch",

                //company_name = prodLead.CompanyName,
                employees = 20,
                // current_policy = prodLead.ExistingPolicy ? "yes" : "no",

                first_name = cmnLead.FirstName.Trim(),
                last_name  = cmnLead.LastName.Trim(),
                gender     = cmnLead.Title = "Mr" ?? "Male",
                //  dob = prodLead.Dob.ToString("dd-MM-yyyy"),
                // address_line_1 = cmnLead.Address1,
                // postcode = cmnLead.Postcode,

                telephone = cmnLead.HomePhone.Trim(),
                //mobile = cmnLead.WorkPhone.Trim(),
                email = cmnLead.Email.Trim()
            };

            string queryString = UtilityMethods.GetQueryString(obj);

            return(queryString);
        }
Beispiel #2
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());
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public ActionResult Corporate(CorporateHealthFilterLeadModel model)
        {
            if (ModelState.IsValid)
            {
                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);
                }

                model.Dob = Dob;
                model.Age = CalculateAge(Dob);
                CorporateHealthLead lead = new CorporateHealthLead()
                {
                    CompanyName    = model.ComplayeeName,
                    EmployeeNumber = model.TotalEmployee,
                    ExistingPolicy = model.ExistingPolicy,// default Value

                    Title     = model.YourTitle,
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    Dob       = Dob,
                    Age       = CalculateAge(Dob),
                    HomePhone = model.HomePhone,
                    WorkPhone = model.WorkPhone ?? model.HomePhone,
                    Email     = model.Email,
                    Address   = model.Address,
                    City      = model.City ?? string.Empty,
                    PostCode  = model.PostCode,


                    GeneratedDateTime = DateTime.Now,


                    Status = "NEW",

                    SiteId      = 4,
                    ProductName = "CorporateHealth",
                    Source      = Session["Source"] as string ?? null,
                    Keyword     = Session["Keyword"] as string ?? null,
                    MatchType   = Session["Match"] as string ?? null,
                    IpAddress   = Session["RemoteIPAddress"] as string ?? null
                };
                //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(View(model));
                }
                ThankModel thank = new ThankModel()
                {
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    Title     = model.YourTitle
                };
                return(RedirectToAction("Thank", "Home", thank));
            }
            return(View(model));
        }