Esempio n. 1
0
    private void configStudent()
    {
        storedProcedure myProc1            = new storedProcedure("getMajorName");
        paramter        getMajorNameParam1 = new paramter("@student_id", this.student_id);

        myProc1.addParam(getMajorNameParam1);
        this.major = myProc1.executeScalarParam();


        storedProcedure myProc2             = new storedProcedure("getProfilePic");
        paramter        getProfilePicParam1 = new paramter("@UserId", this.student_id);

        myProc2.addParam(getProfilePicParam1);
        this.profilePic = myProc2.executeScalarParam();


        storedProcedure myProc3             = new storedProcedure("getActualName");
        paramter        getActualNameParam1 = new paramter("@student_id", this.student_id);

        myProc3.addParam(getActualNameParam1);
        this.actualName = myProc3.executeScalarParam();

        storedProcedure myProc4          = new storedProcedure("getAboutMe");
        paramter        getAboutMeParam1 = new paramter("@student_id", this.student_id);

        myProc4.addParam(getAboutMeParam1);
        this.aboutMe = myProc4.executeScalarParam();
    }
Esempio n. 2
0
    public void search_Click(object sender, EventArgs e)
    {
        //if the user enters anything in the search  box
        if (!(String.IsNullOrEmpty(usernameInSearchBox)))
        {
            //check the entered text to see if it exist in the users table
            storedProcedure myProc = new storedProcedure("checkUserName");
            paramter        param1 = new paramter("@theUsername", usernameInSearchBox);
            myProc.addParam(param1);
            //if that username exist the userID will be returned
            userId = myProc.executeScalarParam();

            //if the userId is not null or empty means the user was found
            if (!(String.IsNullOrEmpty(userId)))
            {
                userFoundLabel.Text    = "user " + usernameInSearchBox + " found";
                userFoundLabel.Visible = true;

                //send this username to the viewProfile page
                string name = usernameInSearchBox;
                Session["name"] = name;
                Response.Redirect("viewProfile.aspx");
            }
            else
            {
                userFoundLabel.Text    = "" + usernameInSearchBox + " is not a valid username";
                userFoundLabel.Visible = true;
            }
        }
        else
        {
            userFoundLabel.Text    = "Enter a username";
            userFoundLabel.Visible = true;
        }
    }//end of search_Click
Esempio n. 3
0
    public void setStudentAttributes(String newName, String newSelectedMajor, String newAboutMe)
    {
        if (String.IsNullOrEmpty(newName))
        {
            newName = this.actualName;
        }
        else
        {
            this.actualName = newName;
        }

        if (String.IsNullOrEmpty(newSelectedMajor))
        {
            newSelectedMajor = this.major;
        }
        else
        {
            this.major = newSelectedMajor;
        }

        this.aboutMe = newAboutMe;


        paramter param1 = new paramter("@student_id", this.student_id);
        paramter param2 = new paramter("@actualName", newName);
        paramter param3 = new paramter("@major_name", newSelectedMajor);
        paramter param4 = new paramter("@text", newAboutMe);

        storedProcedure myProc = new storedProcedure("updateStudentInfo");

        myProc.addParam(param1);
        myProc.addParam(param2);
        myProc.addParam(param3);
        myProc.addParam(param4);

        myProc.executeNonQueryParam();
    }
Esempio n. 4
0
    public void search_Click(object sender, EventArgs e)
    {
        //if the user enters anything in the search  box
        if (!(String.IsNullOrEmpty(usernameInSearchBox)))
        {
            //check the entered text to see if it exist in the users table
            storedProcedure myProc = new storedProcedure("checkUserName");
            paramter param1 = new paramter("@theUsername", usernameInSearchBox);
            myProc.addParam(param1);
            //if that username exist the userID will be returned
            userId = myProc.executeScalarParam();

            //if the userId is not null or empty means the user was found
            if (!(String.IsNullOrEmpty(userId)))
            {
                userFoundLabel.Text = "user " + usernameInSearchBox + " found";
                userFoundLabel.Visible = true;

                //send this username to the viewProfile page
                string name = usernameInSearchBox;
                Session["name"] = name;
                Response.Redirect("viewProfile.aspx");
            }
            else
            {
                userFoundLabel.Text = "" + usernameInSearchBox + " is not a valid username";
                userFoundLabel.Visible = true;
            }

        }
        else
        {
            userFoundLabel.Text = "Enter a username";
            userFoundLabel.Visible = true;

        }
    }
Esempio n. 5
0
 public void addParam(paramter para)
 {
     paramList.Add(para);
 }
Esempio n. 6
0
 public void addParam(paramter para)
 {
     paramList.Add(para);
 }
Esempio n. 7
0
    private void configStudent()
    {
        storedProcedure myProc1 = new storedProcedure("getMajorName");
        paramter getMajorNameParam1 = new paramter("@student_id", this.student_id);
        myProc1.addParam(getMajorNameParam1);
        this.major = myProc1.executeScalarParam();

        storedProcedure myProc2 = new storedProcedure("getProfilePic");
        paramter getProfilePicParam1 = new paramter("@UserId", this.student_id);
        myProc2.addParam(getProfilePicParam1);
        this.profilePic = myProc2.executeScalarParam();

        storedProcedure myProc3 = new storedProcedure("getActualName");
        paramter getActualNameParam1 = new paramter("@student_id", this.student_id);
        myProc3.addParam(getActualNameParam1);
        this.actualName = myProc3.executeScalarParam();

        storedProcedure myProc4 = new storedProcedure("getAboutMe");
        paramter getAboutMeParam1 = new paramter("@student_id", this.student_id);
        myProc4.addParam(getAboutMeParam1);
        this.aboutMe = myProc4.executeScalarParam();
    }
Esempio n. 8
0
    public void setStudentAttributes(String newName,String newSelectedMajor,String newAboutMe)
    {
        if (String.IsNullOrEmpty(newName))
            newName = this.actualName;
        else this.actualName = newName;

        if (String.IsNullOrEmpty(newSelectedMajor))
            newSelectedMajor = this.major;
        else this.major = newSelectedMajor;

        this.aboutMe = newAboutMe;

        paramter param1 = new paramter("@student_id", this.student_id);
        paramter param2 = new paramter("@actualName", newName);
        paramter param3 = new paramter("@major_name", newSelectedMajor);
        paramter param4 = new paramter("@text", newAboutMe);

        storedProcedure myProc = new storedProcedure("updateStudentInfo");
        myProc.addParam(param1);
        myProc.addParam(param2);
        myProc.addParam(param3);
        myProc.addParam(param4);

        myProc.executeNonQueryParam();
    }