private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 8 && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete Customer " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String customercode = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table("tbcustomer", "custcode", customercode); dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index); } } if (e.ColumnIndex == 7 && e.RowIndex >= 0) { txtcustcode.Text = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); List <object[]> datacustomer; MainMenu frm = new MainMenu(); datacustomer = frm.get_data_table_string("tbcustomer", "custcode", txtcustcode.Text.Trim()); txtcustname.Text = this.dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); txtphone.Text = this.dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); txtstate.Text = this.dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); cbcountry.Text = this.dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString(); txtcertificate.Text = this.dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString(); txtaddress.Text = datacustomer[0][3].ToString(); txtcontactperson.Text = datacustomer[0][5].ToString(); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == 4 && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete incoterms " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String incoterms = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table("tbincoterms", "incoterms", incoterms); dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index); } } if (e.ColumnIndex == 3 && e.RowIndex >= 0) { txtincoterms.Text = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); txtdescription.Text = this.dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Int32 n = e.RowIndex; MainMenu frm = new MainMenu(); frm.delete_table("tbproductsetup", "productname", this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString()); loaddataproductgrid(); } } if (e.ColumnIndex == dataGridView1.Columns["Edit"].Index && e.RowIndex >= 0 && dataGridView1.Rows.Count > 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to Edit " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + " " + this.dataGridView1.Rows[e.RowIndex].Cells[2].Value + " " + this.dataGridView1.Rows[e.RowIndex].Cells[3].Value + " ?", "Edit", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { panel1.Visible = true; Int32 n = e.RowIndex; Int32 id = 0; MainMenu frm = new MainMenu(); String product = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string("tbproductsetup", "productname", product); for (int i = 0; i <= n; i++) { if (i == n) { id = Int32.Parse(data[0][0].ToString()); } } lblid.Text = id.ToString(); cbstate.Text = data[0][1].ToString(); cbtipe.Text = data[0][2].ToString(); cbtradeunit.Text = data[0][3].ToString(); cbspecies.Text = data[0][4].ToString(); txtproduct.Text = data[0][5].ToString(); txthscode.Text = data[0][6].ToString(); txtnetweight.Text = data[0][7].ToString(); txtlower.Text = data[0][8].ToString(); txtupper.Text = data[0][9].ToString(); } } }
private void dgProductCodeSAP_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgProductCodeSAP.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dgProductCodeSAP.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dgProductCodeSAP.Rows[e.RowIndex].Cells[5].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Int32 n = e.RowIndex; Int32 id = 0; MainMenu frm = new MainMenu(); frm.delete_table("tbproductsetup_sapcode", "itemcodesap", this.dgProductCodeSAP.Rows[e.RowIndex].Cells[5].Value.ToString()); loaddataproductgrid(); } } if (e.ColumnIndex == dgProductCodeSAP.Columns["Edit"].Index && e.RowIndex >= 0 && dgProductCodeSAP.Rows.Count > 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to Edit Code " + this.dgProductCodeSAP.Rows[e.RowIndex].Cells[5].Value + " ?", "Edit", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Int32 n = e.RowIndex; Int32 id = 0; MainMenu frm = new MainMenu(); String itemcode = this.dgProductCodeSAP.Rows[e.RowIndex].Cells[5].Value.ToString(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string("tbproductsetup_sapcode", "itemcodesap", itemcode); if (data.Count > 0) { cbproduct.Text = data[0][1].ToString(); cbgrade.Text = data[0][2].ToString(); cbsize.Text = data[0][3].ToString(); cbcertificate.Text = data[0][4].ToString(); txtSAPItemCode.Text = data[0][5].ToString(); } } } }
private void dgprocessingcompany_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgprocessingcompany.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dgprocessingcompany.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dgprocessingcompany.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String cocode = this.dgprocessingcompany.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table("tbprocessingcompany", "co_code", cocode); dgprocessingcompany.Rows.RemoveAt(dgprocessingcompany.SelectedRows[0].Index); loaddataprocessingcompany(); } } if (e.ColumnIndex == dgprocessingcompany.Columns["Edit"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to Edit " + this.dgprocessingcompany.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { MainMenu frm = new MainMenu(); String cocode = this.dgprocessingcompany.Rows[e.RowIndex].Cells[1].Value.ToString(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string("tbprocessingcompany", "co_code", cocode); if (data.Count > 0) { txtcocode.Text = cocode; txtcompanyname.Text = data[0][1].ToString(); txtaddress.Text = data[0][2].ToString(); txtphone.Text = data[0][3].ToString(); } } } }
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5 && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete payterms " + this.dataGridView2.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String payterms = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table("tbpayterms", "payterms", payterms); dataGridView2.Rows.RemoveAt(dataGridView2.SelectedRows[0].Index); } } if (e.ColumnIndex == 4 && e.RowIndex >= 0) { txtpayterms.Text = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); txtdescription1.Text = this.dataGridView2.Rows[e.RowIndex].Cells[2].Value.ToString(); txtdueday.Value = Int32.Parse(this.dataGridView2.Rows[e.RowIndex].Cells[3].Value.ToString()); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String pono = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); Int32 n = e.RowIndex; MainMenu frm = new MainMenu(); frm.delete_table("tbpo", "pono", this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString()); loaddatapo(); MessageBox.Show("Data PO " + pono + " has been deleted"); } } }