/// <summary> /// Gets the info for a particular branch /// AC 10/15/2012 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBranchLookup_Click(object sender, EventArgs e) { try { BusinessTier branchBT = new BusinessTier(); Dictionary<String, String> branchInfo = new Dictionary<string, string>(); branchInfo.Add("branchID", txtBranchID.Text); // expects a dataset with two tables: error table and a results table DataSet branchDS = branchBT.getBranch(branchInfo); pnlBranch.Visible = false; pnlStaff.Visible = false; // first table in the dataset is the error table // the second table is the results table // accesses the results if the error table is empty if (branchDS.Tables[0].Rows.Count == 0 && branchDS.Tables[1].Rows.Count > 0) { lblBranchError.Text = ""; lblBranchID.Text = branchDS.Tables[1].Rows[0][0].ToString(); lblBranchStreet.Text = branchDS.Tables[1].Rows[0][1].ToString(); lblBranchCity.Text = branchDS.Tables[1].Rows[0][2].ToString(); lblBranchPostalCode.Text = branchDS.Tables[1].Rows[0][3].ToString(); pnlBranch.Visible = true; } else if (branchDS.Tables[0].Rows.Count > 0) { lblBranchID.Text = ""; lblBranchStreet.Text = ""; lblBranchCity.Text = ""; lblBranchPostalCode.Text = ""; lblBranchError.Text = branchDS.Tables[0].Rows[0][0].ToString(); } else { lblBranchID.Text = ""; lblBranchStreet.Text = ""; lblBranchCity.Text = ""; lblBranchPostalCode.Text = ""; lblBranchError.Text = "*Branch not found!"; } } catch (Exception ex) { lblBranchError.Text = "A minor error occured. Please contact an Administrator."; BusinessTier.logError(ex, ex.Source.ToString(), ex.TargetSite.ToString()); } }