private Int32 remark_double(String intlotcode, String remark) { remark = remark.Replace("X", ""); String doublechar = ""; MainMenu frm = new MainMenu(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbretouchingdetails", "intlotcode", intlotcode, "remark", remark); return(data.Count); }
private void dataGridView1_CellContentClick(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 vessel = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); MainMenu frm = new MainMenu(); frm.delete_table_2params("tbvessel", "vesselname", vessel, "suppcode", this.suppcode.Text); dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index); loaddatavessel(); } } if (e.ColumnIndex == dataGridView1.Columns["Edit"].Index && e.RowIndex >= 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to Edit " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value + "?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { flagedit = 1; MainMenu frm = new MainMenu(); String vessel = this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbvessel", "vesselname", vessel, "suppcode", this.suppcode.Text); if (data.Count > 0) { txtvesselname.Text = vessel; vesselglobal = txtvesselname.Text; txtvesselsize.Text = data[0][3].ToString(); txtflag.Text = data[0][5].ToString(); txtvesselregno.Text = data[0][4].ToString(); dateTimePicker1.Value = DateTime.Parse(data[0][6].ToString()); cbFishingGear.Text = data[0][7].ToString(); cbfishing_ground.Text = data[0][9].ToString(); if (data[0][8].ToString().Equals("Y")) { rbYes.Checked = true; } else { rbNo.Checked = true; } } } } }
private void save_retouching_productname() { String intlotcode = cbexistinglot.Text.Trim(); String productname = cbproductname.Text.Trim(); Boolean ada = false; List <object[]> data = new List <object[]>(); MainMenu frm = new MainMenu(); data = frm.get_data_table_string_2param("tbretouching", "intlotcode", intlotcode, "productname", productname); if (data.Count > 0) { ada = true; } String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); try { MySqlCommand mySql3 = conn5.CreateCommand(); if (!ada) { mySql3.CommandText = "Insert into tbretouching(intlotcode,productname,moddatetime) values(@intlotcode,@productname,@moddatetime)"; mySql3.Parameters.AddWithValue("@intlotcode", intlotcode); mySql3.Parameters.AddWithValue("@productname", productname); DateTime dt = DateTime.Now; String cdate = dt.ToString("yyyy-MM-dd HH:mm tt"); DateTime currdate = DateTime.Parse(cdate); mySql3.Parameters.AddWithValue("@moddatetime", frm.get_server_time()); mySql3.ExecuteNonQuery(); } else if (ada) { mySql3.CommandText = "Update tbretouching set productname=@productname, moddatetime=@moddatetime where intlotcode=@intlotcode"; mySql3.Parameters.AddWithValue("@intlotcode", intlotcode); mySql3.Parameters.AddWithValue("@productname", productname); 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(); }
private double get_lowerrange_weight_product() { double nw = 0; MainMenu frm = new MainMenu(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbproductsetup", "productname", cbproductname.Text.Trim(), "tradeunit", cbproductpacking.Text.Trim()); if (data.Count > 0) { if (!data[0][8].ToString().Equals("")) { //find out uprange nw = double.Parse(data[0][8].ToString()); } } return(nw); }
private String get_intlotcode() { String intlotcode = ""; String batch = txtbatch.Text.Trim(); String suppcode = txtsuppcode.Text.Trim(); String fishtipe = cbfishtype.Text.Trim(); String fishtipeval = ""; List <object[]> dtlot = new List <object[]>(); MainMenu flot = new MainMenu(); dtlot = flot.get_data_table_string_2param("tbsetup", "category", "typefish", "optionremark", fishtipe); if (dtlot.Count > 0) { fishtipeval = dtlot[0][3].ToString(); } DateTime tgl = dateTimePicker1.Value.Date; int julian = tgl.DayOfYear; String juliancode = julian.ToString(); if (juliancode.Length == 1) { juliancode = "00" + juliancode; } else if (juliancode.Length == 2) { juliancode = "0" + juliancode; } String curryear = DateTime.Now.ToString("yy"); String pdc = curryear + juliancode; if (cbcertificate.Text.Trim().Length == 0) { intlotcode = batch + suppcode + pdc + "." + fishtipeval; } else { intlotcode = batch + suppcode + pdc + "." + fishtipeval + "." + cbcertificate.Text.Trim(); } return(intlotcode); }
private void save_grupsize_packing() { MainMenu frm = new MainMenu(); List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbgrupsize", "grupsize", cbsize.Text.Trim(), "module", cbmodule.Text.Trim()); String status = "Not Ada"; if (data.Count > 0) { status = "Ada"; } String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); try { MySqlCommand mySql3 = conn5.CreateCommand(); if (status.Equals("Not Ada")) { mySql3.CommandText = "Insert into tbgrupsize(module,grupsize,lower,upper) values(@module,@grupsize,@lower,@upper)"; mySql3.Parameters.AddWithValue("@module", cbmodule.Text.Trim()); mySql3.Parameters.AddWithValue("@grupsize", cbsize.Text.Trim()); mySql3.Parameters.AddWithValue("@lower", txtlower.Text); mySql3.Parameters.AddWithValue("@upper", txtupper.Text); mySql3.ExecuteNonQuery(); } else { mySql3.CommandText = "update tbgrupsize Set lower=@lower,upper=@upper where grupsize=@grupsize and module=@module"; mySql3.Parameters.AddWithValue("@grupsize", cbsize.Text.Trim()); mySql3.Parameters.AddWithValue("@module", cbmodule.Text.Trim()); mySql3.Parameters.AddWithValue("@lower", txtlower.Text); mySql3.Parameters.AddWithValue("@upper", txtupper.Text); mySql3.ExecuteNonQuery(); } } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } conn5.Close(); MessageBox.Show("Data " + cbsize.Text + " has been stored"); }
private void save_fishing_gear() { MainMenu frm = new MainMenu(); //get data from table List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbsetup", "category", "fishinggear", "optionremark", txtgear.Text.Trim()); String status = "Not Ada"; if (data.Count > 0) { status = "Ada"; } String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); MySqlCommand mySql3 = conn5.CreateCommand(); if (status.Equals("Not Ada")) { try { mySql3.CommandText = "Insert into tbsetup(optionremark, category)" + " values(@optionremark, @category)"; mySql3.Parameters.AddWithValue("@optionremark", txtgear.Text); mySql3.Parameters.AddWithValue("@category", "fishinggear"); mySql3.ExecuteNonQuery(); conn5.Close(); MessageBox.Show("Data " + txtgear.Text + " has been stored"); } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } } else { MessageBox.Show("Data " + txtgear.Text + " has been available"); } }
void receivingentry(object sender, EventArgs e) { if (species == null || tipe == null) { MessageBox.Show("Please select option species or type"); return; } if (species.Trim().Equals("")) { MessageBox.Show("Please select option species"); return; } String intlotcode = ""; String rcvno = ""; String rcvdate = ""; String supplier = ""; String opt = ""; var current = sender as Button; this.Hide(); var frmReceiving = new frmReceiving(); frmReceiving.Closed += (s, args) => this.Close(); //rcv date DateTime dt = DateTime.Now; rcvdate = dt.ToString("yyyy-MM-dd hh:mm:ss"); // supplier supplier = comboBox1.Text.Trim(); //operator opt = Properties.Settings.Default.username; //int lot code //List<object[]> fdata = new List<object[]>(); //MainMenu fmain = new MainMenu(); //fdata = fmain.get_data_table_string("tbcompany", "companyid", "bogi"); //String typelotcode = ""; DateTime tgl = DateTime.Now; int julian; String stddate = ""; julian = tgl.DayOfYear; String julianstr = julian.ToString(); if (julianstr.Length == 1) { julianstr = "00" + julianstr; } else if (julianstr.Length == 2) { julianstr = "0" + julianstr; } stddate = dt.ToString("yy") + julianstr; //stddate = dt.ToString("ddMMyy"); String[] std = new String[4]; std = supplier.Split('-'); String standardcode = std[0] + std[1] + stddate; List <object[]> data = new List <object[]>(); MainMenu frm = new MainMenu(); data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "1", "optionremark", this.tipe); String kode1 = ""; if (data.Count > 0) { kode1 = data[0][3].ToString(); } data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "2", "optionremark", this.certificate); String kode2 = ""; if (data.Count > 0) { kode2 = data[0][3].ToString(); } data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "3", "optionremark", this.company); String kode3 = ""; if (data.Count > 0) { kode3 = data[0][3].ToString(); } //String rcvsequence = frm.get_data_sequence_receiving("tbreceiving", "intlotcode", standardcode); intlotcode = standardcode; if (!kode1.Equals("")) { intlotcode = intlotcode + "." + kode1; } if (!kode2.Equals("")) { intlotcode = intlotcode + "." + kode2; } if (!kode3.Equals("")) { intlotcode = intlotcode + "." + kode3; } //Certificate Properties.Settings.Default.certificate = kode2; //Sequence receiving Boolean sequence = false; List <object[]> data1 = new List <object[]>(); data1 = frm.get_data_table_string("tbsetup", "category", "receivingsequencenumber"); if (data1.Count > 0) { String sequencesetting = data1[0][3].ToString(); if (sequencesetting.Equals("Y") || sequencesetting.Equals("y")) { sequence = true; } } String rcvsequence = ""; if (sequence) { rcvsequence = frm.get_data_sequence_receiving("tbreceiving", "intlotcode", intlotcode); } //If there is receiving sequence if (sequence) { intlotcode = intlotcode + "-" + rcvsequence; } String dono = txtdono.Text.Trim(); //rcv no rcvno = "R1-" + intlotcode; //check data receiving based on intlotcode save_receiving(tipe, species, intlotcode, supplier, opt); data = frm.get_data_table_string("tbreceiving", "intlotcode", intlotcode); Int32 id; if (data.Count > 0) { id = Int32.Parse(data[0][0].ToString()); frmReceiving.setInitialValue(tipe, species, intlotcode, rcvno, rcvdate, supplier, opt, id, dono); frmReceiving.loaddatarcvdet(); frmReceiving.ShowDialog(); } }
private void save_vessel() { //String suppcode = ""; MainMenu frm = new MainMenu(); //get data from table List <object[]> data = new List <object[]>(); data = frm.get_data_table_string_2param("tbvessel", "suppcode", this.suppcode.Text, "vesselname", vesselglobal); String status = "Not Ada"; if (data.Count > 0) { status = "Ada"; } String connString = Konek(); MySqlConnection conn5 = new MySqlConnection(connString); conn5.Open(); MySqlCommand mySql3 = conn5.CreateCommand(); if (status.Equals("Not Ada")) { try { mySql3.CommandText = "Insert into tbvessel(suppcode, vesselname, vesselsize, vesselregno, vessel_flag,expired_date,fishing_gear, fishing_aggregate_device, fishing_ground, fisherman)" + " values(@suppcode, @vesselname, @vesselsize, @vesselregno, @vessel_flag,@expired_date,@fishing_gear,@fishing_aggregate_device, @fishing_ground,@fisherman)"; mySql3.Parameters.AddWithValue("@vesselname", txtvesselname.Text); mySql3.Parameters.AddWithValue("@vesselsize", txtvesselsize.Text); mySql3.Parameters.AddWithValue("@vesselregno", txtvesselregno.Text); mySql3.Parameters.AddWithValue("@vessel_flag", txtflag.Text); DateTime dt = dateTimePicker1.Value.Date; mySql3.Parameters.AddWithValue("@expired_date", DateTime.Parse(dt.ToString("yyyy-MM-dd hh:mm:ss"))); mySql3.Parameters.AddWithValue("@fishing_gear", cbFishingGear.Text.Trim()); mySql3.Parameters.AddWithValue("@suppcode", this.suppcode.Text); mySql3.Parameters.AddWithValue("@fisherman", this.txtfisherman.Text); String fad = "N"; if (rbYes.Checked) { fad = "Y"; } else { fad = "N"; } mySql3.Parameters.AddWithValue("@fishing_aggregate_device", fad); mySql3.Parameters.AddWithValue("@fishing_ground", cbfishing_ground.Text); mySql3.ExecuteNonQuery(); }catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } conn5.Close(); } if (flagedit == 1) { try { mySql3.CommandText = "update tbvessel set vesselname=@vesselname2, vesselsize=@vesselsize1, vesselregno=@vesselregno1, vessel_flag=@vessel_flag1, expired_date=@expired_date1, fishing_gear=@fishing_gear1, fishing_aggregate_device=@fishing_aggregate_device1, fishing_ground=@fishing_ground1 where suppcode=@suppcode1 and vesselname=@vesselname1"; mySql3.Parameters.AddWithValue("@vesselname1", vesselglobal); mySql3.Parameters.AddWithValue("@vesselname2", txtvesselname.Text); mySql3.Parameters.AddWithValue("@vesselsize1", txtvesselsize.Text); mySql3.Parameters.AddWithValue("@vesselregno1", txtvesselregno.Text); mySql3.Parameters.AddWithValue("@vessel_flag1", txtflag.Text); DateTime dt = dateTimePicker1.Value.Date; mySql3.Parameters.AddWithValue("@expired_date1", DateTime.Parse(dt.ToString("yyyy-MM-dd hh:mm:ss"))); mySql3.Parameters.AddWithValue("@fishing_gear1", cbFishingGear.Text.Trim()); mySql3.Parameters.AddWithValue("@suppcode1", this.suppcode.Text); String fad = "N"; if (rbYes.Checked) { fad = "Y"; } else { fad = "N"; } mySql3.Parameters.AddWithValue("@fishing_aggregate_device1", fad); mySql3.Parameters.AddWithValue("@fishing_ground1", cbfishing_ground.Text); mySql3.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Error message " + ex.Message); } conn5.Close(); flagedit = 0; } }