コード例 #1
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void ReportByEmailTestDataFound()
        {
            StaffingCollection fStaffingCollection = new StaffingCollection();
            //var to store the outcomes
            Boolean OK = true;

            fStaffingCollection.ReportByEmail("yyy yyy");

            if (fStaffingCollection.Count == 2)
            {
                //check that the first record ID is 31
                if (fStaffingCollection.StaffList[0].staffID != 54)
                {
                    OK = false;
                }
                //check that the second record ID is 34
                if (fStaffingCollection.StaffList[1].staffID != 55)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are nbo records
            Assert.IsTrue(OK);
        }
コード例 #2
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void AddMethodOK()
        {
            //Create an instance of the collections class
            StaffingCollection aStaffCollection = new StaffingCollection();
            //create an instance of test data
            Staffing TestItem = new Staffing();
            //Primary key storage
            Int32 primaryKey = 0;

            //Initiate properties of test data
            TestItem.staffName   = new Name("Thomas", "Barnes");
            TestItem.staffNumber = "01706844505";
            TestItem.staffEmail  = "*****@*****.**";
            TestItem.staffDOB    = Convert.ToDateTime("08/09/1990");
            TestItem.staffValid  = true;
            //Set test data into collections
            aStaffCollection.ThisStaff = TestItem;
            //Add the record
            primaryKey = aStaffCollection.Add();
            //Set the primary key of the test data
            TestItem.staffID = primaryKey;
            //Find the record
            aStaffCollection.ThisStaff.Find(primaryKey);
            //Test to see that the two values are the same
            Assert.AreEqual(aStaffCollection.ThisStaff, TestItem);
        }
コード例 #3
0
        public void InstanceOK()
        {
            StaffingCollection AllStaff = new StaffingCollection();

            //test to see if it exists
            Assert.IsNotNull(AllStaff);
        }
コード例 #4
0
    protected void btnY_Click(object sender, EventArgs e)
    {
        StaffingCollection aStaffingCollection = new StaffingCollection();

        aStaffingCollection.ThisStaff.Find(StaffID);
        aStaffingCollection.Delete();
        Response.Redirect("Staffing_List.aspx");
    }
コード例 #5
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void ReportByEmailNoneFound()
        {
            StaffingCollection allStaff = new StaffingCollection();

            StaffingCollection filteredStaff = new StaffingCollection();

            //Apply an email that doesn't exist
            filteredStaff.ReportByEmail("xxx xxx");

            Assert.AreEqual(0, filteredStaff.Count);
        }
コード例 #6
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void ReportByEmailMethodOK()
        {
            StaffingCollection allStaff = new StaffingCollection();

            StaffingCollection filteredStaff = new StaffingCollection();

            //Apply an email that doesn't exist
            filteredStaff.ReportByEmail("");

            Assert.AreEqual(allStaff.Count, filteredStaff.Count);
        }
コード例 #7
0
    void DisplayAddress()
    {
        StaffingCollection staffingCollection = new StaffingCollection();

        staffingCollection.ThisStaff.Find(StaffID);
        //display the data
        txtFirstName.Text  = staffingCollection.ThisStaff.staffName.getFirstName();
        txtLastName.Text   = staffingCollection.ThisStaff.staffName.getLastName();
        txtEmail.Text      = staffingCollection.ThisStaff.staffEmail;
        txtNumber.Text     = staffingCollection.ThisStaff.staffNumber;
        txtDOB.Text        = staffingCollection.ThisStaff.staffDOB.ToString();
        StaffValid.Checked = staffingCollection.ThisStaff.staffValid;
    }
コード例 #8
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        StaffingCollection Staff = new StaffingCollection();

        Staff.ReportByEmail(txtEmailFilter.Text);
        lstStaffingList.DataSource = Staff.StaffList;

        //Set the name of the primary key
        lstStaffingList.DataValueField = "StaffID";
        //set the name of the field to display
        lstStaffingList.DataValueField = "StaffEmail";
        //bind the data to the list
        lstStaffingList.DataBind();
    }
コード例 #9
0
    void DisplayStaff()
    {
        //Create an instance of the Staff Collection
        StaffingCollection staffingCollection = new StaffingCollection();

        //Set the data source to the list of staff in the collection
        lstStaffingList.DataSource = staffingCollection.StaffList;
        //Set the name of te primary key
        lstStaffingList.DataValueField = "StaffID";
        //set the data field to display
        lstStaffingList.DataTextField = "StaffEmail";
        //bind the data to the list
        lstStaffingList.DataBind();
    }
コード例 #10
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        //Create a new instance of staff
        Staffing staff = new Staffing();
        //String to store any error messages
        String Error = "";

        //Validate the data
        Error = staff.Valid(txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtNumber.Text, txtDOB.Text);
        if (Error == "")
        {
            //capture the staff ID
            staff.staffID = StaffID;
            //Capture the Staff name
            staff.staffName = new Name(txtFirstName.Text, txtLastName.Text);
            //Capture the email
            staff.staffEmail = txtEmail.Text;
            //Capture the staff
            staff.staffNumber = txtNumber.Text;
            //Capture the staff DOB
            staff.staffDOB = Convert.ToDateTime(txtDOB.Text);
            //Capture the staff Validity
            staff.staffValid = StaffValid.Checked;
            //Create a new instance of the staffing collection
            StaffingCollection staffList = new StaffingCollection();

            if (StaffID == -1)
            {
                staffList.ThisStaff = staff;
                staffList.Add();
            }
            else
            {
                staffList.ThisStaff.Find(StaffID);
                staffList.ThisStaff = staff;
                staffList.Update();
            }
            //redirect to the aTutor page
            Response.Redirect("Staffing_List.aspx");
        }
        else
        {
            txtError.Visible = true;
            //display the error message
            txtError.Text = "Error! " + Error;
        }
    }
コード例 #11
0
        public void ThisStaffOK()
        {
            //Create an instance of StaffingCollection
            StaffingCollection AllStaff = new StaffingCollection();
            //Create some test data to assign to the object
            Staffing AStaff = new Staffing();

            //Set the staffs properties
            AStaff.staffName   = new Name("Code", "Orange");
            AStaff.staffID     = 11;
            AStaff.staffEmail  = "*****@*****.**";
            AStaff.staffDOB    = Convert.ToDateTime("08/09/1999");
            AStaff.staffNumber = "016189333";
            //Assign the test data to the StaffingCollection property
            AllStaff.ThisStaff = AStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, AStaff);
        }
コード例 #12
0
        public void ListAndCountOK()
        {
            //Create an instance of StaffingCollection
            StaffingCollection AllStaff = new StaffingCollection();
            //Create some test data to assign to the object in this case the data needs to be a list of Staff
            List <Staffing> TestList = new List <Staffing>();
            //Add a staff to the list
            Staffing AStaff = new Staffing();

            //Set the staffs properties
            AStaff.staffName   = new Name("Code", "Orange");
            AStaff.staffID     = 11;
            AStaff.staffEmail  = "*****@*****.**";
            AStaff.staffDOB    = Convert.ToDateTime("08/09/1999");
            AStaff.staffNumber = "016189333";
            //Add the staff to the list
            TestList.Add(AStaff);
            //Assign the list to the StaffingCollection
            AllStaff.StaffList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.Count, TestList.Count);
        }