//Search the Offices private void OfficeSearch() { lbxOfficeName.ItemsSource = null; LabelForegroundToBlack(); GetOffice go = new GetOffice(); List<OFFICE> offices = null; if (!string.IsNullOrEmpty(txtSONameSearch.Text)) { if (rdbSOSearchByUnit.IsChecked == true) { offices = go.GetOfficesByUnitName(txtSONameSearch.Text); } else { offices = go.GetOfficesByName(txtSONameSearch.Text); } if (offices != null) ShowOfficeNameToListBox(offices); } }
//Change background and foreground color when mouse double click the label private void MouseDoubleClicked(object sender) { LabelForegroundToBlack(); ((Label)sender).Background = Brushes.Yellow; ((Label)sender).Foreground = Brushes.Red; lbxOfficeName.ItemsSource = null; GetOffice go = new GetOffice(); List<OFFICE> offices = null; if (((Label)sender).Content.ToString() != "#") offices = go.GetOfficesByName(((Label)sender).Content.ToString()); else offices = go.GetAllOfOffices(); if (offices != null) { ShowOfficeNameToListBox(offices); } }