private void dgvListInvoice_CellClick(object sender, DataGridViewCellEventArgs e) { int row = e.RowIndex; try { idBill = dgvListInvoice.Rows[row].Cells[1].Value.ToString(); if (e.ColumnIndex == dgvListInvoice.Columns["dgvButtonView"].Index && row >= 0) { FrmDetailImportBill f = new FrmDetailImportBill(idBill); f.ShowDialog(); } } catch { } }
private void dgvListInvoice_CellClick(object sender, DataGridViewCellEventArgs e) { int row = e.RowIndex; try { idBill = dgvListInvoice.Rows[row].Cells[3].Value.ToString(); if (e.ColumnIndex == dgvListInvoice.Columns["dgvButtonView"].Index && row >= 0) { FrmDetailImportBill f = new FrmDetailImportBill(idBill); f.ShowDialog(); } else { if (e.ColumnIndex == dgvListInvoice.Columns["dgvButtonImport"].Index && row >= 0 && ImportInventory_DAO.Instance.CheckIsImportInventoryDone(idBill) == false && ImportInventory_DAO.Instance.CheckUserCreateImportInventory(idBill, FrmLogin.username)) { FrmImportDetailProduct f = new FrmImportDetailProduct(LoadData, idBill); f.ShowDialog(); } else { if (e.ColumnIndex == dgvListInvoice.Columns["gdvButtonDelete"].Index && row >= 0) { if (MessageBox.Show("Bạn có chắc muốn xóa phiếu nhập tồn: " + idBill + " ?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (ImportInventory_DAO.Instance.DeleteImprortBill(idBill)) { MessageBox.Show("Xóa phiếu nhập tồn: " + idBill + " thành công !"); LoadData(); } else { lbNotification.Text = "Lỗi kết nối. Vui lòng thử lại sau !"; i = 5; timer1.Enabled = true; } } } } } } catch //(Exception ex) { //MessageBox.Show(ex.Message); } }