protected void btnFind_Click(object sender, EventArgs e)
    {
        //creates new instance of staff class
        clsStaff StaffMember = new clsStaff();

        if (StaffMember.ValidStaffNumber(txtStaffNumber.Text) != "") //checks to see whether staff number is in correct format.
        {
            lblStaffNumberError.Text = StaffMember.ValidStaffNumber(txtStaffNumber.Text);
        }
        else //runs this bit if the format is correct
        {
            int     StaffNumber;
            Boolean Found = false;
            StaffNumber = Convert.ToInt32(txtStaffNumber.Text);
            Found       = StaffMember.Find(StaffNumber);

            if (Found)
            {
                //fill in the rest of the slots
                txtFirstName.Text    = StaffMember.FirstName;
                txtLastName.Text     = StaffMember.LastName;
                txtHourlyRate.Text   = StaffMember.HourlyRate.ToString();
                txtPhoneNumber.Text  = StaffMember.PhoneNumber;
                txtStartDate.Text    = StaffMember.StartDate.ToString();
                chkIsManager.Checked = StaffMember.IsManager;
            }
        }
    }
Beispiel #2
0
        public void StaffNumberValidInvalid()
        {
            clsStaff staffMemeber = new clsStaff();
            string   StaffNum     = "number";
            string   Error        = "";

            Error = staffMemeber.ValidStaffNumber(StaffNum);
            Assert.AreNotEqual(Error, ""); //should error
        }
Beispiel #3
0
        public void StaffNumberValidMaxPlusOne()
        {
            clsStaff staffMemeber = new clsStaff();
            string   StaffNum     = "100000";
            string   Error        = "";

            Error = staffMemeber.ValidStaffNumber(StaffNum);
            Assert.AreNotEqual(Error, ""); //should error
        }