Ejemplo n.º 1
0
    private void DisplayData(SessionsResult sessionInfo)
    {
        if (sessionInfo == null)
        {
            throw new ApplicationException("sesionInfo is null in DisplayData");
        }

        if (sessionInfo.SponsorId.HasValue)
        {
            sponsorId = sessionInfo.SponsorId.Value;
        }

        if (!String.IsNullOrEmpty(sessionInfo.BoxFolderIdString))
        {
            UploadToBoxMailToHrefId.Visible = true;
            UploadToBoxMailToHrefId.HRef = String.Format("mailto:{0}?subject=Attach Slides and Code Files For Upload To Your Session And Send",sessionInfo.BoxFolderEmailInAddress);
            UploadToBoxMailToHrefId.InnerText = "mailto: Custom Mailer That Attaches To Your Session For All Attendees";

            ButtonCreateMailInId.Visible = false;
            ButtonDeleteSlidesFolderId.Visible = true;
        }
        else
        {
            UploadToBoxMailToHrefId.Visible = false;
            ButtonCreateMailInId.Visible = true;
            ButtonDeleteSlidesFolderId.Visible = false;
        }

        TextBoxMaterialUrl.Text = sessionInfo.SessionsMaterialUrl ?? "";

        LabelPresenter.Text = Context.Server.HtmlDecode(CodeCampSV.Utils.GetAttendeeNameByUsername(sessionInfo.Username));
        LabelPresenterAdditional.Text = Context.Server.HtmlDecode(CodeCampSV.Utils.GetSecondaryPresentersBySessionIdString(sessionInfo.Id,sessionInfo.Username));
        TextBoxSummary.Text = Context.Server.HtmlDecode(sessionInfo.Description);
        TextBoxTitle.Text = Context.Server.HtmlDecode(sessionInfo.Title);
        TextBoxHashTags.Text = Context.Server.HtmlDecode(sessionInfo.TwitterHashTags);
        CheckBoxDoNotShowPrimarySpeaker.Checked = sessionInfo.DoNotShowPrimarySpeaker;
        CheckBoxQueueEmailNotification.Checked = sessionInfo.SessionsMaterialQueueToSend.HasValue && sessionInfo.SessionsMaterialQueueToSend.Value;
         //       TextBoxSlides.Text = sessionInfo.SessionsMaterialUrl;

        if (sessionInfo.SessionLevel_id == 1)
        {
            DropDownListLevels.SelectedIndex = 0;
        }
        else if (sessionInfo.SessionLevel_id == 2)
        {
            DropDownListLevels.SelectedIndex = 1;
        }
        else if (sessionInfo.SessionLevel_id == 3)
        {
            DropDownListLevels.SelectedIndex = 2;
        }

        TagsODS tagsODS = new TagsODS();
        List<TagsODS.DataObjectTags> tagsODSli =
            tagsODS.GetAllBySession(string.Empty, sessionsId,false);

        CheckBoxListTags.DataBind();

        foreach (ListItem li in CheckBoxListTags.Items)
        {
            foreach (TagsODS.DataObjectTags dot in tagsODSli)
            {
                if (dot.Tagname.Equals(li.Text))
                {
                    li.Selected = true;
                }
            }
        }

        if (sessionInfo.SpeakersList != null && sessionInfo.SpeakersList.Count == 1)
        {
            SpeakerHandle2Tr.Visible = false;
            SpeakerHandle3Tr.Visible = false;
        }

        if (sessionInfo.SpeakersList != null && sessionInfo.SpeakersList.Count == 2)
        {
            SpeakerHandle3Tr.Visible = false;
        }

        if (SpeakerHandle1Tr.Visible && sessionInfo.SpeakersList != null && sessionInfo.SpeakersList.Count > 0)
        {
            SpeakerName1.Text = sessionInfo.SpeakersList[0].UserFirstName  + " " +
                                  sessionInfo.SpeakersList[0].UserLastName;
            TextBoxSpeakerHandle1.Text = sessionInfo.SpeakersList[0].TwitterHandle ?? "";
            SpeakerHandle1Id.Text = sessionInfo.SpeakersList[0].AttendeeId.ToString(CultureInfo.InvariantCulture);
        }

        if (SpeakerHandle2Tr.Visible && sessionInfo.SpeakersList != null && sessionInfo.SpeakersList.Count > 1)
        {
            SpeakerName2.Text = sessionInfo.SpeakersList[1].UserFirstName + " " +
                                  sessionInfo.SpeakersList[1].UserLastName;
            TextBoxSpeakerHandle2.Text = sessionInfo.SpeakersList[1].TwitterHandle ?? "";
            SpeakerHandle2Id.Text = sessionInfo.SpeakersList[1].AttendeeId.ToString(CultureInfo.InvariantCulture);
        }

        if (SpeakerHandle3Tr.Visible && sessionInfo.SpeakersList != null && sessionInfo.SpeakersList.Count > 2)
        {
            SpeakerName3.Text = sessionInfo.SpeakersList[2].UserFirstName + " " +
                                  sessionInfo.SpeakersList[2].UserLastName;
            TextBoxSpeakerHandle3.Text = sessionInfo.SpeakersList[2].TwitterHandle ?? "";
            SpeakerHandle3Id.Text = sessionInfo.SpeakersList[2].AttendeeId.ToString(CultureInfo.InvariantCulture);
        }
    }
Ejemplo n.º 2
0
    protected string GetHTMLForTimeSlot(int sessionTimesId, object beforeAgendaObj, object afterAgendaObj)
    {
        bool showRoomOnSchedule = ConfigurationManager.AppSettings["ShowRoomOnSchedule"] != null &&
                                  ConfigurationManager.AppSettings["ShowRoomOnSchedule"].ToLower().Equals("true");

        bool showSpeakerHyperLinks = !(ConfigurationManager.AppSettings["ShowSpeakerHyperlinks"] != null &&
                                       ConfigurationManager.AppSettings["ShowSpeakerHyperlinks"].ToLower().Equals("false"));

        string beforeAgenda = beforeAgendaObj.Equals(DBNull.Value) ? string.Empty : (string) beforeAgendaObj;
        string afterAgenda = afterAgendaObj.Equals(DBNull.Value) ? string.Empty : (string) afterAgendaObj;

        var sb = new StringBuilder();

        var soODS = new SessionsOverviewODS();
        List<SessionsOverviewODS.DataObjectSessionsOverview> liSO = soODS.GetBySessionTimesId(sessionTimesId,Convert.ToInt32(LabelCodeCampYearId.Text));

        if (!String.IsNullOrEmpty(beforeAgenda))
        {
            sb.Append(beforeAgenda);
        }

        int totalSessionInSlot = liSO.Count;

        var attendeesList = new List<Attendees>();

        //var speakerIdsInTimeSlot = new List<int>();

        // From Elluis on format
        // <lu>
        //    <li><a href="..." alt="..." class="sessionTitle">Sessions Title</a> <a>Speaker 1a</a>, <a>Speaker 2a</a> <span>Room</span></li>
        //    <li><a class="sessionTitle">Sessions Title</a> <a>Speaker 1b</a>, <a>Speaker 2b</a> <span>Room</span></li>
        //</lu>

        var sessionAttendeeOds = new SessionAttendeeODS();
        bool isAdmin = Utils.CheckUserIsAdmin();

        int totalInterestInSlot = 0;
        int totalPlanToAttendInSlot = 0;

        sb.Append("<ul>");
        foreach (SessionsOverviewODS.DataObjectSessionsOverview sessionOverview in liSO)
        {
            var speakerList = Utils.GetSpeakersBySessionId(sessionOverview.Sessionid);

            attendeesList.AddRange(speakerList);

            bool hasInterest = false;
            bool willAttend = false;

            if (liSessionAttendee != null)
            {
                foreach (SessionAttendeeODS.DataObjectSessionAttendee sa in liSessionAttendee)
                {
                    if (sa.Sessions_id == sessionOverview.Sessionid)
                    {
                        if (sa.Interestlevel == Convert.ToInt32(Utils.InterestLevel.Interested))
                        {
                            hasInterest = true;
                        }
                        if (sa.Interestlevel == Convert.ToInt32(Utils.InterestLevel.WillAttend))
                        {
                            willAttend = true;
                        }
                    }
                }
            }

            bool includeSessionInList = true;

            if (RadioButtonIPTAList.SelectedValue.Equals("Interested"))
            {
                includeSessionInList = hasInterest;
            }
            else if (RadioButtonIPTAList.SelectedValue.Equals("Plan To Attend"))
            {
                includeSessionInList = willAttend;
            }
            else if (RadioButtonIPTAList.SelectedValue.Equals("I & P2A"))
            {
                includeSessionInList = hasInterest || willAttend;
            }

            if (includeSessionInList)
            {
                string tagListString = string.Empty;
                var tagsODS = new TagsODS();
                List<TagsODS.DataObjectTags> listTags = tagsODS.GetAllBySession(string.Empty, sessionOverview.Sessionid);
                var sbTags = new StringBuilder();

                if (listTags.Count > 0)
                {
                    foreach (TagsODS.DataObjectTags t in listTags)
                    {
                        sbTags.Append(t.Tagname);
                        sbTags.Append(",");
                    }
                    tagListString = sbTags.ToString();
                }

                string titleLink =
                    string.Format(
                        "<a class=\"sessionTitle\" topic=\"{0}\" href=\"Sessions.aspx?OnlyOne=true&id={1}\">{2}</a>",
                        tagListString, sessionOverview.Sessionid, sessionOverview.Title);

                string evalLink = string.Format("<a href=\"SessionEval.aspx?id={0} \">Evaluate</a>",
                                                sessionOverview.Sessionid);

                sb.Append("<li>");
                sb.Append(titleLink);
                sb.Append("&nbsp;");
                sb.Append("&nbsp;");
                var stringBuilderSpeaker = new StringBuilder();
                for (int index = 0; index < speakerList.Count; index++)
                {
                    var attendee = speakerList[index];
                    stringBuilderSpeaker.Append(Utils.FormatSpeakerHyperlink(attendee.UserFirstName,
                                                                             attendee.UserLastName,
                                                                             attendee.Id,
                                                                             attendee.SaturdayClasses,
                                                                             attendee.SundayClasses,
                                                                             showSpeakerHyperLinks));
                    if (index != speakerList.Count - 1)
                    {
                        stringBuilderSpeaker.Append(",&nbsp;&nbsp;");
                    }
                }
                string stringSpeakers = stringBuilderSpeaker.ToString();
                if (!String.IsNullOrEmpty(stringSpeakers))
                {
                    if (stringSpeakers.EndsWith("&nbsp;&nbsp;,"))
                    {
                        stringSpeakers = stringSpeakers.TrimEnd(new[] {','});
                    }
                    sb.Append(stringSpeakers);
                }

                if (showRoomOnSchedule)
                {
                    sb.Append("&nbsp;");
                    sb.Append("&nbsp;");
                    sb.Append("Room:");
                    sb.Append("&nbsp;");
                    sb.Append("&nbsp;");
                    sb.Append(sessionOverview.Number);
                    sb.Append("&nbsp;");
                    sb.Append("&nbsp;");
                }

                if (ConfigurationManager.AppSettings["ShowSessionEvaluations"] != null &&
                    ConfigurationManager.AppSettings["ShowSessionEvaluations"].ToLower().Equals("true") &&
                    Context.User.Identity.IsAuthenticated)
                {
                    sb.Append(evalLink);
                    sb.Append("&nbsp;");
                    sb.Append("&nbsp;");
                }

                if (isAdmin)
                {
                    int numInterested = sessionAttendeeOds.GetCountBySessionIdAndInterest(sessionOverview.Sessionid, 2);
                    int numPlanToAttend = sessionAttendeeOds.GetCountBySessionIdAndInterest(sessionOverview.Sessionid, 3);
                    totalInterestInSlot += numInterested;
                    totalPlanToAttendInSlot += numPlanToAttend;
                    sb.Append(String.Format("<i>{{I:{0},P:{1}}}</i>", numInterested, numPlanToAttend));
                }

                if (hasInterest)
                {
                    sb.Append("<b><span class=\"SessionInterestText\">(Interested)</span></b>");
                }
                else if (willAttend)
                {
                    sb.Append("<b><span class=\"SessionPlanOnAttendText\">(Planning On Attending)</span></b>");
                }
                else
                {
                    if (Context.User.Identity.IsAuthenticated)
                    {
                        // check and see if on suggested list
                        if (_sessionsSuggested.Contains(sessionOverview.Sessionid))
                        {
                            sb.Append("<b><span class=\"SessionSuggestedText\">(Similar To Your Other Choices)</span></b>");
                        }
                    }
                }

                sb.Append("</li>");
                sb.Append("\r\n");
                sb.Append("\r\n");
            }
        }
        sb.Append("</ul>");

        if (Utils.CheckUserIsAdmin())
        {
            sb.AppendLine(
                "<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
            sb.AppendLine("{Number Sessions This Timeslot (admin only): ");
            sb.AppendLine(totalSessionInSlot.ToString());
            sb.AppendLine(String.Format(" Total I: {0} Total P: {1} ", totalInterestInSlot, totalPlanToAttendInSlot));

            // see if any speaker listed twice here
            //  attendeesList

            var recDups = from p in attendeesList
                        group p by p.Id
                        into g
                        where g.Count() > 1
                        select new
                                   {
                                       g.Key
                                   };
            foreach (var recDup in recDups)
            {
                string firstName =
                   (from data in attendeesList where data.Id == recDup.Key select data.UserFirstName).FirstOrDefault();
                string lastName =
                   (from data in attendeesList where data.Id == recDup.Key select data.UserLastName).FirstOrDefault();
                sb.AppendLine("Duplicated Speaker: " + firstName + " " + lastName);
            }

            sb.AppendLine("}</i><br/><br/>");
        }

        if (!String.IsNullOrEmpty(afterAgenda))
        {
            sb.Append(afterAgenda);
        }

        return sb.ToString();
    }