private void Shipping_Click(object sender, RoutedEventArgs e) { shippingBuyer sb = new shippingBuyer(username, kode); sb.Show(); this.Close(); }
public void loadData() { try { conn.Open(); string query = "select u.kode_user, u.nama_user, p.kode_produk, p.nama_produk, d.kode_dtrans, d.harga " + "from mh_user u, htrans h, dtrans d, mh_produk p " + "where h.kode_htrans = '" + kodeHTrans + "' and h.kode_htrans = d.fk_htrans and d.status = 1 and d.reportS = 0 and d.fk_produk = p.kode_produk and p.fk_penjual = u.kode_user " + "order by 2"; cmd = new OracleCommand(query, conn); namaSeller.ItemsSource = null; using (OracleDataReader reader = cmd.ExecuteReader()) { kodeUserPenjual.Clear(); while (reader.Read()) { namaPenjual temp = new namaPenjual(); temp.KodeS = reader.GetString(0); temp.NamaS = reader.GetString(1); temp.KodeP = reader.GetString(2); temp.NamaP = reader.GetString(3); temp.KodeD = reader.GetString(4); temp.Harga = reader.GetDecimal(5); temp.Tampil = reader.GetString(1) + " - " + reader.GetString(3); kodeUserPenjual.Add(temp); } namaSeller.SelectedValuePath = "KodeS"; namaSeller.DisplayMemberPath = "Tampil"; namaSeller.ItemsSource = kodeUserPenjual; } conn.Close(); } catch (Exception ex) { conn.Close(); Console.WriteLine(ex.StackTrace); } if (kodeUserPenjual.Count == 0) { try { conn.Open(); string query = $"update htrans set status = 2 where kode_htrans = '" + kodeHTrans + "'"; cmd = new OracleCommand(query, conn); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); conn.Close(); } MessageBox.Show("Already Done, Thank You For Your Cooperation"); shippingBuyer sb = new shippingBuyer(username, kode); sb.Show(); this.Close(); } }