Пример #1
0
        private void buttonPengiriman_Click(object sender, EventArgs e)
        {
            Form form = Application.OpenForms["FormDaftarPengiriman"];

            if (form == null)
            {
                FormDaftarPengiriman fp = new FormDaftarPengiriman();
                fp.MdiParent = this;
                fp.Show();
            }
            else
            {
                form.Show();
                form.BringToFront();
            }
        }
Пример #2
0
        private void buttonSimpan_Click(object sender, EventArgs e)
        {
            FormUtama            frmUtama = (FormUtama)this.Owner.MdiParent;
            FormDaftarPengiriman form     = (FormDaftarPengiriman)this.Owner;

            Ekspedisi eks = new Ekspedisi();

            eks.IdEkspedisi = comboBoxIdEks.Text;
            eks.Nama        = textBoxNamaEks.Text;

            NotaPenjualan nota = new NotaPenjualan();

            nota.NoNotaPenjualan = comboBoxNoNotaJual.Text;

            string kode  = textBoxKodePengiriman.Text;
            string jenis = "";

            if (comboBoxJenisPengiriman.Text == "Shipping Point")
            {
                jenis = "SP";
            }
            else
            {
                jenis = "DP";
            }
            int        biaya = int.Parse(textBoxBiaya.Text);
            string     nama  = textBoxNama.Text;
            DateTime   tgl   = dateTimePickerKirim.Value;
            string     ket   = textBoxKeterangan.Text;
            Pengiriman peng  = new Pengiriman(kode, jenis, nama, ket, tgl, biaya, nota, eks);

            string hasilTambah = Pengiriman.TambahData(peng);

            if (hasilTambah == "1")
            {
                MessageBox.Show("Berhasil Menambahkan Pengiriman");
                this.Close();
                form.FormDaftarPengiriman_Load(sender, e);
            }
            else
            {
                MessageBox.Show("pengiriman gagal tersimpan. Pesan kesalahan : " + hasilTambah, "Kesalahan");
            }
        }