private void SubtractVote(int?contestEntryId)
        {
            ContestEntryBLL entry = new ContestEntryBLL(contestEntryId);

            entry.PeoplesChoiceScore--;
            entry.Update();
        }
        private void AddVote(int contestEntryId)
        {
            ContestEntryBLL entry = new ContestEntryBLL(contestEntryId);

            entry.PeoplesChoiceScore++;
            entry.Update();
        }
Beispiel #3
0
        private void LoadPage()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            //Allow to vote only if deadline has not passed
            if (ValidateDeadlineDate(contest.VotingDeadline))
            {
                ContestJudgeBLL judge          = (ContestJudgeBLL)Session["ContestJudge"];
                int             contestEntryId = judge.VoteContestEntryID != null ? (int)judge.VoteContestEntryID : 0;
                repContestEntries.DataSource = ContestEntryBLL.List(int.Parse(ConfigurationManager.AppSettings["ContestID"]), contestEntryId);
                repContestEntries.DataBind();

                LoadNotificationSettingsModal(contest.VotingDeadline, judge.FirstName);
            }
            else
            {
                //Load message notifying of voting deadline
                primaryHeader.InnerHtml = " ";
                secondaryHeader.Attributes.Add("style", "display:none;");
                infoMessage.InnerHtml = "Thank you for signing up as a judge. Unfortunately, the voting deadline for this contest has passed. Look out for future contests you can participate in. Thanks again!";
                infoMessage.Attributes.Add("style", "display:block");
                //Kill user session and delete cookie to prevent user from voting from another page
                KillSession();
            }
        }
        private void LoadPage()
        {
            ContestJudgeBLL judge          = (ContestJudgeBLL)Session["ContestJudge"];
            int             contestEntryId = judge.VoteContestEntryID != null ? (int)judge.VoteContestEntryID : 0;

            repContestEntries.DataSource = ContestEntryBLL.List(int.Parse(ConfigurationManager.AppSettings["ContestID"]), contestEntryId);
            repContestEntries.DataBind();
        }
 private void LoadFacebookMetadata(ContestEntryBLL entry)
 {
     id              = entry.ContestEntryID.ToString();
     pageUrl         = Request.Url.ToString();
     pageTitle       = entry.Title.Replace("\"", "'");
     pageDescription = entry.Description.Replace("\"", "'");
     pageThumbnail   = GetYoutubeThumbnailUrl(entry.VideoURL);
 }
 private void LoadEntry(ContestEntryBLL entry)
 {
     videoFrame.Attributes.Add("src", entry.EmbedVideoURL + "?rel=0");
     frontrunnerTitle.InnerHtml       = entry.Title;
     frontrunnerContestant.InnerHtml  = string.Format("Submitted by {0} on {1}", entry.FirstName, entry.CreatedDate.ToShortDateString());
     frontrunnerDescription.InnerHtml = entry.Description;
     frontrunnerVotes.InnerHtml       = string.Format("{0} votes", entry.PeoplesChoiceScore);
     LoadComments(entry.ContestEntryID);
     LoadFacebookMetadata(entry);
 }
 private void LoadFrontRunner(ContestEntryBLL frontrunner)
 {
     imgFrontRunnerEntry.ImageUrl = GetYoutubeThumbnailUrl(frontrunner.VideoURL);
     //frontrunnerEntry.InnerHtml = string.Format("<img src='{0}' />", GetYoutubeThumbnailUrl(frontrunner.VideoURL));
     frontrunnerEntry.Attributes.Add("video-url", frontrunner.EmbedVideoURL);
     frontrunnerEntry.Attributes.Add("video-title", frontrunner.Title);
     frontrunnerTitle.InnerHtml       = frontrunner.Title;
     frontrunnerContestant.InnerHtml  = string.Format("Submitted by {0} on {1}", frontrunner.FirstName, frontrunner.CreatedDate.ToShortDateString());
     frontrunnerDescription.InnerHtml = frontrunner.Description;
     frontrunnerVotes.InnerHtml       = string.Format("{0} votes", frontrunner.PeoplesChoiceScore);
     LoadComments(frontrunner.ContestEntryID);
 }
Beispiel #8
0
        private void LoadPage()
        {
            //If judge is logged in, set the judge's selected entry
            //as the contestEntryId variable.
            int contestEntryId = 0;

            if (LoadUserFromCookie())
            {
                ContestJudgeBLL judge = (ContestJudgeBLL)Session["ContestJudge"];
                contestEntryId = (int)judge.VoteContestEntryID;
                //If user is logged in, hide button that redirect to register and login page
                voteButtons.Attributes.Add("style", "display:none");
            }

            repContestEntries.DataSource = ContestEntryBLL.List(int.Parse(ConfigurationManager.AppSettings["ContestID"]), contestEntryId);
            repContestEntries.DataBind();
        }
        private void LoadPage()
        {
            if (Request["id"] != null)
            {
                int contestEntryId = 0;
                int.TryParse(Request["id"], out contestEntryId);

                ContestEntryBLL entry = new ContestEntryBLL(contestEntryId);
                LoadEntry(entry);
                SetVoteButton(contestEntryId);

                if (entry.ContestEntryID > 0)
                {
                    return;
                }
            }

            Response.RedirectPermanent("index.aspx");
        }
        protected void btnSubmitVideo_Click(object sender, EventArgs e)
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            if (ValidateDeadlineDate(contest.DeadlineDate))
            {
                if (!EmailExistsInDatabase(contest.ContestID))
                {
                    //Add new ContestEntry to database
                    ContestEntryBLL entry = new ContestEntryBLL();
                    entry.ContestID     = int.Parse(ConfigurationManager.AppSettings["ContestID"]);
                    entry.CustomerID    = null;
                    entry.Title         = tbxTitle.Text;
                    entry.Description   = tbxDescription.Text;
                    entry.FirstName     = tbxFirstName.Text;
                    entry.LastName      = tbxLastName.Text;
                    entry.Email         = tbxEmail.Text;
                    entry.VideoURL      = tbxVideoUrl.Text;
                    entry.EmbedVideoURL = FormatYoutubeLink(tbxVideoUrl.Text);
                    entry.Zipcode       = tbxZipcode.Text;
                    entry.Save();

                    //Send confirmation emails
                    SendNewEntryNotification(contest.NotificationEmailSubject, FormatNewEntryNotificationBody(contest.NotificationEmailBody));
                    SendNewEntryConfirmation(contest.ConfirmationEmailSubject, FormatNewEntryConfirmationBody(contest.ConfirmationEmailBody));

                    //Clear all inputs
                    ClearForm();

                    //Load confirmation modal
                    ClientScriptManager cs = Page.ClientScript;
                    cs.RegisterStartupScript(this.GetType(), "confirmation", "$(function () {$('#confirmationModal').modal('show');});", true);
                }
                else
                {
                    errorMessage.Attributes.Add("style", "display:block");
                    errorMessage.InnerHtml = "This email is already registered. Please enter another one.";
                }
            }
        }
        private void LoadPage()
        {
            //Load contest basic information
            LoadContestInfo();

            //Load top 5 contest entries
            DataTable dtLeadingEntries = ContestEntryBLL.ListLeadingEntries(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            if (dtLeadingEntries.Rows.Count > 0)
            {
                //Load frontrunner entry
                LoadFrontRunner(new ContestEntryBLL(dtLeadingEntries.Rows[0]));
                dtLeadingEntries.Rows[0].Delete();

                //Load repeater with remaining top 4 contest entries
                repContestEntries.DataSource = dtLeadingEntries;
                repContestEntries.DataBind();
            }
            else
            {
                frontrunner.InnerHtml = "<p style='text-align:center;'>No entries have been submitted yet. Click <a href='submit-entry.aspx'>here</a> to be the first!</p>";
            }
        }
 private bool EmailExistsInDatabase(int contestId)
 {
     return(ContestEntryBLL.EmailExists(tbxEmail.Text, contestId));
 }