// Ian Bell - 10/13/2012
    // Recieves dictionary with branchNo value.
    // Checks:
    // 1. branchNo isn't empty
    // 2. branchNo doesn't exceed db field length
    // 3. branchNo exists in db
    // 4. deleting branchNo won't violate foriegn key constraints
    // 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 deleteBranch(Dictionary<String, String> branchNo)
    {
        DataSet ds = generateErrorDataSet();
        String errorMessage = "";

        try
        {
            DataTier dt = new DataTier();

            if (branchNo["branchNo"].Length > 0) // ensure that a value was passed
            {
                if(branchNo["branchNo"].Length > 4)
                    errorMessage = "The maximum length of a Staff Number is 4 characters";

                else if (dt.branchExists(branchNo).Tables[1].Rows[0][0].ToString() != "True")
                    errorMessage = "No Branch with that Branch Number exists.";

                else if (dt.branchNumberConstraintExists(branchNo).Tables[1].Rows[0][0].ToString() == "True")
                    errorMessage = "You can't delete that Branch while there are Staff and/or Properties for Rent assigned to it.";
            }
            else
                errorMessage = "You must enter a Branch Number.";

            if (errorMessage.Length == 0)
                dt.deleteBranch(branchNo);

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

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

            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 branch information values.
    // Checks:
    // 1. branch info doesn't exceed db field lengths
    // 2. branchNo isn't empty
    // 3. branchNo exists in db
    // 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 updateBranch(Dictionary<String, String> updateBranchInfo)
    {
        DataSet ds = generateErrorDataSet();
        String errorMessage = "";

        try
        {
            DataTier dt = new DataTier();

            errorMessage = checkBranchFieldLengths(updateBranchInfo);

            if (errorMessage.Length == 0)// they entered a branchNo that doesn't exceed the field length
            {
                if (updateBranchInfo["branchNo"].Length > 0) // they entered a branchNo that doesn't exceed the field length
                {
                    if (dt.branchExists(updateBranchInfo).Tables[1].Rows[0][0].ToString() != "True")
                        errorMessage = "No Branch with that Branch Number exists.";
                }
                else
                    errorMessage = "You must enter a Branch Number.";
            }

            if (errorMessage.Length == 0)
                ds = dt.updateBranch(updateBranchInfo);

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

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

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

        return ds;
    }