private void FormTambahNotaJual_Load(object sender, EventArgs e) { listPelanggan = pelanggan.QueryData(); comboBoxDaftarPelanggan.DataSource = listPelanggan; comboBoxDaftarPelanggan.DisplayMember = "Nama"; form = (FormMaster)Owner.MdiParent; labelKodePegawai.Text = form.pegawaiLogin.KodePegawai; labelNamaPegawai.Text = form.pegawaiLogin.Nama; textBoxNoNota.Text = nota.GeneratePrimaryKey(); dateTimePickerTanggal.Value = DateTime.Now; if (comboBoxDaftarPelanggan.SelectedIndex != -1) { labelAlamat.Text = ((Pelanggan)comboBoxDaftarPelanggan.SelectedItem).Alamat; } }
private void buttonLogin_Click(object sender, EventArgs e) { try { ArrayList list = new ArrayList(); Pegawai pegawai = new Pegawai(); if (textBoxUsername.Text != "") { Koneksi koneksi = new Koneksi(textBoxServer.Text, textBoxDatabase.Text, textBoxUsername.Text, textBoxPassword.Text); MessageBox.Show("Koneksi Berhasil", "Sukses"); Owner.Enabled = true; list = pegawai.QueryData("username", textBoxUsername.Text); if (list.Count > 0) { FormMaster form = (FormMaster)Owner; form.labelKodePegawai.Text = ((Pegawai)list[0]).KodePegawai.ToString(); form.labelNamaPegawai.Text = ((Pegawai)list[0]).Nama; form.labelJabatan.Text = ((Pegawai)list[0]).Jabatan.IdJabatan; form.HakAkses(((Pegawai)list[0]).Jabatan); form.pegawaiLogin = ((Pegawai)list[0]); } Close(); } } catch (Exception error) { MessageBox.Show(error.Message, "Error"); } }