public void CountMatchesList() { //Create an instance of the class we want to create clsStudentCollection Students = new clsStudentCollection(); //create some test data to assign to the property List<clsStudentDetails> TestList = new List<clsStudentDetails>(); //add an item to the list //create the item of test data clsStudentDetails TestItem = new clsStudentDetails(); //set its properties TestItem.Firstname = "aneeka"; TestItem.Lastname = "neee"; TestItem.Emailaddress = "*****@*****.**"; TestItem.Mobilenumber = "77882226121"; TestItem.Gender = "male"; TestItem.Datebirth = DateTime.Now.Date; TestItem.AddressName = "233"; TestItem.Cityname = "leicester"; TestItem.Postcode = "le5 6tf"; TestItem.Streetname = "dmu street"; //add the items to the test list TestList.Add(TestItem); //assign the data to the property Students.AllStudents = TestList; //test to see that the two values are the same Assert.AreEqual(Students.AllStudents, TestList); }
public void InstanceOK() { //Create an instance of the class we want to create clsStudentCollection Students = new clsStudentCollection(); //test to see that it exists Assert.IsNotNull(Students); }
public void CountMatchesTestList() { //Create an instance of the class we want to create clsStudentCollection Student = new clsStudentCollection(); //create a list of data to assign to the property List <clsStudent> TestList = new List <clsStudent>(); //add item to the list clsStudent TestItem = new clsStudent(); //set its properties TestItem.FirstName = "Upesh"; TestItem.LastName = "Chavda"; TestItem.AddressLine1 = "40 Western Road"; TestItem.AddressLine2 = "Flat1245"; TestItem.City = "Leicester"; TestItem.PostCode = "LE3 0GH"; TestItem.DateOfBirth = new DateTime(1996, 02, 08); TestItem.Telephone = "07885547885"; TestItem.Email = "*****@*****.**"; //Add items to the list TestList.Add(TestItem); //assign the data to the property Student.AllStudents = TestList; //test to see if they are equal Assert.AreEqual(Student.Count, TestList.Count); }
Int32 DisplayStudents(string CourseFilter) { Int32 StudentNo; string StudentPNumber; string StudentFullName; Int32 StudentCourseNo; clsStudentCollection StudentList = new clsStudentCollection(); StudentList.ReportByCourse(CourseFilter); Int32 RecordCount; Int32 Index = 0; RecordCount = StudentList.Count; lstStudents.Items.Clear(); while (Index < RecordCount) { StudentNo = StudentList.StudentList[Index].StudentNo; StudentPNumber = StudentList.StudentList[Index].StudentPNumber; StudentFullName = StudentList.StudentList[Index].StudentFullName; StudentCourseNo = StudentList.StudentList[Index].StudentCourseNo; ListItem NewEntry = new ListItem(StudentFullName + " " + StudentPNumber, StudentNo.ToString()); lstStudents.Items.Add(NewEntry); Index++; } return(RecordCount); }
public void TwoStudentsPresent() { //Create an instance of the class we want to create clsStudentCollection Student = new clsStudentCollection(); //test to see if they are equal Assert.AreEqual(Student.Count, 2); }
public void InstanceOk() { //Create an instance of the class we want to create clsStudentCollection AllStudent = new clsStudentCollection(); //test to see if it exists Assert.IsNotNull(AllStudent); }
public void CountPropertyOK() { //Create an instance of the class we want to create clsStudentCollection Students = new clsStudentCollection(); //create some test data to assign to the property Int32 SomeCount = 0; //assign the data to the property Students.Count = SomeCount; //test to see that the two values are the same Assert.AreEqual(Students.Count, SomeCount); }
public void CountPropertyOK() { //Create an instance of the class we want to create clsStudentCollection AllStudent = new clsStudentCollection(); //create some test data to assign to the property Int32 SomeCount = 0; //assign the data to the property AllStudent.Count = SomeCount; //test to see if the two values match Assert.AreEqual(AllStudent.Count, SomeCount); }
protected void btnStudentConfirm_Click(object sender, EventArgs e) { clsStudent ThisStudent = new clsStudent(); string ErrorMsg; ErrorMsg = ThisStudent.StudentValid(txtStudentPNumber.Text, txtStudentNames.Text, txtStudentDate.Text, txtStudentAttendancePercentage.Text, txtStartingYear.Text); lblError.Visible = true; if (ErrorMsg == "") { clsStudentCollection NewStudent = new clsStudentCollection(); if (StudentNo == -1) { NewStudent.ThisStudent.StudentPNumber = txtStudentPNumber.Text; NewStudent.ThisStudent.StudentFullName = txtStudentNames.Text; NewStudent.ThisStudent.StudentAdditionDate = Convert.ToDateTime(txtStudentDate.Text); NewStudent.ThisStudent.StudentAttendancePercentage = Convert.ToDecimal(txtStudentAttendancePercentage.Text); NewStudent.ThisStudent.StudentExpelled = chkStudentExpelled.Checked; NewStudent.ThisStudent.StudentStartingYear = Convert.ToInt32(txtStartingYear.Text); NewStudent.ThisStudent.StudentCourseNo = Convert.ToInt32(ddlStudentCourse.SelectedValue); NewStudent.ThisStudent.StudentTutorNo = Convert.ToInt32(ddlStudentTutor.SelectedValue); NewStudent.Add(); } else { NewStudent.ThisStudent.StudentNo = StudentNo; NewStudent.ThisStudent.StudentPNumber = txtStudentPNumber.Text; NewStudent.ThisStudent.StudentFullName = txtStudentNames.Text; NewStudent.ThisStudent.StudentAdditionDate = Convert.ToDateTime(txtStudentDate.Text); NewStudent.ThisStudent.StudentAttendancePercentage = Convert.ToDecimal(txtStudentAttendancePercentage.Text); NewStudent.ThisStudent.StudentExpelled = chkStudentExpelled.Checked; NewStudent.ThisStudent.StudentStartingYear = Convert.ToInt32(txtStartingYear.Text); NewStudent.ThisStudent.StudentCourseNo = Convert.ToInt32(ddlStudentCourse.SelectedValue); NewStudent.ThisStudent.StudentTutorNo = Convert.ToInt32(ddlStudentTutor.SelectedValue); NewStudent.Update(); } Response.Redirect("Default.aspx"); } else { lblError.Text = ErrorMsg; } }
void DisplayStudents() { //create an instance of the County Collection clsStudentCollection students = new clsStudentCollection(); //set the data source to the list of counties in the collection lstStudents.DataSource = students.StudentList; //set the name of the primary key lstStudents.DataValueField = "personID"; //set the data field to display lstStudents.DataTextField = "FirstName"; //bind the data to the list lstStudents.DataBind(); }
protected void btnRemoveConfirm_Click(object sender, EventArgs e) { clsStudentCollection MyStudents = new clsStudentCollection(); Boolean Found; Found = MyStudents.ThisStudent.Find(StudentNo); if (Found) { MyStudents.Delete(); } Response.Redirect("Default.aspx"); }
void DisplayStudent() { //create an instance of the Student Collection clsStudentCollection studentCollection = new clsStudentCollection(); //find the record to update studentCollection.ThisStudent.Find(StudentID); //display the data for this record txtStudentID.Text = studentCollection.ThisStudent.StudentID.ToString(); txtFirstName.Text = studentCollection.ThisStudent.FirstName; txtLastName.Text = studentCollection.ThisStudent.LastName; txtAddressLine1.Text = studentCollection.ThisStudent.AddressLine1; txtAddressLine2.Text = studentCollection.ThisStudent.AddressLine2; txtCity.Text = studentCollection.ThisStudent.City; txtTelephone.Text = studentCollection.ThisStudent.Telephone; txtEmail.Text = studentCollection.ThisStudent.Email; calDOB.SelectedDate = studentCollection.ThisStudent.DateOfBirth; }