private void button1_Click(object sender, EventArgs e) { string kodeJenis = ""; if (jenisKainComboBox.SelectedItem != null) { DataRowView drv = jenisKainComboBox.SelectedItem as DataRowView; kodeJenis = drv.Row["kd_jenis"].ToString(); } string lot = tbLot.Text.ToString(); string kodeKain = checkFromKain(kodeJenis, lot); string gramasi = tbGramasi.Text.ToString(); string stok = tbStok.Text.ToString(); string panjang = tbPanjang.Text.ToString(); if (kodeKain != null) { kodeKain = updateKain(kodeKain, stok); } else { kodeKain = insertKain(kodeJenis, lot, panjang, gramasi, stok); } MessageBox.Show(kodeKain + ""); Utils.DatabaseHelper db = new Utils.DatabaseHelper(); db.insertTblIn(kodeKain, "kain", stok); clearData(); MessageBox.Show("Data kain berhasil disimpan"); }
private void btnAdd_Click(object sender, EventArgs e) { string kodeJenis = jenisComboBox.SelectedItem.ToString(); string lot = tbLot.Text.ToString(); string kodeSemical = checkFromSemical(kodeJenis, lot); string stok = tbStok.Text.ToString(); string supplier = tbSupplier.Text.ToString(); string hargaBeli = tbHargaBeli.Text.ToString(); if (kodeSemical != null) { kodeSemical = updateSemical(kodeSemical, stok); } else { kodeSemical = insertSemical(kodeJenis, lot, supplier, hargaBeli, stok); } Utils.DatabaseHelper db = new Utils.DatabaseHelper(); db.insertTblIn(kodeSemical, "semical", stok); clearData(); MessageBox.Show("Data semical berhasil disimpan"); }