/* * **************************************** My changes START here ************************************************ */ //private connection = null; //private SqlCommand command; // private bool insertReady; /* * <summary> * Updates student records in the Database * </summary> * <returns></returns> */ public void Update() { IDbTransaction transaction = null; try { // Create a transaction to ensure all child properties are inserted along with the student record transaction = DataServiceBase.BeginTransaction(); //Create a Student Data Service object with the transction object StudentDataService dataService = new StudentDataService(transaction); //Call the insert method dataService.Update(_studentID, _last4Ssn, _firstName, _lastName, _phoneCell, _phoneDay, _phoneEvening, _email, _address, _city, _state, _zipcode, _gpa, _graduationDate); // Update the Internship Requirement Child Object with the transaction _internshipRequirement.Update(_studentID, transaction); // Update employer if exists if (_employer != null) { _employer.Update(_studentID, transaction); } // Commit the Transaction, ensures all child properites are updated along with the studento Objects transaction.Commit(); } /*catch * { * // Remove all records from the database if an error occurs * transaction.Rollback(); * throw; * }*/ catch (Exception ex) { // Remove all records from the database if an error occurs transaction.Rollback(); // throw new System.Exception(ex.Message); throw new System.Exception("Exception: '" + ex.Message + "' occured while updating data! All transactions have been removed from database!"); } }