Ejemplo n.º 1
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 LoadContestInfo()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            deadlineDate.Value        = contest.VotingDeadline.ToString();
            secondaryBanner.InnerHtml = string.IsNullOrEmpty(contest.SecondaryBannerFileName) ? string.Empty : string.Format("<img src='assets/img/{0}' />", contest.SecondaryBannerFileName);
        }
Ejemplo n.º 3
0
        private void SendEmailNotification()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            string emailFrom = ConfigurationManager.AppSettings["EmailAddressUnsubscribe"];
            string emailTo   = ConfigurationManager.AppSettings["EmailAddressUnsubscribe"];
            string subject   = "UNSUBSCRIBE:  Please remove from Contest " + contest.Name;
            string body      = "User with email: " + tbxEmail.Text + "has unsubscribed from email notifications";

            EmailHandler.Send(emailFrom, emailTo, string.Empty, subject, body);
        }
        private bool ValidateDeadlineDate()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            if (DateTime.Now < contest.VotingDeadline)
            {
                return(true);
            }


            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");

            return(false);
        }
        private void LoadPage()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            //
            //if (ValidateDeadlineDate(contest.VotingDeadline))
            //{
            //    disclaimerText.InnerHtml = contest.JudgeGuidelines;
            //    LoadUserFromCookie();
            //}
            //else
            //{
            //    //Load message saying contest is over
            //}

            disclaimerText.InnerHtml = contest.JudgeGuidelines;
            LoadUserFromCookie();
        }
        private void LoadPage()
        {
            ContestBLL contest = new ContestBLL(int.Parse(ConfigurationManager.AppSettings["ContestID"]));

            //If submission deadline date has passed, show message
            //and disable form
            if (!ValidateDeadlineDate(contest.DeadlineDate))
            {
                DisableForm();
                infoMessage.InnerHtml = string.Format("The deadline for submissions has passed. You can still vote until 11:59 pm on {0} by <a href='judge-sign-up.aspx'>signing up</a> or change your vote by <a href='judge-login.aspx'>signing in</a>",
                                                      contest.VotingDeadline.ToString("dddd, MMM d"));
                infoMessage.Attributes.Add("style", "display:block");
            }

            disclaimerText.InnerHtml   = contest.DisclaimerText;
            firstPrize.InnerHtml       = string.Format("Submit your video to win {0}!", contest.FirstPrize);
            secondaryBanner.InnerHtml  = string.IsNullOrEmpty(contest.SecondaryBannerFileName) ? string.Empty : string.Format("<img src='assets/img/{0}' />", contest.SecondaryBannerFileName);
            confirmationText.InnerHtml = contest.ConfirmationText;
        }
        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.";
                }
            }
        }