Exemple #1
0
        bool PopulateHeader()
        {
            if (GroupId > 0)
            {
                AWAPI_Data.Data.awContestGroup group = _contestLib.GetContestGroup(GroupId);
                if (group == null)
                {
                    return(false);
                }

                lblTitle.Text = "Contest Group Entries - " + group.title;
                _hplExportExcel.NavigateUrl = "~/admin/reports/handlers/excel.ashx?report=" +
                                              AWAPI.admin.reports.handlers.excel.Reports.ContestGroupEntries + "&groupid=" + GroupId.ToString();
            }
            else
            {
                AWAPI_Data.CustomEntities.ContestExtended contest = _contestLib.GetContest(ContestId, false);
                if (contest == null)
                {
                    return(false);
                }

                lblTitle.Text = "Contest Entries - " + contest.title;
                _hplExportExcel.NavigateUrl = "~/admin/reports/handlers/excel.ashx?report=" +
                                              AWAPI.admin.reports.handlers.excel.Reports.ContestEntries + "&contestid=" + ContestId.ToString();
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// contestId must be set in the url
        /// </summary>
        /// <returns></returns>
        string GetContestEnties()
        {
            if (HttpContext.Current.Request["contestid"] == null)
            {
                return("");
            }
            AWAPI_BusinessLibrary.library.ContestLibrary lib = new AWAPI_BusinessLibrary.library.ContestLibrary();
            long contestId = Convert.ToInt64(HttpContext.Current.Request["contestid"]);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();


            //GET CONTEST IFNO
            AWAPI_Data.CustomEntities.ContestExtended contest = lib.GetContest(contestId, false);
            if (contest == null)
            {
                return("");
            }
            sb.Append("Contest entries report\n");
            sb.AppendFormat("Report date:,{0}\n\n", DateTime.Now);

            sb.AppendFormat("ContestId:,{0}\n", contest.contestId.ToString());
            sb.AppendFormat("Name:,{0}\n", contest.title);
            sb.AppendFormat("Description:,{0}\n", contest.description.Replace(",", " ").Replace("\n", " ")).Replace("\"", " ");;
            sb.AppendFormat("StartDate:,{0}\n", contest.pubDate);
            sb.AppendFormat("EndDate:,{0}\n", contest.pubEndDate);

            sb.Append("\n");
            IList <AWAPI_Data.CustomEntities.ContestEntryExtended> list = lib.GetContestEntryList(contestId);

            if (list == null || list.Count == 0)
            {
                return("");
            }

            sb.Append("entryId,isEnabled,cultureCode,email,firstName,lastName,title, " +
                      "fileUrl,phone,phoneType,address,city,province," +
                      "postalCode,country,createDate,description\n");
            foreach (AWAPI_Data.CustomEntities.ContestEntryExtended c in list)
            {
                c.email       = c.email == null ? "" : c.email.Replace(",", " ").Replace("\"", " ");
                c.firstName   = c.firstName == null ? "" : c.firstName.Replace(",", " ").Replace("\"", " ");;
                c.lastName    = c.lastName == null ? "" : c.lastName.Replace(",", " ").Replace("\"", " ");;
                c.title       = c.title == null ? "" : c.title.Replace(",", " ").Replace("\"", " ");;
                c.fileUrl     = c.fileUrl == null ? "" : c.fileUrl.Replace(",", " ").Replace("\"", " ");;
                c.tel         = c.tel == null ? "" : c.tel.Replace(",", " ").Replace("\"", " ");;
                c.telType     = c.telType == null ? "" : c.telType.Replace(",", " ").Replace("\"", " ");;
                c.address     = c.address == null ? "" : c.address.Replace(",", " ").Replace("\"", " ");;
                c.city        = c.city == null ? "" : c.city.Replace(",", " ").Replace("\"", " ");;
                c.province    = c.province == null ? "" : c.province.Replace(",", " ").Replace("\"", " ");;
                c.postalCode  = c.postalCode == null ? "" : c.postalCode.Replace(",", " ").Replace("\"", " ");;
                c.country     = c.country == null ? "" : c.country.Replace(",", " ").Replace("\"", " ");;
                c.description = c.description == null ? "" : c.description.Replace(",", " ").Replace("\n", " ").Replace("\r", "").Replace("\"", " ");;

                sb.AppendFormat("{0},{1},{2},{3},{4},{5}," +
                                "{6},{7},{8},{9},{10},{11},{12}," +
                                "{13},{14},{15},{16}",
                                c.contestEntryId, c.isEnabled, c.cultureCode, c.email.Replace(",", " "),
                                c.firstName.Replace(",", " "),
                                c.lastName.Replace(",", " "),
                                c.title.Replace(",", " "),
                                c.fileUrl.Replace(",", " "),
                                c.tel.Replace(",", " "),
                                c.telType.Replace(",", " "),
                                c.address.Replace(",", " "),
                                c.city.Replace(",", " "),
                                c.province.Replace(",", " "),
                                c.postalCode.Replace(",", " "),
                                c.country.Replace(",", " "),
                                c.createDate,
                                c.description.Replace(",", " ").Replace("\n", " ").Replace("\r", "") + "\n");
            }

            return(sb.ToString());
        }
Exemple #3
0
        void PopulateContest(Int64 blogId)
        {
            ResetControls();
            AWAPI_Data.CustomEntities.ContestExtended contest = _contestLibrary.GetContest(blogId, false);

            if (contest == null)
            {
                return;
            }

            _id.Text           = contest.contestId.ToString();
            _title.Text        = contest.title;
            _description.Text  = contest.description;
            _isEnabled.Checked = contest.isEnabled;

            _maxEntry.Text                        = contest.maxEntry.ToString();
            _entryPerUser.Text                    = contest.entryPerUser.ToString();
            _entryPerUserPeriodValue.Text         = contest.entryPerUserPeriodValue.ToString();
            _entryPerUserPeriodType.SelectedIndex = 0;

            _numberOfWinners.Text = contest.numberOfWinners.ToString();

            if (contest.pubDate != null)
            {
                _publishStartDate.Text = contest.pubDate.Value.ToString("MM/dd/yyyy HH:mm");
            }
            if (contest.pubEndDate != null)
            {
                _publishEndDate.Text = contest.pubEndDate.Value.ToString("MM/dd/yyyy HH:mm");
            }

            //Send email to the moderators after contest entry creation
            _sendEmailToModeratorRecipes.Text = contest.sendEmailToModeratorRecipes;
            if (contest.sendEmailToModeratorTemplateId != null &&
                _sendEmailToModeratorTemplate.Items.FindByValue(contest.sendEmailToModeratorTemplateId.ToString()) != null)
            {
                _sendEmailToModeratorTemplate.SelectedValue = contest.sendEmailToModeratorTemplateId.ToString();
            }

            //Send email to the contender after contest entry creation
            if (contest.sendEmailAfterSubmissionTemplateId != null &&
                _sendEmailAfterSubmissionTemplate.Items.FindByValue(contest.sendEmailAfterSubmissionTemplateId.ToString()) != null)
            {
                _sendEmailAfterSubmissionTemplate.SelectedValue = contest.sendEmailAfterSubmissionTemplateId.ToString();
            }

            //Send email to the contender if the contest entry has been approved
            if (contest.sendEmailAfterApproveEntryTemplateId != null &&
                _sendEmailAfterApproveEntryEmailTemplate.Items.FindByValue(contest.sendEmailAfterApproveEntryTemplateId.ToString()) != null)
            {
                _sendEmailAfterApproveEntryEmailTemplate.SelectedValue = contest.sendEmailAfterApproveEntryTemplateId.ToString();
            }

            //Send email to the contender if the contest entry has been denied
            if (contest.sendEmailAfterDeleteEntryTemplateId != null &&
                _sendEmailAfterDeleteEntryEmailTemplate.Items.FindByValue(contest.sendEmailAfterDeleteEntryTemplateId.ToString()) != null)
            {
                _sendEmailAfterDeleteEntryEmailTemplate.SelectedValue = contest.sendEmailAfterDeleteEntryTemplateId.ToString();
            }


            PopulateSelectedGroups(contest.contestId);

            ShowHideControls(true);
        }