private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView2.CurrentRow != null) { if (e.ColumnIndex == 4) { invoice = new Invoice(); int selectedInvId = Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value); int selectedItemID = Convert.ToInt32(dataGridView2.CurrentRow.Cells[5].Value); int selectedQty = Convert.ToInt32(dataGridView2.CurrentRow.Cells[3].Value); isChecked = (bool)dataGridView2.CurrentRow.Cells[4].Value; if (isChecked == false) { invoice.updateInvoice(selectedInvId, selectedItemID, 1); gin = new GoodIssueNote(); gin.addGINTemp(txtGINID.Text, selectedItemID, selectedQty, selectedInvId); dt3 = gin.getGINTemp(); dataGridView3.DataSource = dt3; } else { invoice.updateInvoice(selectedInvId, selectedItemID, 0); gin = new GoodIssueNote(); gin.updateGINTemp(selectedItemID); dt3 = gin.getGINTemp(); MessageBox.Show("updated as not Issued!"); dataGridView3.DataSource = dt3; } } } }
private void btnGenerateGIN_Click(object sender, EventArgs e) { gin = new GoodIssueNote(); dt = gin.getGINTemp(); if (dt.Rows.Count > 0) { gin.Customer = txtCustomer.Text; gin.Date = DateTime.Today.ToShortDateString(); gin.ginID = txtGINID.Text; gin.addGIN(); MessageBox.Show("GIN Added Successfully!"); this.Close(); } else { MessageBox.Show("No items selected!"); } }