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(); }
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
//this constructor is a little patch so that we can simulate a constructor overiding //because we need to make it possible to create a class using two different types of strings so the int 0 is just to make //the distinction between the two public student22(String UserID, int dontCareNum) { this.student_id = UserID; storedProcedure myProc1 = new storedProcedure("getUserNameFromUserID"); myProc1.addParam(new paramter("@UserID", UserID)); this.username = myProc1.executeScalarParam(); con = new SqlConnection(myDbConString); configStudent(); }
public student22(String currentUserName) { this.username = currentUserName; storedProcedure myProc1 = new storedProcedure("getUserId"); myProc1.addParam(new paramter("@UserName", currentUserName)); this.student_id = myProc1.executeScalarParam(); con = new SqlConnection(myDbConString); configStudent(); }
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; } }