private void AddToPostQueue(string listname, string emailAddress, string key, string url, string postData) { PostQueue pq = new PostQueue(); if (listname?.Length > 50) { pq.Name = listname?.Substring(0, 50); } else { pq.Name = listname; } pq.Method = "GET"; pq.EmailAddress = emailAddress; pq.PostUrl = url; pq.PostData = key + postData; pq.OkValue = "Thank You"; pq.IgnoreValues = ""; GloshareContext db = new GloshareContext(); try { db.PostQueues.Add(pq); db.SaveChanges(); } catch (Exception e) { //EmailUtility.SendErrorEmail(e, "CBR", "ListtrakUtility", "UpdateListrak()"); } }
public Guid GetRouterContactIdFromMobileUser(Guid userId) { var db = new GloshareContext(); var user = db.MobilelLeads.Where(m => m.UserId == userId).Select(r => r.RouterContact).FirstOrDefault(); return(user.UniqueId); }
public void SetRouterContact(int?routerContactId, Guid userId) { var db = new GloshareContext(); var mobileLead = db.MobilelLeads.FirstOrDefault(m => m.UserId == userId); mobileLead.RouterContactId = routerContactId; db.SaveChanges(); }
public UserRegistrationRequest GetUser(Guid userId) { var db = new GloshareContext(); var mobileLead = db.MobilelLeads.FirstOrDefault(m => m.UserId == userId); return(MobileLeadMapper.Map(mobileLead)); }
public void Register(int mobileLeadId, UserRegistrationRequest userRegistrationRequest) { var db = new GloshareContext(); var mobileLead = db.MobilelLeads.Find(mobileLeadId); MobileLeadMapper.Map(userRegistrationRequest, mobileLead); db.SaveChanges(); }
public decimal GetUserEarnings(Guid userId) { var db = new GloshareContext(); List <GetMobileEarningsReturnModel> earnings = db.GetMobileEarnings(userId); if (earnings.Any()) { return(earnings.First().earnings ?? 0); } return(0); }
protected void WriteCoregError(string partner, string postdata, string url, string response) { GloshareContext _db = new GloshareContext(); _db.CoregErrors.Add(new CoregError() { DateInserted = DateTime.Now, Partner = partner, PostData = postdata, Url = url, Response = response }); _db.SaveChanges(); }
public int?Register(Guid userId, UserRegistrationRequest userRegistrationRequest) { var db = new GloshareContext(); var mobileLead = db.MobilelLeads.FirstOrDefault(m => m.UserId == userId); MobileLeadMapper.Map(userRegistrationRequest, mobileLead); db.SaveChanges(); var oil = db.OptInLeads.Where(o => o.EmailAddress == mobileLead.EmailAddress); int?birthdayDay = null; int?birthdayMonth = null; int?birthdayYear = null; if (mobileLead.Dob.HasValue) { birthdayDay = mobileLead.Dob.Value.Day; birthdayMonth = mobileLead.Dob.Value.Month; birthdayYear = mobileLead.Dob.Value.Year; } foreach (OptInLead lead in oil) { lead.Firstname = lead.Firstname ?? mobileLead?.Firstname; lead.Lastname = lead.Lastname ?? mobileLead?.Lastname; lead.Address = lead.Address ?? mobileLead?.Address; lead.BirthdayDay = lead.BirthdayDay ?? birthdayDay; lead.BirthdayMonth = lead.BirthdayMonth ?? birthdayMonth; lead.BirthdayYear = lead.BirthdayYear ?? birthdayYear; lead.City = lead.City ?? mobileLead?.City; lead.State = lead.State ?? mobileLead?.State; lead.Zip = lead.Zip ?? mobileLead?.Zip; } db.SaveChanges(); return(mobileLead.RouterContactId); }
public XVerifyManager() { _db = new GloshareContext(); _xverifyRepository = new XVerifyRepository(); }
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}" }); } }
public LeadManager() { _db = new GloshareContext(); }
public CoregManager() { _db = new GloshareContext(); }