private void dgvDiscount_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) return; if (dgvDiscount.SelectedRows.Count == Constant.CONSTANT_ZERO) return; DataGridViewRow selectedRow = dgvDiscount.SelectedRows[Constant.CONSTANT_ZERO]; string productID = selectedRow.Cells[Constant.OPERATION_INDEX_ONE].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_ONE].Value.ToString(); string productName = selectedRow.Cells[Constant.OPERATION_INDEX_TWO].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_TWO].Value.ToString(); string manufacturerName = selectedRow.Cells[Constant.OPERATION_INDEX_THREE].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_THREE].Value.ToString(); DateTime effectiveDate = (DateTime)selectedRow.Cells[Constant.OPERATION_INDEX_FOUR].Value; string bundleUnit = selectedRow.Cells[Constant.OPERATION_INDEX_FIVE].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_FIVE].Value.ToString(); string freeQuantity = selectedRow.Cells[Constant.OPERATION_INDEX_SIX].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_SIX].Value.ToString(); string discount = selectedRow.Cells[Constant.OPERATION_INDEX_SEVEN].Value == null ? string.Empty : selectedRow.Cells[Constant.OPERATION_INDEX_SEVEN].Value.ToString(); AddEditDiscount addEditDiscountForm = new AddEditDiscount(productID, productName, manufacturerName, effectiveDate, bundleUnit, freeQuantity, discount); addEditDiscountForm.ShowDialog(); }
private void btnAddDiscount_Click(object sender, EventArgs e) { AddEditDiscount addEditDiscountForm = new AddEditDiscount((DataTable)productBindingSource.DataSource, (DataTable)discountBindingSource.DataSource); addEditDiscountForm.ShowDialog(); }