private void btnTambah_Click(object sender, EventArgs e) { if (toAngka(txtTotal.Text).Equals("0") || nama_pelanggan.Text.Equals("")) { MessageBox.Show("Masukkan data dengan benar", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Pembayaran pembayaran = new Pembayaran(txtTotal.Text); pembayaran.ShowDialog(this); if (pembayaran.berhasil) { MessageBox.Show("Transaksi berhasil...", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { return; } try { string connectionString = Program.getConstring(); SqlConnection connection = new SqlConnection(connectionString); SqlCommand myCommand = new SqlCommand("sp_inputTBeliKomponen", connection); myCommand.CommandType = CommandType.StoredProcedure; connection.Open(); id_transaksi = "tbk-" + getLastID(); myCommand.Parameters.AddWithValue("no_transaksi_pembelian", id_transaksi); myCommand.Parameters.AddWithValue("tanggal_transaksi", DateTime.Now.ToString("yyyyMMdd")); myCommand.Parameters.AddWithValue("jumlah_komponen", txtBarang.Text); myCommand.Parameters.AddWithValue("total_jenis", txtJenis.Text); myCommand.Parameters.AddWithValue("total_harga", toAngka(txtTotal.Text)); myCommand.Parameters.AddWithValue("id_pelayan", id_karyawan); //myCommand.Parameters.AddWithValue("id_pelayan", "PLY-0001"); myCommand.Parameters.AddWithValue("id_customer", getIDPelanggan(nama_pelanggan.Text)); myCommand.ExecuteNonQuery(); connection.Close(); detailtransaksi(); //by = 1; //btnUpdate.Enabled = true; } catch (Exception ex) { MessageBox.Show("Error btnBayar_Click : " + ex.ToString()); //btnUpdate.Enabled = false; //clear(); } addDataKomponen(); }
private void btnLogin_Click(object sender, EventArgs e) { txtID.Text = LC.getIDPegawaiYangLogin(txtUsername.Text).ToString(); if (txtID.Text == "" || txtPass.Text == "") { MessageBox.Show("Silahkan lengkapi form yang tersedia", "iNBC", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { if (LC.cekLogin(txtUsername.Text, txtPass.Text) == true) { int role = LC.GetRoleUser(txtUsername.Text, txtPass.Text); if (role == 1) { this.Hide(); KKUI KKUI = new KKUI(); KKUI.ShowDialog(); this.Close(); } if (role == 2) { this.Hide(); PengelolaanPegawai kelola = new PengelolaanPegawai(); kelola.setToolStripUser("Pengguna: Admin - " + txtUsername.Text); kelola.ShowDialog(); this.Close(); } if (role == 3) { this.Hide(); CSUI wlc = new CSUI(); //wlc.setToolStripUser("Pengguna: Customer Service - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 4) { this.Hide(); Pemeriksaan wlc = new Pemeriksaan(); wlc.setToolStripUser("Pengguna: Dokter - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 5) { this.Hide(); Pembayaran wlc = new Pembayaran(); wlc.setToolStripUser("Pengguna: Kasir - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } if (role == 6) { this.Hide(); BTCUI wlc = new BTCUI(); // wlc.setToolStripUser("Pengguna: Beautician - " + txtUsername.Text); wlc.ShowDialog(); this.Close(); } else { MessageBox.Show("Role tersebut tidak tersedia"); } } else { MessageBox.Show("Maaf, username / password salah", "iNBC", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }