Example #1
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        ClsEmployee AnEmployee = new ClsEmployee();
        Int32       emp_ID;
        Boolean     Found = false;

        if (txtemp_ID.Text != "")
        {
            emp_ID = Convert.ToInt32(txtemp_ID.Text);
            Found  = AnEmployee.Find(emp_ID);
        }
        else
        {
            lblError.Text = "Please enter a employee ID";
        }

        if (Found == true)
        {
            lblError.Text      = "";
            txtemp_Name.Text   = AnEmployee.Emp_Name;
            txtjob_Name.Text   = AnEmployee.Job_Name;
            txtmanager_ID.Text = AnEmployee.Manager_ID.ToString();
            txthire_Date.Text  = AnEmployee.Hire_Date.ToString();
            txtsalary.Text     = AnEmployee.Salary.ToString();
            txtdep_ID.Text     = AnEmployee.Dep_ID.ToString();
            chkActive.Checked  = AnEmployee.Active;
        }
    }
Example #2
0
        public void FindMethodOK()
        {
            //creates an instance
            ClsEmployee AnEmployee = new ClsEmployee();
            //boolean variable to store the result
            Boolean Found = false;
            //test data
            int emp_ID = 38;

            //invoke the method
            Found = AnEmployee.Find(emp_ID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Example #3
0
        public void TestActiveFound()
        {
            //create an instance
            ClsEmployee AnEmployee = new ClsEmployee();
            //bool variable to store the result of the search
            Boolean Found = false;
            //bool variable to record if the data is OK
            Boolean OK = true;
            //test data
            int emp_ID = 21;

            //invoke the method
            Found = AnEmployee.Find(emp_ID);
            //check the employee ID
            if (AnEmployee.Active != false)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }