//void DisplayTheConsultant()
        //{
        //    //create an instance of Consultantslist
        //    clsConsultantCollection Consultantslist = new clsConsultantCollection();
        //    //find the record to update
        //    Consultantslist.ThisConsultant.Find(ConsultantNo);
        //    //display the data for this record
        //    textBoxNo.Text = Consultantslist.ThisConsultant.ConsultantNo.ToString();
        //    textBoxfirstName.Text = Consultantslist.ThisConsultant.FirstName;
        //    textBoxlastName.Text = Consultantslist.ThisConsultant.LastName;
        //    textBoxDOB.Text = Consultantslist.ThisConsultant.DateOfBirth.ToString();
        //    textBoxAddress.Text = Consultantslist.ThisConsultant.Address;
        //    textBoxEmail.Text = Consultantslist.ThisConsultant.Email;
        //    textBoxTelno.Text = Consultantslist.ThisConsultant.TelephoneNo;
        //    textBoxEmerg.Text = Consultantslist.ThisConsultant.EmergencyContact;
        //    textBoxDate.Text = Consultantslist.ThisConsultant.EmploymentDate.ToString();
        //    textBoxEhist.Text = Consultantslist.ThisConsultant.EmploymentHistory;
        //    textBoxDateAdded.Text = Consultantslist.ThisConsultant.DateAdded.ToString();
        //}
        void UpdateConsultants()
        {
            //create an instance of TNovation
            clsConsultantCollection TNovation = new clsConsultantCollection();
            //validate the data on the webform
            Boolean OK = TNovation.ThisConsultant.Valid(textBoxfirstName.Text, textBoxlastName.Text, textBoxAddress.Text, textBoxEmail.Text, textBoxEhist.Text, textBoxDOB.Text);
            //if the data is OK then add it to the object
            if (OK == true)
            {
                //get the data entered by the user
                TNovation.ThisConsultant.ConsultantNo = Convert.ToInt32(textBoxNo.Text);
                TNovation.ThisConsultant.FirstName = textBoxfirstName.Text;
                TNovation.ThisConsultant.LastName = textBoxlastName.Text;
                TNovation.ThisConsultant.DateOfBirth = Convert.ToDateTime(textBoxDOB.Text);
                TNovation.ThisConsultant.Address = textBoxAddress.Text;
                TNovation.ThisConsultant.Email = textBoxEmail.Text;
                TNovation.ThisConsultant.TelephoneNo = textBoxTelno.Text;
                TNovation.ThisConsultant.EmergencyContact = textBoxEmerg.Text;
                TNovation.ThisConsultant.EmploymentDate = Convert.ToDateTime(textBoxDate.Text);
                TNovation.ThisConsultant.HoursOfWork = Convert.ToInt32(textBoxHours.Text);
                TNovation.ThisConsultant.EmploymentHistory = textBoxEhist.Text;
                TNovation.ThisConsultant.DateAdded = Convert.ToDateTime(textBoxDateAdded.Text);

                //update the record
                TNovation.Update();
            }
            else
            {
                //report an error
                labelErrorUpdate.Text = "The ConsultantNo entered is invalid";
            }
        }
 public void UpdateMethodOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     clsConsultant TestItem = new clsConsultant();
     //var to store the primary key
     Int32 PrimaryKey = 0;
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 118;
     TestItem.FirstName = "James";
     TestItem.LastName = "Junior";
     TestItem.DateOfBirth = DateTime.Now.Date.AddYears(-17);
     TestItem.Address = "Flat C, Basil road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07528789965";
     TestItem.EmergencyContact = "07528789965";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 129;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //set ThisConsultant to the test data
     AllConsultants.ThisConsultant = TestItem;
     //add the record
     PrimaryKey = AllConsultants.AddNew();
     //set the primary key of the test data
     TestItem.ConsultantNo = PrimaryKey;
     //modify the test data
     TestItem.Status = true;
     TestItem.ConsultantNo = 117;
     TestItem.FirstName = "James";
     TestItem.LastName = "Basquiat";
     TestItem.DateOfBirth = DateTime.Now.Date.AddYears(-19);
     TestItem.Address = "Flat C, Basil road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07528789965";
     TestItem.EmergencyContact = "07528789965";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 129;
     TestItem.EmploymentHistory = "None";
     //set ThisConsultant to the test data
     AllConsultants.ThisConsultant = TestItem;
     //update the record
     AllConsultants.Update();
     //find the record
     AllConsultants.ThisConsultant.Find(PrimaryKey);
     //test to see that the record wasn't found
     Assert.AreEqual(AllConsultants.ThisConsultant, TestItem);
 }