private void btnDeleteSsales_Click(object sender, RoutedEventArgs e) { try { DataRowView rowview = dgCurrentSales.SelectedItem as DataRowView; string salesId = rowview.Row["Id"].ToString(); DataTable dt = CustomerBLL.getCustomerBySales(salesId); if (dt.Rows.Count == 0) { SalesBLL.updateSalesIsEnable(salesId, "0"); SetCurrentSales(); } else { System.Windows.Forms.MessageBox.Show("該業務尚有客戶,請先轉移客戶至其他業務人員", "Message"); } } catch { System.Windows.Forms.MessageBox.Show("請先選擇要刪除的業務人員", "Message"); } }