}//end of back button // getting values from selected row and creating an instance of Student object and pass that to // NewAccount where I need to populate the fields relevant to students from this class private void btnSelect_Click(object sender, EventArgs e) { int studId = Convert.ToInt32(dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentID)].Value); string fName = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentFName)].Value.ToString(); string studLName = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentLName)].Value.ToString(); string studEmail = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentEmail)].Value.ToString(); string studPhone = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentPhone)].Value.ToString(); string studAddr1 = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentAddress1)].Value.ToString(); string studAddr2 = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentAddress2)].Value.ToString(); string studCity = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentCity)].Value.ToString(); string studCounty = dgvDisplay.CurrentRow.Cells[Convert.ToInt32(OOP2_SGetStudents.SPGetStudents_StudentCounty)].Value.ToString(); Student stud = new Student(studId, fName, studLName, studEmail, studPhone, studAddr1, studAddr2, studCity, studCounty); if (stud != null) { StudentArgs sArg = new StudentArgs(); sArg.Student = stud; OnStudentSelected(this, sArg); this.Close(); } else { MessageBox.Show("Please make a selection"); } }//end of select button
/// <summary> /// Copies the Deserialized Json data into a Student /// </summary> /// <param name="data">raw data object for json-deserialized student</param> public void Deserialize(StudentArgs data) { this.id = data.ID.ToString(); this.firstName = data.FName; this.lastName = data.LName; foreach (EnrolledCourseArgs args in data.Courses) { courses.Add(new EnrolledCourse(args)); } }
/// <summary> /// Initializes <see cref="Student"/> with <see cref="StudentArgs"/> using <see cref="Student.Deserialize(StudentArgs)"/> /// </summary> /// <param name="args">Student data needed to fully populate a student</param> /// <see cref="StudentArgs"/> public Student(StudentArgs args) { courses = new List <EnrolledCourse>(); Deserialize(args); }
}//end of existing click //event handler for when an existing student is selected //will set the value of Student property to the one passed void ses_OnStudentSelected(object sender, StudentArgs e) { this.Student = e.Student; ExistingStud = true; PrimeStudentFields(); }//end of handler
public void PrepareRoom(object sender, StudentArgs student) { }
public void SubscribeNewsLetter(object sender, StudentArgs student) { }