// Ian Bell - 10/13/2012
    // Recieves dictionary with staff information values.
    // Checks:
    // 1. Staff info fields don't exceed db lengths
    // 2. staffNo isn't empty.
    // 3. staffNo exists.
    // 4. salary is > $8,000 but < $100,000
    // 5. DOB indicates staff is > 18 years old
    // 6. If position == manager, that the branch doesn't already have a manager
    // Passes staff info to data tier if it passes all tests
    // returns table with appropriate error message if staff info fails any test
    public DataSet updateStaff(Dictionary<String, String> updateStaffInfo)
    {
        DataSet ds = generateErrorDataSet();
        String errorMessage = "";
        String tempMessage = "";

        try
        {
            DataTier dt = new DataTier();

            errorMessage = checkStaffFieldLengths(updateStaffInfo);

            // make sure staffNo doesn't exist
            if (errorMessage.Length == 0)// ensure staffNo doesn't exceed the field length
            {
                if (updateStaffInfo["staffNo"].Length > 0)
                {
                    if (dt.staffExists(updateStaffInfo).Tables[1].Rows[0][0].ToString() != "True")
                        errorMessage = "No Staff with that Staff Number exists.";
                }
                else
                    errorMessage = "You must enter a Staff Number.";
            }

            // make sure salary is within range
            tempMessage = checkStaffSalary(updateStaffInfo["salary"]);
            if(tempMessage.Length > 0)
                errorMessage = tempMessage;

            // make sure DOB is > than today - 18 years
            tempMessage = checkStaffDOB(updateStaffInfo["DOB"]);
            if (tempMessage.Length > 0)
                errorMessage = tempMessage;

            // if position == manager, make sure that branchNo doesn't have a manager
            if (updateStaffInfo["position"] == "Manager")
                if (updateStaffInfo["branchNo"].Length > 0)        // if they entered a branchNo
                    if (dt.managerExists(updateStaffInfo).Tables[0].Rows[0][0].ToString() == "True")
                        errorMessage = "This Staff can't be a manager because that Branch already has a manager.";

            if (errorMessage.Length == 0)
                dt.updateStaff(updateStaffInfo);

            if (errorMessage.Length > 0)
                ds.Tables[0].Rows.Add(errorMessage);
        }

        catch (Exception ex)
        {
            logError(ex, "BusinessTier", "updateStaff");

            errorMessage = "We've encountered an unexpected difficulty. Please try again later or contact your administrator";
            ds.Tables[0].Rows.Add(errorMessage);
        }
        return ds;
    }
    // Ian Bell - 10/13/2012
    // Recieves dictionary with staffNo value.
    // Checks:
    // 1. The value isn't empty.
    // 2. That the staffNo exists.
    // 3. No foreign key constraints.
    // Passes staffNo to data tier if it passes all tests
    // returns table with appropriate error message if staffNo fails any test
    public DataSet deleteStaff(Dictionary<String, String> staffNo)
    {
        DataSet ds = generateErrorDataSet();
        String errorMessage = "";

        try
        {
            DataTier dt = new DataTier();

            if (staffNo["staffNo"].Length > 0)
            {
                if (staffNo["staffNo"].Length > 4)
                    errorMessage = "The maximum Staff Number is 4 characters.";

                else if (dt.staffExists(staffNo).Tables[1].Rows[0][0].ToString() != "True")
                    errorMessage = "No Staff with that Staff Number exist.";

                else if (dt.staffNumberConstraintExists(staffNo).Tables[1].Rows[0][0].ToString() == "True")
                    errorMessage = "You can't delete that Staff because they are listed under a Property for Rent.";
            }
            else
                errorMessage = "You must enter a Staff Number.";

            if (errorMessage.Length == 0)
                dt.deleteStaff(staffNo);

            if (errorMessage.Length > 0)
                ds.Tables[0].Rows.Add(errorMessage);
        }

        catch (Exception ex)
        {
            logError(ex, "BusinessTier", "deleteStaff");

            errorMessage = "We've encountered an unexpected difficulty. Please try again later or contact your administrator";
            ds.Tables[0].Rows.Add(errorMessage);
        }
        return ds;
    }