void Add()
 {
     //create an instance of TNovation
     clsProjectCollection TNovation = new clsProjectCollection();
     //validate the data on the webform
     Boolean OK = TNovation.ThisProject.Valid(textBoxProjectName.Text, textBoxCompanyName.Text, textBoxProjectConsultant.Text, textBoxCompanyContact.Text, textBoxExpectedEndDate.Text, textBoxStartDate.Text, textBoxProjectLocation.Text);
     //if the data is OK then add it to the object
     if (OK == true)
     {
         //get the data entered by the user
         TNovation.ThisProject.ProjectCode = Convert.ToInt32(textBoxProjectCode.Text);
         TNovation.ThisProject.ProjectName = textBoxProjectName.Text;
         TNovation.ThisProject.CompanyName = textBoxCompanyName.Text;
         TNovation.ThisProject.ProjectConsultant = textBoxProjectConsultant.Text;
         TNovation.ThisProject.CompanyContact = textBoxCompanyContact.Text;
         TNovation.ThisProject.ExpectedEndDate = Convert.ToDateTime(textBoxExpectedEndDate.Text);
         TNovation.ThisProject.StartDate = Convert.ToDateTime(textBoxStartDate.Text);
         TNovation.ThisProject.ProjectLocation = textBoxProjectLocation.Text;
         //add the record
         TNovation.Add();
     }
     else
     {
         //report an error
         lblError.Text = "There were problems with the data entered";
     }
 }
 void UpdateProjectConfirm()
 {
     //create an instance of TNovation
     clsProjectCollection TNovation = new clsProjectCollection();
     //validate the data on the webform
     Boolean OK = TNovation.ThisProject.Valid(textBoxProjectName.Text, textBoxCompanyName.Text, textBoxProjectConsultant.Text, textBoxCompanyContact.Text, textBoxExpectedEndDate.Text, textBoxStartDate.Text, textBoxProjectLocation.Text);
     //if the data is OK then add it to the object
     if (OK == true)
     {
         //find the record to update
         //TNovation.ThisProject.Find(ProjectCode);
         //get the data entered by the user
         TNovation.ThisProject.ProjectCode = Convert.ToInt32(textBoxProjectCode.Text);
         TNovation.ThisProject.ProjectName = textBoxProjectName.Text;
         TNovation.ThisProject.CompanyName = textBoxCompanyName.Text;
         TNovation.ThisProject.ProjectConsultant = textBoxProjectConsultant.Text;
         TNovation.ThisProject.CompanyContact = textBoxCompanyContact.Text;
         TNovation.ThisProject.ExpectedEndDate = Convert.ToDateTime(textBoxExpectedEndDate.Text);
         TNovation.ThisProject.StartDate = Convert.ToDateTime(textBoxStartDate.Text);
         TNovation.ThisProject.ProjectLocation = textBoxProjectLocation.Text;
         //update the record
         TNovation.Update();
     }
     else
     {
         //report an error
         labelUpdateError.Text = "The ProjectCode entered does not exist. Return to Project List box to find the ProjectCode to update.";
     }
 }
 public void InstanceOKCollection()
 {
     //create an instance of the class we want to create
     clsProjectCollection ProjectList = new clsProjectCollection();
     //test to see that it exists
     Assert.IsNotNull(ProjectList);
 }
Beispiel #4
0
        public void ListAndCount()
        {
            //create an instance of the class we want to create
            clsProjectCollection AllProjects = new clsProjectCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsProject> TestList = new List <clsProject>();
            //add an item to the list
            //create the item of test data
            clsProject TestItem = new clsProject();

            //set its properties
            TestItem.AppointmentID           = 11;
            TestItem.AProjectDescription     = "project";
            TestItem.AProjectID              = 2;
            TestItem.ClientID                = 13;
            TestItem.EstimatedCompletionDate = DateTime.Now.Date;
            TestItem.ProjectName             = "ProjectName";
            TestItem.StaffID = 15;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllProjects.ListNames = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllProjects.Count, TestList.Count);
        }
Beispiel #5
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsProjectCollection AllProjects = new clsProjectCollection();

            //test to see that it exists
            Assert.IsNotNull(AllProjects);
        }
 public void CountProperty()
 {
     //create an instance of the class we want to create
     clsProjectCollection ProjectList = new clsProjectCollection();
     //create some test dat to ssign to the property
     Int32 SomeCount = 1;
     //assign the data to the property
     ProjectList.Count = SomeCount;
     //test to see that the two values are the same
     Assert.AreEqual(ProjectList.Count, SomeCount);
 }
Beispiel #7
0
        public void CountProperty()
        {
            //create an instance of the class we want to create
            clsProjectCollection AllProjects = new clsProjectCollection();
            //create some test data to assign to the property
            Int32 SomeCount = 0;

            //assign the data to the property
            AllProjects.Count = SomeCount;
            //test to see that the two values are the same
            Assert.AreEqual(AllProjects.Count, SomeCount);
        }
 public void ProjectListOK()
 {
     //create an instance of the class we want to create
     clsProjectCollection Projects = new clsProjectCollection();
     //create some test data to assign to the property
     //in this case data needs to be a list of objects
     List<clsProject> TestList = new List<clsProject>();
     //add an item to the list
     //create item to test the data
     clsProject TestItem = new clsProject();
     //set its properties
     TestItem.ProjectCode = 1;
     TestItem.ProjectName = "London";
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data to the property
     Projects.ProjectList = TestList;
     //test to see that the two values are the same
     Assert.AreEqual(Projects.ProjectList, TestList);
 }
Beispiel #9
0
        public void ThisProjectPropertyOK()
        {
            //create an instance of the class we want to create
            clsProjectCollection AllProjects = new clsProjectCollection();
            //create some test data to assign to the property
            clsProject TestProject = new clsProject();

            //set the properties of the test object
            TestProject.AppointmentID           = 11;
            TestProject.AProjectDescription     = "project";
            TestProject.AProjectID              = 2;
            TestProject.EstimatedCompletionDate = DateTime.Now.Date;
            TestProject.ClientID    = 13;
            TestProject.StaffID     = 15;
            TestProject.ProjectName = "Website Creation";
            //assign the data to the property
            AllProjects.ThisProject = TestProject;
            //test to see that the two values are the same
            Assert.AreEqual(AllProjects.ThisProject, TestProject);
        }