/// <summary> /// Indexes the specified dummy. /// </summary> /// <param name="dummy">The dummy.</param> /// <param name="userid">The userid.</param> /// <returns></returns> public ActionResult Index(string dummy, string userid) { Paticipant user = new Paticipant(); if (!string.IsNullOrEmpty(userid)) { userid = HttpUtility.UrlDecode(userid); user = _quinielaService.GetUser(userid); } var winner = _quinielaService.GetTopWinner(); var currencyExchange = _quinielaService.GetCurrenctRate(); return View("Index", ModelHelper.GetHomeModel(user, winner, currencyExchange)); }
/// <summary> /// Matcheses this instance. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public ActionResult Matches(string userid) { Paticipant user = new Paticipant(); if (!string.IsNullOrEmpty(userid)) { userid = HttpUtility.UrlDecode(userid); user = _quinielaService.GetUser(userid); } return View("matches_" + Localizer.GetCulture().TwoLetterISOLanguageName, ModelHelper.GetMatchesModel(user)); }
/// <summary> /// Gets the home model. /// </summary> /// <param name="user">The user.</param> /// <param name="TopWinner">The top winner.</param> /// <param name="currencyExchange">The currency exchange.</param> /// <returns></returns> public static HomeModel GetHomeModel(Paticipant user, Winner TopWinner, double currencyExchange) { var culture = Localizer.GetCulture(); var currentCode = new RegionInfo(culture.LCID).ISOCurrencySymbol; // Build Submit Scores Modal ScoresModal submitModal = new ScoresModal { Title = Localizer.Get("SSModalTitle"), SubTitle = Localizer.Get("SSModalSubTitle"), Bullet1 = string.Format(Localizer.Get("SSModalBullet1"), Localizer.Get("BetAmount")), Bullet2 = Localizer.Get("SSModalBullet2"), Bullet3 = Localizer.Get("SSModalBullet3"), Bullet4 = Localizer.Get("SSModalBullet4"), Bullet5 = Localizer.Get("SSModalBullet5"), Warning = Localizer.Get("SSModalWarning"), WarningText = Localizer.Get("SSModalWarningTxt"), PayPalToolTip = Localizer.Get("SSModalPayPalToolTip") }; return new HomeModel { UserId = user.Email, UserState = user.State, UserName = user.Name, WelcomeUser = string.Format( Localizer.Get("WelcomeUser"), string.Empty), DomainPath = ConfigurationManager.AppSettings["DomainPath"], SiteSubtitle = Localizer.Get("SiteSubtitle"), MnuRules = Localizer.Get("MnuRules"), MnuParticipants = Localizer.Get("MnuParticipants"), MnuMatches = Localizer.Get("MnuMatches"), MnuChat = Localizer.Get("MnuChat"), MnuReg = Localizer.Get("MnuReg"), Title = Localizer.Get("Title"), TopWinDesc = Localizer.Get("TopWinDesc"), TopWinner = TopWinner.topWinner, TopWinnerPrice = string.Format("{0:C} {1}", TopWinner.prize, (currentCode != "USD") ? "MXN" : currentCode), TopWinTitle = Localizer.Get("TopWinTitle"), TopWinPrizeDesc = Localizer.Get("TopWinPrizeDesc"), WinningPrize = Localizer.Get("WinnerPrize"), UserLoggedIn = Localizer.Get("UserLoggedIn"), UserLoginFail = Localizer.Get("UserLoginFail"), PayPalFormCode = Localizer.Get("PayPalFormCode"), PayPalButton = Localizer.Get("PayPalButton"), ScoresModal = submitModal, ContentParagraph1 = Localizer.Get("ContentParagraph1"), ContentParagraph2 = Localizer.Get("ContentParagraph2"), FieldRequired = Localizer.Get("FieldRequired"), FieldValEmail = Localizer.Get("FieldValEmail"), FieldValPin = Localizer.Get("FieldValPin"), FieldPin = Localizer.Get("FieldPin"), LearnMore = Localizer.Get("LearnMore"), SignIn = Localizer.Get("SignIn"), LogIn = Localizer.Get("LogIn"), LogOut = Localizer.Get("LogOut"), MoveUp = Localizer.Get("MoveUp"), MoveDown = Localizer.Get("MoveDown"), PrivatePolicyTitle = Localizer.Get("PrivatePolicyTitle"), CurrencyExchange = currencyExchange, CurrenctExchangeTitle = Localizer.Get("CurrenctExchange"), InvitationSuccessMsg = Localizer.Get("InvitationSuccessMsg"), FormErrMsg = Localizer.Get("FormErrMsg"), FieldEmail = Localizer.Get("FieldEmail"), BtnInvite = Localizer.Get("BtnInvite"), WantToJoin = Localizer.Get("WantToJoin"), WeTakeCC = Localizer.Get("WeTakeCC"), CheckScores = Localizer.Get("CheckScores"), ChatTitle = Localizer.Get("ChatTitle"), ChatSubTitle = Localizer.Get("ChatSubTitle"), SendMessage = Localizer.Get("SendMessage"), FieldMessage = Localizer.Get("FieldMessage"), FinalScoresMsg = Localizer.Get("FinalScoresMsg") }; }
/// <summary> /// Gets the user. /// </summary> /// <param name="userId">The user identifier.</param> /// <returns></returns> public Paticipant GetUser(string userId) { Paticipant user = new Paticipant(); try { OpenDatabase(); var sql = string.Format("select * from dbo.Users where Email = '{0}'", userId); SqlCommand command = new SqlCommand(sql, conn); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { user = new Paticipant { Email = reader["Email"].ToString(), Name = reader["Name"].ToString(), IpAddress = reader["IpAddress"].ToString(), State = reader["State"].ToString(), TotalPoints = reader["TotalPoints"].ToString(), InviteCode = reader["InviteCode"].ToString() }; } } CloseDatabase(); } catch (Exception ex) { Console.Write(ex.Message); } return user; }
/// <summary> /// Gets the matches model. /// </summary> /// <param name="user">The user.</param> /// <returns></returns> public static MatchesModel GetMatchesModel(Paticipant user) { return new MatchesModel { UserId = user.Email, UserName = user.Name, UserState = user.State, DomainPath = ConfigurationManager.AppSettings["DomainPath"], PageTitle = Localizer.Get("MnuMatches"), }; }