void DisplayTutor(Int32 TutorsId) { clsTutor myTutor = new clsTutor(); myTutor.Find(TutorsId); txtTutorCertificateCount.Text = Convert.ToString(myTutor.TutorCertificates); txtTutorFirstName.Text = myTutor.TutorName; txtTutorLastName.Text = myTutor.TutorSurname; txtTutorRegisteredOn.Text = myTutor.TutorRegisterDate.ToString("dd/MM/yyyy"); chkTutorEligible.Checked = myTutor.TutorEligible; ddlTutorTeachingCourse.SelectedIndex = myTutor.TutorCourseNo - 1; }
public void FindMethodOK() { //create an instance of the class we want to create clsTutor aTutor = new clsTutor(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to assign to the property Int32 tutorId = 1; //invoke the method Found = aTutor.Find(tutorId); //test to see if the result is correct Assert.IsTrue(Found); }
public void TestSubjectAddedFound() { //create an instance of the class we want to create clsTutor aTutor = new clsTutor(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assumes that it is) Boolean Ok = true; //create some test data to assign to use with the method Int32 tutorId = 1; //invoke the method Found = aTutor.Find(tutorId); //get subject from class and compare with expected result if (aTutor.tutorSubject != "Chemistry") { Ok = false; } //test to see that the result is correct Assert.IsTrue(Ok); }
public void TestPasswordAddedFound() { //create an instance of the class we want to create clsTutor aTutor = new clsTutor(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assumes that it is) Boolean Ok = true; //create some test data to assign to use with the method Int32 tutorId = 1; //invoke the method Found = aTutor.Find(tutorId); //get password from class and compare with what the result should be if (aTutor.tutorPassword != "12345678910") { Ok = false; } //test to see that the result is correct Assert.IsTrue(Ok); }
public void TestDateAddedFound() { //create an instance of the class we want to create clsTutor aTutor = new clsTutor(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assumes that it is) Boolean Ok = true; //create some test data to assign to use with the method Int32 tutorId = 1; //invoke the method Found = aTutor.Find(tutorId); //check the property if (aTutor.tutorDateAdded != Convert.ToDateTime("17/03/2020")) { Ok = false; } //test to see that the result is correct Assert.IsTrue(Ok); }
public void TestTutorNotFound() { //create an instance of the class we want to create clsTutor aTutor = new clsTutor(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assumes that it is) Boolean Ok = true; //create some test data to assign to use with the method Int32 tutorId = 1; //invoke the method Found = aTutor.Find(tutorId); //check the tutor id number if (aTutor.tutorId != 1) { Ok = false; } //test to see that the result is correct Assert.IsTrue(Ok); }
protected void btnFind_Click(object sender, EventArgs e) { //create an instance of the tutor class clsTutor aTutor = new clsTutor(); //variable to store the primary key Int32 tutorId; //variable to store the result of the find operation Boolean Found = false; //get the primary key entered by the user tutorId = Convert.ToInt32(txtTutorId.Text); //find the record Found = aTutor.Find(tutorId); //if record is found if (Found == true) { //display the values of the properties in the form txtFirstName.Text = aTutor.tutorFirstName; txtLastName.Text = aTutor.tutorLastName; txtEmail.Text = aTutor.tutorEmail; txtSubject.Text = aTutor.tutorSubject; chkAvailable.Checked = aTutor.tutorAvailabe; txtDateAdded.Text = aTutor.tutorDateAdded.ToString(); txtPassword.Text = aTutor.tutorPassword; //hide the error label as we encountered no errors lblError.Visible = false; } else //record not found { string Error = "The record with the ID number " + tutorId + " was not found"; //display the error message lblError.Text = "[" + Error + "]"; //set label to visible lblError.Visible = true; } }
protected void btnSignIn_Click(object sender, EventArgs e) { //create an instance of the tutor class clsTutor aTutor = new clsTutor(); //variable to store the primary key Int32 tutorId; //variable to store the result of the find operation Boolean Found = false; //get the primary key entered by the user tutorId = Convert.ToInt32(txtTutorId.Text); //find the record Found = aTutor.Find(tutorId); //if record is found if (Found == true) { if (aTutor.tutorId == tutorId && aTutor.tutorPassword == txtTutorPassword.Text) { //store the data in the session object Session["tutorId"] = tutorId; //redirect to the edit page Response.Redirect("TutorPersonalDetails.aspx"); //hide the error label as we encountered no errors lblError.Visible = false; } else //record not found { string Error = "The tutor with the ID number " + tutorId + " was not found or your Password is incorrect"; //display the error message lblError.Text = "[" + Error + "]"; //set label to visible lblError.Visible = true; } } }