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

        }
    }
Exemplo n.º 2
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";

            }
        }
    }