예제 #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     grdvListCustomer.FocusedRowHandle -= 1;
     foreach (DataRowView _rowData in m_CustomerMultiSelect.Selection)
     {
         m_CustomerObject             = new CCustomerDTO();
         m_CustomerObject.maKhachHang = _rowData["MaKH"].ToString();
         m_CustomerExecute.DeleteCustomerToDatabase(m_CustomerObject);
     }
     m_CustomerData             = m_CustomerExecute.getCustomerDataFromDatabase();
     grdListCustomer.DataSource = m_CustomerData;
 }
예제 #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ArrayList _listCustomerId = new ArrayList();
         grdvListCustomer.FocusedRowHandle -= 1;
         foreach (DataRowView _rowData in m_CustomerMultiSelect.Selection)
         {
             m_CustomerObject             = new CCustomerDTO();
             m_CustomerObject.maKhachHang = _rowData["MaKH"].ToString();
             if (m_CustomerExecute.DeleteCustomerToDatabase(m_CustomerObject))
             {
                 _listCustomerId.Add(_rowData["MaKH"]);
             }
         }
         if (_listCustomerId.Count != 0)
         {
             String _erroContent = "Không thể xóa các khách hàng có mã: \n";
             foreach (var item in _listCustomerId)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại!", "Lỗi", true);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }