private void button1_Click(object sender, EventArgs e) { if (production_voucher_id == -1) { c.ErrorBox("No Voucher Found/Linked"); return; } DataTable table = c.getTableRows("Carton_Production_Voucher", "Voucher_ID=" + production_voucher_id); DataRow voucher = table.Rows[0]; M_V3_cartonProductionForm f = new M_V3_cartonProductionForm(voucher, false, new M_V_history(1)); f.deleteButton.Visible = false; f.StartPosition = FormStartPosition.CenterScreen; f.Show(); }
private void detailsButton_Click(object sender, EventArgs e) { //view details form or details if (this.dataGridView0.SelectedRows.Count != 0) { if (this.dgvstates[0] == 1) { Display_Carton dc = new Display_Carton((dataGridView0.Rows[dataGridView0.SelectedRows[0].Index].DataBoundItem as DataRowView).Row); dc.Show(); } else { dataGridView0.DataSource = this.to_show_details[0]; this.dgvstates[0] = 1; set_details_column_widths(0); } } else if (this.dataGridView2.SelectedRows.Count != 0) { if (this.dgvstates[2] == 1) { Display_Tray dt = new Display_Tray((dataGridView2.Rows[dataGridView2.SelectedRows[0].Index].DataBoundItem as DataRowView).Row); dt.Show(); } else { dataGridView2.DataSource = this.to_show_details[2]; this.dgvstates[2] = 1; set_details_column_widths(2); } } else if (this.dataGridView3.SelectedRows.Count != 0) { if (this.dgvstates[3] == 1) { Display_Batch db = new Display_Batch((dataGridView3.Rows[dataGridView3.SelectedRows[0].Index].DataBoundItem as DataRowView).Row); db.Show(); } else { dataGridView3.DataSource = this.to_show_details[3]; this.dgvstates[3] = 1; set_details_column_widths(3); } } else if (this.dataGridView4.SelectedRows.Count != 0) { if (this.dgvstates[4] == 1) { Display_Batch db = new Display_Batch((dataGridView4.Rows[dataGridView4.SelectedRows[0].Index].DataBoundItem as DataRowView).Row); db.Show(); } else { dataGridView4.DataSource = this.to_show_details[4]; this.dgvstates[4] = 1; set_details_column_widths(4); } } else if (this.dataGridView5.SelectedRows.Count != 0) { if (this.dgvstates[5] == 1) { DataRow row = (dataGridView5.Rows[dataGridView5.SelectedRows[0].Index].DataBoundItem as DataRowView).Row; M_V3_cartonProductionForm f = new M_V3_cartonProductionForm(row, false, new M_V_history(1)); f.deleteButton.Visible = false; f.Show(); } else { dataGridView5.DataSource = this.to_show_details[5]; set_details_column_widths(5); this.dgvstates[5] = 1; } } else if (this.dataGridView6.SelectedRows.Count != 0) { if (this.dgvstates[6] == 1) { Display_Carton_Produced dcp = new Display_Carton_Produced((dataGridView6.Rows[dataGridView6.SelectedRows[0].Index].DataBoundItem as DataRowView).Row); dcp.Show(); } else { dataGridView6.DataSource = this.to_show_details[6]; set_details_column_widths(6); this.dgvstates[6] = 1; } } }