示例#1
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (dgvHangHoa.SelectedItem != null)
     {
         DTO_HangHoa obj = new DTO_HangHoa();
         obj = dgvHangHoa.SelectedItem as DTO_HangHoa;
         if (obj.TrangThai == true)
         {
             MessageBoxResult result = MessageBox.Show("Bạn muốn ngừng kinh doanh mặt hàng này?", "Confirmation", MessageBoxButton.YesNo);
             if (result == MessageBoxResult.Yes)
             {
                 BUS_HangHoa.Delete(obj);
                 dgvHangHoa.ItemsSource = BUS_HangHoa.showData();
             }
         }
         else
         {
             BUS_HangHoa.Delete(obj);
             dgvHangHoa.ItemsSource = BUS_HangHoa.showData();
         }
     }
 }