private void SearchByNameBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(CheckInCheckOutSearchTbx.Text)) { MessageBox.Show("请填写姓名!"); } else { try { searchbyRooms = false; CheckInCheckOutDataGrid.ItemsSource = facade.GetActiveBookingsViaName(CheckInCheckOutSearchTbx.Text); if (CheckInCheckOutDataGrid.Items.Count == 0) { MessageBox.Show("找不到联系人或订单"); } } catch (Exception) { MessageBox.Show("格式不正确!"); } } }