void Add()
 {
     //create an instance of TNovation
     clsConsultantCollection TNovation = new clsConsultantCollection();
     //this line of code validates 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);
         //add the new entry
         TNovation.AddNew();
     }
 }
 public void ConsultantListOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     //create some test data to assign to the property
     //in this case the data needs to be a list of objects
     List<clsConsultant> TestList = new List<clsConsultant>();
     //add an item to the list
     //create the item of the test data
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "John";
     TestItem.LastName = "Wayne";
     TestItem.DateOfBirth = DateTime.Now.Date;
     TestItem.Address = "Flat BC, 2 Cilantro Road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 172;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data to the property
     AllConsultants.ConsultantList = TestList;
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ConsultantList, TestList);
 }
        //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 AddMethodOK()
 {
     //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 = 120;
     TestItem.FirstName = "James";
     TestItem.LastName = "Junior";
     TestItem.DateOfBirth = DateTime.Now.Date.AddYears(-17);
     TestItem.Address = "Flat C, Colly road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     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;
     //find the record
     AllConsultants.ThisConsultant.Find(PrimaryKey);
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ThisConsultant, TestItem);
 }
 public void AllConsultantsOK()
 {
     //Create an instance of the class we want to create
     clsConsultantCollection Consultants = new clsConsultantCollection();
     //create some test data to assign to the property
     //in this case the data needs to be a list of objects
     List<clsConsultant> TestList = new List<clsConsultant>();
     //add an item to the list
     //create an item of test data
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "James";
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data to the property
     Consultants.AllConsultants = TestList;
     //test to see that the two values are the same
     Assert.AreEqual(Consultants.AllConsultants, TestList);
 }
        void DeleteConsultant()
        {
            //function to delete the selected record

            //create a new instance of the Consultant book
            clsConsultantCollection TNovation = new clsConsultantCollection();
            //find the record to delete
            TNovation.ThisConsultant.Find(ConsultantNo);
            //delete the record
            TNovation.Delete();
        }
 Int32 DisplayConsultants()
 {
     //create an instance of the Consultant collection class
     clsConsultantCollection Consultants = new clsConsultantCollection();
     //see the data source to the list of Consultants in the collection
     listBoxConsultant.DataSource = Consultants.ConsultantList;
     //set the name of the primary key value
     listBoxConsultant.ValueMember = "ConsultantNo";
     //set the data field to be displayed
     listBoxConsultant.DisplayMember = "FirstName";
     //return the count of records in the list
     return Consultants.Count;
 }
 public void ThisConsultantPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "John";
     TestItem.LastName = "Wayne";
     TestItem.DateOfBirth = DateTime.Now.Date;
     TestItem.Address = "Flat BC, 2 Cilantro Road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 172;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //assign the data to the property
     AllConsultants.ThisConsultant = TestItem;
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ThisConsultant, TestItem);
 }
 public void InstanceOK()
 {
     //Create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     //test to see that it exists
     Assert.IsNotNull(AllConsultants);
 }
 public void DeleteMethodOK()
 {
     //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 = 119;
     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;
     //find the record
     AllConsultants.ThisConsultant.Find(PrimaryKey);
     //delete the record
     AllConsultants.Delete();
     //now find the record
     Boolean Found = AllConsultants.ThisConsultant.Find(PrimaryKey);
     //test to see that the record wasn't found
     Assert.IsFalse(Found);
 }