private void button1_Click(object sender, EventArgs e) { txtcompany.Enabled = true; txtcompanyname.Enabled = true; txtowner.Enabled = true; txtaddress.Enabled = true; txtphone.Enabled = true; cbProvinsi.Enabled = true; cbKabupaten.Enabled = true; cbKecamatan.Enabled = true; txtlicenseid.Enabled = true; rbfemale.Enabled = true; rbmale.Enabled = true; dateTimePicker1.Enabled = true; txtcode.Enabled = true; txtcompanyregistration.Enabled = true; MainMenu frm = new MainMenu(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_fieldname("tbcompany", "id", "companyid", txtcompany.Text); if (data.Count > 0) { id = Int32.Parse(data[0][0].ToString()); } }
private void button1_Click(object sender, EventArgs e) { String caseno = cbexistingpacking.Text.Trim(); String boxno = ""; String grade = ""; String size = ""; Int32 id_species = 0; String opt = Properties.Settings.Default.username; String producttype = cbproducttype.Text.Trim(); String productsize = cbproductsize.Text.Trim(); List <object[]> dtpacking = new List <object[]>(); MainMenu frm = new MainMenu(); // dtpacking = frm.get_data_table_string("tbpacking", "case_number",caseno); dtpacking = frm.get_data_table_string_fieldname("tbpacking", "box_number, grade, packingsize, id_species,productname,productpacking", "case_number", caseno); if (dtpacking.Count > 0) { boxno = dtpacking[0][0].ToString(); grade = dtpacking[0][1].ToString(); size = dtpacking[0][2].ToString(); id_species = Int32.Parse(dtpacking[0][3].ToString()); producttype = dtpacking[0][4].ToString(); productsize = dtpacking[0][5].ToString(); } this.Hide(); frmPacking fc = new frmPacking(); fc.Closed += (s, args) => this.Close(); fc.setInitialValue(caseno, boxno, grade, size, producttype, productsize); fc.ShowDialog(); }
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView2.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == dataGridView2.Columns["Delete"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to delete Packing " + this.dataGridView2.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String packing = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); string connString = Konek(); MySqlConnection conn3 = null; conn3 = new MySqlConnection(connString); conn3.Open(); MySqlCommand mySql = conn3.CreateCommand(); mySql.CommandText = "delete from tbpackingsize where packingsize=@packing"; mySql.Parameters.AddWithValue("@packing", packing); mySql.ExecuteNonQuery(); conn3.Close(); dataGridView2.Rows.RemoveAt(dataGridView2.SelectedRows[0].Index); load_grupsize_list(); } } if (e.ColumnIndex == dataGridView2.Columns["Edit"].Index && e.RowIndex >= 0) { String packing = this.dataGridView2.Rows[e.RowIndex].Cells[1].Value.ToString(); txtpacking.Text = packing; packingglobal = packing; MainMenu frm = new MainMenu(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_fieldname("tbpackingsize", "excludedft", "packingsize", packing); String excludedft = ""; if (data.Count > 0) { excludedft = data[0][0].ToString(); } if (excludedft.Equals("1")) { cbexclude.Checked = true; } else { cbexclude.Checked = false; } } }
public void loadtotalwrap() { String intlotcode = lblInternalcode.Text.Trim(); MainMenu frm = new MainMenu(); //get data from table List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_fieldname("tbreceiving", "weightwrap", "intlotcode", intlotcode); if (data.Count > 0) { lblweightwrap.Text = data[0][0].ToString(); txtweightwrap.Text = data[0][0].ToString(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { return; } if (e.ColumnIndex == 6 && e.RowIndex >= 0 && dataGridView1.Rows.Count > 0) { String caseno = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); String boxno = ""; String grade = ""; String size = ""; Int32 id_species = 0; String opt = Properties.Settings.Default.username; String producttype = lblproduktype.Text; String productsize = lblproduksize.Text; List <object[]> dtpacking = new List <object[]>(); MainMenu frm = new MainMenu(); //dtpacking = frm.get_data_table_string("tbpacking", "case_number", caseno); dtpacking = frm.get_data_table_string_fieldname("tbpacking", "box_number,grade,packingsize,id_species,productname,productpacking", "case_number", caseno); if (dtpacking.Count > 0) { boxno = dtpacking[0][0].ToString(); grade = dtpacking[0][1].ToString(); size = dtpacking[0][2].ToString(); id_species = Int32.Parse(dtpacking[0][3].ToString()); producttype = dtpacking[0][4].ToString(); productsize = dtpacking[0][5].ToString(); } this.Hide(); frmPacking fc = new frmPacking(); fc.Closed += (s, args) => this.Close(); fc.setInitialValue(caseno, boxno, grade, size, producttype, productsize); fc.ShowDialog(); } }
private void set_excludeft() { String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); MySqlCommand mySql3 = conn5.CreateCommand(); String packing = ""; List <object[]> data = new List <object[]>(); MainMenu frm = new MainMenu(); data = frm.get_data_table_string_fieldname("tbpackingsize", "packingsize", "excludedft", "1"); if (data.Count > 0) { for (int i = 0; i < data.Count; i++) { packing = data[i][0].ToString(); mySql3.CommandText = "update tbpackinglist set certificate=@certificate where size=@size and certificate like @certificate1"; mySql3.Parameters.AddWithValue("@certificate", ""); mySql3.Parameters.AddWithValue("@size", packing); mySql3.Parameters.AddWithValue("@certificate1", "%FT%"); mySql3.ExecuteNonQuery(); mySql3.CommandText = "update tbpackinglist_summary set certificate=@certificate2 where size=@size1 and certificate like @certificate3"; mySql3.Parameters.AddWithValue("@certificate2", ""); mySql3.Parameters.AddWithValue("@size1", packing); mySql3.Parameters.AddWithValue("@certificate3", "%FT%"); mySql3.ExecuteNonQuery(); } } conn5.Close(); }
private void scanpacking(String packing) { lblMessage.Text = ""; lblMessage.Text = packing; packing = packing.Replace("\n", String.Empty).Replace("\t", String.Empty).Replace("\r", String.Empty); //lblMessage.Text = packing; List <object[]> data = new List <object[]>(); MainMenu frm = new MainMenu(); //Get Box No String boxno = ""; data = frm.get_data_table_string_fieldname("tbpacking", "box_number", "case_number", packing); if (data.Count > 0) { boxno = data[0][0].ToString(); } //Check Shipping Number data = frm.get_data_table_string_fieldname("tbpacking", "shipping_unit_number", "case_number", packing); if (data.Count > 0) { String shipno = data[0][0].ToString(); if (!shipno.Equals("")) { lblMessage.Text = "Case No " + packing + " has been loaded to " + shipno + ". Please scan another case_number"; return; } else { String batchno = frm.get_batch_number(boxno); String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); try { MySqlCommand mySql3 = conn5.CreateCommand(); mySql3.CommandText = "update tbpacking set shipping_unit_number=@shipping_unit_number, remark=@remark, batchcode=@batchcode,moddatetime=@moddatetime where case_number=@case_number"; mySql3.Parameters.AddWithValue("@shipping_unit_number", lblpackinglist.Text.Trim()); mySql3.Parameters.AddWithValue("@case_number", packing); mySql3.Parameters.AddWithValue("@batchcode", batchno); mySql3.Parameters.AddWithValue("@remark", txtremark.Text.Trim()); DateTime dt = DateTime.Now; String cdate = dt.ToString("yyyy-MM-dd HH:mm:ss"); DateTime currdate = DateTime.Parse(cdate); mySql3.Parameters.AddWithValue("@moddatetime", frm.get_server_time()); mySql3.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } conn5.Close(); } } else { lblMessage.Text = "Case No " + packing + " is not available. Please scan another case_number"; return; } }