Esempio n. 1
0
    protected static string GetSessionId(Guid PKID)
    {
        int sessionId = -1;
        var sessionsODS = new SessionsODS();
        List<SessionsODS.DataObjectSessions> liSessions = sessionsODS.GetByPKID(PKID);
        if (liSessions.Count > 0)
        {
            sessionId = liSessions[0].Id;
        }

        return sessionId.ToString();
    }
Esempio n. 2
0
    private void UpdateSessionInfo()
    {
        //SessionsODS sessionsODS = new SessionsODS();

        //List<SessionsODS.DataObjectSessions> sessionsLi =
        //    sessionsODS.sessionsResult(sessionsId);

        var sessionsResults = SessionsManager.I.Get(new SessionsQuery() { Id = sessionsId }).FirstOrDefault();

        if (sessionsResults != null)
        {
            if (Context.User.Identity.IsAuthenticated)
            {
                if (!sessionsResults.Username.Equals(Context.User.Identity.Name) && !Utils.CheckUserIsAdmin())
                {
                    return; // kluky, but just fast check
                }
            }
            else
            {
                return; // kluky, but just fast check
            }

            attendeeId = Utils.GetAttendeesIdFromUsername(sessionsResults.Username);
        }

        // remove cache
        // break existing cache
        string keyToRemove = String.Format("SessionsAllByStartTime--1-{0}", Utils.GetCurrentCodeCampYear().ToString());
        HttpContext.Current.Cache.Remove(keyToRemove);

        keyToRemove = String.Format("CacheGetSecondaryPresentersBySessionId-{0}-{1}-{2}", sessionsResults.Id, sessionsResults.Username, "True");
        HttpContext.Current.Cache.Remove(keyToRemove);

        keyToRemove = String.Format("CacheGetSecondaryPresentersBySessionId-{0}-{1}-{2}", sessionsResults.Id, sessionsResults.Username, "False");
        HttpContext.Current.Cache.Remove(keyToRemove);

        // first, if new session requested, add it
        if (!String.IsNullOrEmpty(TextBoxAdditionalSpeakerLoginName.Text))
        {
            // check and see if this is a real username
            int attendeeIdFromAddSpeakerTextBox = Utils.GetAttendeesIdFromUsername(TextBoxAdditionalSpeakerLoginName.Text.Trim());
            if (attendeeIdFromAddSpeakerTextBox > 0)
            {
                // verify person not in session already
                List<int> excludeAttendeeIdList =
                    (from data in Utils.GetSecondaryPresentersBySessionId(sessionsId, string.Empty)
                     // by leaving second parameter empty, will get all
                     select data.Id).ToList();
                if (!excludeAttendeeIdList.Contains(attendeeIdFromAddSpeakerTextBox) && !CheckBoxRemoveAttendee.Checked)
                {
                    Utils.AddPresenterToSession(sessionsId, attendeeIdFromAddSpeakerTextBox);
                }

                // don't allow person to remove themselves from session
                if (CheckBoxRemoveAttendee.Checked && attendeeIdFromAddSpeakerTextBox != attendeeId)
                {
                    Utils.RemovePresenterToSession(sessionsId, attendeeIdFromAddSpeakerTextBox);
                }
            }
        }

        List<int> updateTags = UpdateNewTags();

        foreach (ListItem li in CheckBoxListTags.Items)
        {
            if (li.Selected)
            {
                int tagId = Convert.ToInt32(li.Value);
                updateTags.Add(tagId);
            }
        }

        SessionsODS sessionsODS = new SessionsODS();
        sessionsODS.UpdateSession(sessionsId,
                                  //TextBoxSlides.Text,
                                  "",
                                  CheckBoxQueueEmailNotification.Checked,
                                  CheckBoxDoNotShowPrimarySpeaker.Checked,
                                  Context.Server.HtmlEncode(TextBoxTitle.Text),
                                  Context.Server.HtmlEncode(TextBoxHashTags.Text),
                                  Context.Server.HtmlEncode(TextBoxSummary.Text),
                                  DropDownListLevels.SelectedIndex + 1,
                                  updateTags,Convert.ToInt32(DropDownListSponsors.SelectedValue));

        if (SpeakerHandle1Tr.Visible)
        {
            Utils.UpdateTwitterHandleForAttendee(SpeakerHandle1Id.Text,
                                                 TextBoxSpeakerHandle1.Text);
        }

        if (SpeakerHandle2Tr.Visible)
        {
            Utils.UpdateTwitterHandleForAttendee(SpeakerHandle2Id.Text,
                                                 TextBoxSpeakerHandle2.Text);
        }

        if (SpeakerHandle3Tr.Visible)
        {
            Utils.UpdateTwitterHandleForAttendee(SpeakerHandle3Id.Text,
                                                 TextBoxSpeakerHandle3.Text);
        }

        if ((Utils.CheckUserIsAdmin() || Utils.CheckUserIsSpeakerAssignOwnMaterialsUrl())  && !String.IsNullOrEmpty(TextBoxMaterialUrl.Text))
        {
            Utils.UpdateSessionMaterialUrl(sessionsId,TextBoxMaterialUrl.Text);
        }

        DisplayData(sessionsResults);

        CodeCampSV.Utils.CacheClear("sessions");
        String tagsCache = CodeCampSV.Utils.CacheTagsGetBySession + "_" + sessionsId.ToString(CultureInfo.InvariantCulture);
        HttpContext.Current.Cache.Remove(tagsCache);

        Response.Redirect("~/Sessions.aspx?id=");
    }
Esempio n. 3
0
    protected string GetAttendeeAnySessionIdByUsername(string username)
    {
        int sessionId = -1;
        var sessionsODS = new SessionsODS();
        List<SessionsODS.DataObjectSessions> liSessions = sessionsODS.GetAllSessionsByUsername(username);
        if (liSessions.Count > 0)
        {
            sessionId = liSessions[0].Id;
        }

        return sessionId.ToString();
    }
Esempio n. 4
0
    private List<int> GetListOfSessionsBasedOnQueryParams(CodeCampDataContext codeCampDataContext)
    {
        var sessionIds = new List<int>();

        // need to get all query params and do filter here
        var sessionsOds = new SessionsODS();

        int outInt = 0;
        string str = Request.QueryString["id"];
        bool foundId = Int32.TryParse(str, out outInt);
        if (foundId)
        {
            sessionIds = new List<int>() {outInt};
        }
        else
        {
            //var sessions =
            //    codeCampDataContext.Sessions.Where(a => a.CodeCampYearId == Utils.CurrentCodeCampYear).ToList();

            sessionIds =
                codeCampDataContext.Sessions.Where(a => a.CodeCampYearId == Utils.CurrentCodeCampYear).Select(a => a.Id)
                                   .ToList();
        }

        return sessionIds;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int sessionId = -1;
            int pictureid = -1;

            GetParams(ref sessionId, ref pictureid);

            HyperLinkReturnToPictures.NavigateUrl = "~/SessionAssignPictures.aspx?sessionid=" + sessionId;

            LabelPresenterName.Text = Utils.GetUserNameOfSession(sessionId);
            SessionsODS sessionsODS = new SessionsODS();
            List<SessionsODS.DataObjectSessions> li =
                sessionsODS.GetByPrimaryKeySessions(sessionId);
            LabelSessionName.Text = li[0].Title;

            Image1.ImageUrl = "~/DisplayImage.ashx?sizex=0&pictureid=" + pictureid.ToString();
            string fileName = string.Empty;
            // Get the description
            using (SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["CodeCampSV06"].ConnectionString))
            {
                sqlConnection.Open();
                string sqlSelect =
                @"SELECT Pictures.FileName,
                       SessionPictures.Description
                FROM Pictures
                     INNER JOIN SessionPictures ON (Pictures.id = SessionPictures.PictureId)
                WHERE (SessionPictures.PictureId = pictures.id) AND
                      SessionPictures.SessionId = @SessionId AND
                      SessionPictures.PictureId = @PictureId";
                SqlDataReader reader = null;
                try
                {
                    SqlCommand command = new SqlCommand(sqlSelect, sqlConnection);
                    command.Parameters.Add("@PictureId", SqlDbType.Int).Value = pictureid;
                    command.Parameters.Add("@SessionId", SqlDbType.Int).Value = sessionId;

                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                         if (!reader.IsDBNull(0))
                        {
                            fileName = CodeCampSV.Utils.ConvertEncodedHTMLToRealHTML(reader.GetString(0));
                        }
                        if (!reader.IsDBNull(1))
                        {
                            TextBoxDescription.Text = CodeCampSV.Utils.ConvertEncodedHTMLToRealHTML(reader.GetString(1));
                        }

                    }
                }
                catch (Exception eee)
                {
                    throw new ApplicationException(eee.ToString());
                }
                finally
                {
                    if (reader != null) reader.Close();
                }

            }

            HyperLinkFullRes.NavigateUrl = "http://peterkellner.net/images/CodeCampSV06/" + fileName.ToUpper();

        }
    }
Esempio n. 6
0
        public List<DataObjectAttendees> GetAllAttendeesBetweenDatesNotPresenter(DateTime startDate, DateTime endDate)
        {
            // Get List of SessionId's for this year only
            List<int> sessionsListIdThisYear = GetSessionsListIdThisYear();

            List<string> presenterList = new List<string>();
            SessionsODS sessionODS = new SessionsODS();
            List<SessionsODS.DataObjectSessions> sessionList = sessionODS.GetAllByStartTime();
            foreach (var sessions in sessionList)
            {
                if (!presenterList.Contains(sessions.Username))
                {
                    if (sessionsListIdThisYear.Contains(sessions.Id))
                    {
                        presenterList.Add(sessions.Username);
                    }
                }
            }

            // get attendess this year
            var userNamesThisYear = AttendeesCodeCampYearManager.I.GetUsernameListByCodeCampYearId(Utils.CurrentCodeCampYear);

            List<DataObjectAttendees> attendeesResult = new List<DataObjectAttendees>();
            List<DataObjectAttendees> attendees = GetAllAttendees("");
            foreach (var attendee in attendees)
            {
                if (attendee.Creationdate.CompareTo(startDate) > 0 && attendee.Creationdate.CompareTo(endDate) < 0)
                {
                    if (!presenterList.Contains(attendee.Username))
                    {
                        if (userNamesThisYear.Contains(attendee.Username))
                        {
                            attendeesResult.Add(attendee);
                        }
                    }
                }
            }
            return attendeesResult;
        }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // http://localhost:4443/Web/SessionEval.aspx?id=2
        string requestIdStr = Request.QueryString["id"];
        bool good = Int32.TryParse(requestIdStr, out sessionId);
        if (!good)
        {
            Response.Redirect("~/Sessions.aspx");
        }

        if (!IsPostBack)
        {
            if (Context.User.Identity.IsAuthenticated) // should always be to get here
            {
                Label1.Text = string.Empty;
                Label2.Text = string.Empty;

                HyperLinkReturn1.NavigateUrl = "~/Sessions.aspx?OnlyOne=true&id=" + sessionId.ToString();
                HyperLinkReturn2.NavigateUrl = "~/Sessions.aspx?OnlyOne=true&id=" + sessionId.ToString();

                HyperLinkReturn4.NavigateUrl = "~/SessionsOverview.aspx";
                HyperLinkReturn3.NavigateUrl = "~/SessionsOverview.aspx";

                HyperLink2.NavigateUrl = "~/MyEvals.aspx";
                HyperLink1.NavigateUrl = "~/MyEvals.aspx";

                LabelPresenterName.Text = Utils.GetUserNameOfSession(sessionId);
                SessionsODS sessionsODS = new SessionsODS();
                List<SessionsODS.DataObjectSessions> li =
                    sessionsODS.GetByPrimaryKeySessions(sessionId);
                LabelSessionName.Text = li[0].Title;

                ButtonUpdate1.Enabled = true;
                ButtonUpdate2.Enabled = true;

                this.AddRadioButtonChoices(RBLCourseAsWhole);
                this.AddRadioButtonChoices(RBLCourseContent);
                this.AddRadioButtonChoices(RBLInstructorAbilityExplain);
                this.AddRadioButtonChoices(RBLInstructorEffective);
                this.AddRadioButtonChoices(RBLInstructorKnowledge);
                this.AddRadioButtonChoices(RBLQualityOfFacility);
                this.AddRadioButtonChoices(RBLContentLevel);
                this.AddRadioButtonChoices(RBLOverallCodeCamp);

                SessionEvalsODS seODS = new SessionEvalsODS();
                List<CodeCampSV.SessionEvalsODS.DataObjectSessionEvals> liEvals =
                    seODS.GetByUsernameSessionId(Context.User.Identity.Name, sessionId);
                if (liEvals.Count > 0)
                {
                    SessionEvalsODS.DataObjectSessionEvals se = (SessionEvalsODS.DataObjectSessionEvals)liEvals[0];
                    RBLCourseAsWhole.SelectedValue = se.Courseaswhole.ToString();
                    RBLCourseContent.SelectedValue = se.Coursecontent.ToString();
                    RBLInstructorAbilityExplain.SelectedValue = se.Instructorabilityexplain.ToString();
                    RBLInstructorEffective.SelectedValue = se.Instructoreffective.ToString();
                    RBLInstructorKnowledge.SelectedValue = se.Instructorknowledge.ToString();
                    RBLQualityOfFacility.SelectedValue = se.Qualityoffacility.ToString();
                    RBLContentLevel.SelectedValue = se.Contentlevel.ToString();
                    RBLOverallCodeCamp.SelectedValue = se.Overallcodecamp.ToString();

                    CheckBoxDiscloseName.Checked = se.Discloseeval;
                    TextBoxFavorite.Text = se.Favorite;
                    TextBoxImproved.Text = se.Improved;
                    TextBoxGeneralComments.Text = se.Generalcomments;
                }
            }
            else
            {
                Label1.Text = "You Must Be Logged In To Enter Evaluations";
                Label2.Text = "You Must Be Logged In To Enter Evaluations";

            }
        }
    }