Пример #1
0
 public static void Map(UserRegistrationRequest userRegistrationRequest, MobilelLead mobileLead)
 {
     mobileLead.Firstname    = userRegistrationRequest.Firstname;
     mobileLead.Lastname     = userRegistrationRequest.Lastname;
     mobileLead.Address      = userRegistrationRequest.Address;
     mobileLead.City         = userRegistrationRequest.City;
     mobileLead.State        = userRegistrationRequest.State;
     mobileLead.Zip          = userRegistrationRequest.Zip;
     mobileLead.Gender       = userRegistrationRequest.Gender;
     mobileLead.Dob          = userRegistrationRequest.DOB;
     mobileLead.EmailAddress = userRegistrationRequest.EmailAddress;
 }
Пример #2
0
        internal static UserRegistrationRequest Map(MobilelLead mobileLead)
        {
            var u = new UserRegistrationRequest();

            u.Firstname    = mobileLead.Firstname;
            u.Lastname     = mobileLead.Lastname;
            u.Address      = mobileLead.Address;
            u.City         = mobileLead.City;
            u.State        = mobileLead.State;
            u.Zip          = mobileLead.Zip;
            u.Gender       = mobileLead.Gender;
            u.DOB          = mobileLead.Dob;
            u.EmailAddress = mobileLead.EmailAddress;
            return(u);
        }
Пример #3
0
        public FormUrlEncodedContent CreatePostContent(RouterContact routerContact, MobilelLead lead)
        {
            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("RID", "20690"),
                new KeyValuePair <string, string>("TxId", ""),
                new KeyValuePair <string, string>("ExtMemberId", routerContact.RouterContactId.ToString()),
                new KeyValuePair <string, string>("Country", lead.CountryId ?? "US"),
                new KeyValuePair <string, string>("State", lead.State),
                new KeyValuePair <string, string>("FirstName", lead.Firstname),
                new KeyValuePair <string, string>("LastName", lead.Lastname),
                new KeyValuePair <string, string>("EmailAddress", lead.EmailAddress),
                new KeyValuePair <string, string>("Zip", lead.Zip),
                new KeyValuePair <string, string>("Gender", lead.Gender),
                new KeyValuePair <string, string>("Dob", lead.Dob?.ToString("MM/dd/yyyy")),
                new KeyValuePair <string, string>("Address1", lead.Address),
                new KeyValuePair <string, string>("Address2", null),
                new KeyValuePair <string, string>("City", lead.City),
                new KeyValuePair <string, string>("Ethnicity", null),
            });

            return(content);
        }
Пример #4
0
        public MobileSignupResponse SignUpUser(string email, string ipAddress)
        {
            var db = new GloshareContext();

            if (string.IsNullOrWhiteSpace(email))
            {
                return(new MobileSignupResponse()
                {
                    Message = "Email is blank."
                });
            }


            try
            {
                var xv = new XVerifyManager();
                if (xv.GetEmailVerification(email))
                {
                    string countryId = GetCountryId(ipAddress);
                    var    response  = new MobileSignupResponse();
                    response.ValidEmail = true;
                    MobilelLead existingLead = db.MobilelLeads.FirstOrDefault(m => m.EmailAddress.ToLower() == email);
                    if (existingLead == null)
                    {
                        email        = email.Trim().ToLower();
                        existingLead = new MobilelLead()
                        {
                            EmailAddress = email, Ip = ipAddress, CountryId = countryId
                        };
                        db.MobilelLeads.Add(existingLead);
                        db.SaveChanges();
                        var oils = db.OptInLeads.Where(o => o.EmailAddress == email);
                        if (!oils.Any())
                        {
                            var oil = new OptInLead();
                            oil.EmailAddress = email;
                            oil.Ip           = ipAddress;
                            oil.OfferId      = "51011";
                            db.OptInLeads.Add(oil);
                            db.SaveChanges();
                        }
                    }
                    return(new MobileSignupResponse()
                    {
                        UserId = existingLead.UserId,
                        IsRegistered = existingLead.IsRegistered,
                        DisplayName = string.IsNullOrWhiteSpace(existingLead.Firstname) ? null : $"{existingLead.Firstname} {existingLead.Lastname}",
                        ValidEmail = true,
                        Message = "Success",
                        DashUrl = $"{ConfigurationManager.AppSettings["BaseWebUrl"]}dash?ug={existingLead.UserId}",
                        RegisterUrl = $"{ConfigurationManager.AppSettings["BaseWebUrl"]}register?ug={existingLead.UserId}",
                        DailySurveysUrl = $"{ConfigurationManager.AppSettings["BaseWebUrl"]}mysurveys?mu={existingLead.UserId}",
                        EarningsUrl = $"{ConfigurationManager.AppSettings["BaseWebUrl"]}earnings?ug={existingLead.UserId}"
                    });
                }

                return(new MobileSignupResponse()
                {
                    ValidEmail = false, Message = "Email Invalid."
                });
            }
            catch (Exception e)
            {
                return(new MobileSignupResponse()
                {
                    Message = $"Error: {e.Message}"
                });
            }
        }