Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(HttpContext.Current.User.Identity.IsAuthenticated))
        {

            FormsAuthentication.SignOut();
            Session.Clear();
            Response.Redirect("~/Default.aspx");
        }
        currentUserName = HttpContext.Current.User.Identity.Name;
        UserId = Membership.GetUser(currentUserName).ProviderUserKey.ToString();

        if (UserId == null)
        {
            Response.Redirect("~/Default");
        }

        //if (!IsPostBack)   //if this is the first time the page is loading
        currentStudent = new student22(currentUserName);

        Label2.Visible = false;

        //  if (!IsPostBack) you actually want it to get data every time the page is loaded
        //so comment the postback method instead

        //get information about the currently logged in student
        Image1.ImageUrl = "ImageHandler.ashx?UserId=" + UserId;
        studentName = currentStudent.getActualName();
        majorName = currentStudent.getMajor();
        AboutYourselve = currentStudent.getAboutMe();

        //set labels in front end
        studentNameLabel.Text = studentName;
        usernameLabel.Text = currentUserName;
        majorNameLabel.Text = majorName;

        if (!IsPostBack)   //if this is the first time the page is loading
            aboutMeBox.Text = AboutYourselve;

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //get all major names in the major table and add them to the drop down menu called majorsDropDown
        if (!IsPostBack)
        {
            majors majorsObject = new majors();

            majorsList = majorsObject.getMajorsList();

            majorsDropDown.Items.Clear();
            majorsDropDown.Items.Insert(0, new ListItem("Select Major", ""));

            foreach (String theMajorName in majorsList)
            {
                majorsDropDown.Items.Add(theMajorName);
            }

        }//end of if (!IsPostBack)
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //Image.ImageUrl= currentStudent.getProfilePic();
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(HttpContext.Current.User.Identity.IsAuthenticated))
        {
            FormsAuthentication.SignOut();
            Session.Clear();
            Response.Redirect("~/Default.aspx");
        }
        currentUserName = HttpContext.Current.User.Identity.Name;
        UserId          = Membership.GetUser(currentUserName).ProviderUserKey.ToString();


        if (UserId == null)
        {
            Response.Redirect("~/Default");
        }


        //if (!IsPostBack)   //if this is the first time the page is loading
        currentStudent = new student22(currentUserName);

        Label2.Visible = false;

        //  if (!IsPostBack) you actually want it to get data every time the page is loaded
        //so comment the postback method instead


        //get information about the currently logged in student
        Image1.ImageUrl = "ImageHandler.ashx?UserId=" + UserId;
        studentName     = currentStudent.getActualName();
        majorName       = currentStudent.getMajor();
        AboutYourselve  = currentStudent.getAboutMe();


        //set labels in front end
        studentNameLabel.Text = studentName;
        usernameLabel.Text    = currentUserName;
        majorNameLabel.Text   = majorName;

        if (!IsPostBack)   //if this is the first time the page is loading
        {
            aboutMeBox.Text = AboutYourselve;
        }



        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //get all major names in the major table and add them to the drop down menu called majorsDropDown
        if (!IsPostBack)
        {
            majors majorsObject = new majors();

            majorsList = majorsObject.getMajorsList();

            majorsDropDown.Items.Clear();
            majorsDropDown.Items.Insert(0, new ListItem("Select Major", ""));

            foreach (String theMajorName in majorsList)
            {
                majorsDropDown.Items.Add(theMajorName);
            }
        }//end of if (!IsPostBack)
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //Image.ImageUrl= currentStudent.getProfilePic();
    }