public ActionResult UserPicks(int weekId, int simpleUserId) { ModelState.Clear(); FootballPoolViewModel vw = FootballPoolFactory.BuildFootballPoolViewModel(weekId, simpleUserId); return(View(vw)); }
public ActionResult MyDashboard() { int simpleUserId = Convert.ToInt32(User.Identity.GetSimpleUserId()); FootballPoolViewModel vw = FootballPoolFactory.GetUserAlerts(simpleUserId); return(View(vw)); }
public ActionResult GameScores(int weekId) { ModelState.Clear(); FootballPoolViewModel vw = FootballPoolFactory.BuildFootballPoolViewModel(weekId, 0); return(View(vw)); }
public ActionResult CheckUserPicks(int weekId) { ModelState.Clear(); FootballPoolViewModel vw = FootballPoolFactory.CheckUserPicks(weekId); return(View(vw)); }
public async Task <ActionResult> Register(RegisterViewModel model, string postAction) { if (ModelState.IsValid) { try { LoggerFactory.LogInfo("Register", "Attempting to create user.", "Will be user: "******"not a user yet"); var user = new ApplicationUser { UserName = model.UserName, Email = model.Email, firstName = model.firstName, lastName = model.lastName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { LoggerFactory.LogInfo("Register", "Created User Successfully", "User name: " + user.UserName, Convert.ToString(user.simpleUserId)); if (!String.IsNullOrEmpty(postAction)) { if (postAction == "reguserfpool2016") { LoggerFactory.LogInfo("FootballRegister", user.UserName, "Postaction flag: reguserfpool2016 found in URL. Attempting to register for pool.", Convert.ToString(user.simpleUserId)); try { FootballPoolFactory.RegisterUserForPool(user.Id, user.simpleUserId, user.UserName); LoggerFactory.LogInfo("FootballRegister", user.UserName, "Successfully Registered for pool. Redirecting to football home page.", Convert.ToString(user.simpleUserId)); } catch (Exception e) { LoggerFactory.LogError("Registering Football Pool", string.Format("Message: {0} more details: {1}", e.Message, e.InnerException.Message), e.StackTrace, User.Identity.GetSimpleUserId()); //if i get here need to try again } await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToAction("MyDashboard", "FootballPool")); } LoggerFactory.LogError("Registering Football Pool", "postAction was not reguserfpool2016", "Value of postAction: " + postAction, Convert.ToString(user.simpleUserId)); } LoggerFactory.LogError("Registering Football Pool", "postAction was null or empty", "failed to completely register for football pool", Convert.ToString(user.simpleUserId)); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Index", "Home")); } return(View(model)); //AddErrors(result); } catch (Exception ex) { LoggerFactory.LogError("General Registering", string.Format("User creation failed. Message: {0} more details: {1}", ex.Message, ex.InnerException.Message), ex.StackTrace, "User could not be created"); } } // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult WeeklySchedule(int weekId, int simpleUserId) { // int simpleUserId = Convert.ToInt32(User.Identity.GetSimpleUserId()); FootballPoolViewModel vw = FootballPoolFactory.BuildFootballPoolViewModel(weekId, simpleUserId); ViewBag.WeekId = weekId; return(View(vw)); }
public Boolean RegisterUserForPool(string userId, int simpleUserId, string userName) { try { FootballPoolFactory.RegisterUserForPool(userId, simpleUserId, userName); } catch (Exception e) { LoggerFactory.LogError("RegisterUserForPool", string.Format("Message: {0} more details: {1}", e.Message, e.InnerException.Message), e.StackTrace, Convert.ToString(simpleUserId)); return(false); } return(true); }
public ActionResult SubmitGameScores(FootballPoolViewModel thisVW) { try { FootballPoolFactory.SubmitGameScores(thisVW); FootballPoolFactory.UpdateTeamInfo(); } catch (Exception e) { LoggerFactory.LogError("SubmitGameScores", string.Format("Message: {0} more details: {1}", e.Message, e.InnerException.Message), e.StackTrace, User.Identity.GetSimpleUserId()); } return(RedirectToAction("Index", "Admin")); }
public Boolean deleteAlert(int alertId) { Boolean result = false; try { FootballPoolFactory.DeleteAlert(alertId); result = true; } catch (Exception e) { LoggerFactory.LogError("DeleteAlert", string.Format("Message: {0}", e.Message), e.StackTrace, User.Identity.GetSimpleUserId()); } return(result); }
public ActionResult GenerateUserScores(int weekId) { try { LoggerFactory.LogInfo("GenerateUserScores", "Starting to generate user scores...", "Week: " + Convert.ToString(weekId), "Admin"); FootballPoolFactory.GenerateUserScores(weekId); } catch (Exception e) { var me = e.Message; //LoggerFactory.LogError("GenerateUserScores", string.Format("Message: {0} more details: {1}", e.Message, Convert.ToString(e.InnerException.Message)), e.StackTrace, "Admin"); } return(RedirectToAction("Index", "Admin")); }
public ActionResult AddAlert(List <int> simpleUserIds, string alertTitle, string alertText, Boolean userCanDelete) { try { List <ApplicationUser> userList = FootballPoolFactory.GetUserListFromIds(simpleUserIds); foreach (var user in userList) { FootballPoolFactory.AddAlert(user.simpleUserId, alertTitle, alertText, userCanDelete); } } catch (Exception e) { LoggerFactory.LogError("AddAlert", string.Format("Message: {0}", Convert.ToString(e.Message)), Convert.ToString(e.StackTrace), "Admin"); } return(RedirectToAction("Index", "Admin")); }
public async Task <ActionResult> SendEmail(List <int> simpleUserIds, string emailSubject, string emailMessage) { try { List <ApplicationUser> userList = FootballPoolFactory.GetUserListFromIds(simpleUserIds); foreach (var user in userList) { await UserManager.SendEmailAsync(user.Id, Convert.ToString(emailSubject), Convert.ToString(emailMessage)); } } catch (Exception e) { LoggerFactory.LogError("SendEmail", string.Format("Message: {0}", Convert.ToString(e.Message)), Convert.ToString(e.StackTrace), "Admin"); } return(RedirectToAction("Index", "Admin")); }
public ActionResult AccountProfile(string message) { if (!String.IsNullOrEmpty(message)) { ViewBag.StatusMessage = message; } else { ViewBag.StatusMessage = ""; } int simpleUserId = Convert.ToInt32(User.Identity.GetSimpleUserId()); FootballPoolViewModel vw = FootballPoolFactory.BuildAccountProfileViewModel(simpleUserId); return(View(vw)); }
public Boolean SubmitPicks(Dictionary <string, string> picks, int weekId)//<gameId + 1, team id picked > { int simpleUserId = Convert.ToInt32(User.Identity.GetSimpleUserId()); try { LoggerFactory.LogInfo("Attempting to submit picks", "Week: " + weekId, "", User.Identity.GetSimpleUserId()); FootballPoolFactory.SubmitPicks(picks, simpleUserId, weekId); } catch (Exception e) { LoggerFactory.LogError("SubmitPicks", string.Format("Message: {0} more details: {1}", e.Message, e.InnerException.Message), e.StackTrace, User.Identity.GetSimpleUserId()); return(false); } LoggerFactory.LogInfo("Successfully submitted picks", "Week: " + weekId, "", User.Identity.GetSimpleUserId()); return(true); }
public async Task <ActionResult> SendEmailReminder(int weekId) { ModelState.Clear(); var nextGameTimeId = FootballPoolFactory.GetNextGameTimeId(weekId); var nextGameTime = FootballPoolFactory.GetGameTime(nextGameTimeId); List <ApplicationUser> userList = FootballPoolFactory.GenerateUserListThatHaveNotMadePicksThisWeek(weekId, nextGameTimeId); try { foreach (var user in userList) { await UserManager.SendEmailAsync(user.Id, string.Format("Football Pick Reminder Week {0}", weekId), string.Format("You are receiving this reminder because you have not submitted a pick for the next game(s) on {0} {1} at {2} ", nextGameTime.ToString("dddd"), nextGameTime.ToString("m"), nextGameTime.ToString("t"))); } await UserManager.SendEmailAsync("9bfa7dfb-36f3-4112-9bd7-4784cb0f07ba", string.Format("Football Pick Reminder Week {0}", weekId), string.Format("You are receiving this reminder because you have not submitted a pick for the next game(s) on {0} {1} at {2} ", nextGameTime.ToString("dddd"), nextGameTime.ToString("m"), nextGameTime.ToString("t"))); } catch (Exception e) { LoggerFactory.LogError("ForgotPassword", string.Format("Message: {0} more details: {1}", e.Message, e.InnerException.Message), e.StackTrace, ""); } return(RedirectToAction("Index", "Admin")); }
public ActionResult CheckEntryFees() { FootballPoolViewModel vw = FootballPoolFactory.CheckEntryFees(); return(View(vw)); }
public ActionResult Leaderboard() { FootballPoolViewModel vw = FootballPoolFactory.GetLeaderboard(); return(View(vw)); }
public void UpdateAlertReadFlag(Boolean read, int alertId) { FootballPoolFactory.UpdateAlertReadFlag(alertId); }
public ActionResult AddAlert() { List <ApplicationUser> userList = FootballPoolFactory.GetAllUsers(); return(View(userList)); }
public ActionResult UpdateEntryFees(int simpleUserId) { FootballPoolFactory.UpdateEntryFeeFlag(simpleUserId); return(RedirectToAction("CheckEntryFees", "FootballPoolAdmin")); }