コード例 #1
0
        private void transBtn_Click(object sender, EventArgs e)
        {
            panelUtama.Controls.Clear();
            sidePanel.Height = transBtn.Height;
            sidePanel.Top    = transBtn.Top;

            titleLabel.Text = "TRANSACTION";
            TransaksiUI formTransaksiUI = new TransaksiUI()
            {
                TopLevel = false, TopMost = true
            };

            formTransaksiUI.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.panelUtama.Controls.Add(formTransaksiUI);
            formTransaksiUI.Show();
        }
コード例 #2
0
        private void button_Simpan_Click(object sender, EventArgs e)
        {
            transaksiData = new Transaksi(label_IDNomor.Text,
                                          label_IDTrans.Text,
                                          label_IDMotor.Text,
                                          nama_TextBox.Text,
                                          nomorHp_TextBox.Text,
                                          alamat_TextBox.Text,
                                          tanggalJual_datePicker.Value.ToString("MM/dd/yyyy"),
                                          hargaJual_TextBox.Text.Replace(@".", "").Replace(@",", ""));

            if (nama_TextBox.Text.CompareTo("") == 0 || nomorHp_TextBox.Text.Trim().CompareTo("") == 0 || alamat_TextBox.Text.CompareTo("") == 0 || tanggalJual_datePicker.Text.Trim().CompareTo("") == 0 || hargaJual_TextBox.Text.CompareTo("") == 0)
            {
                MessageBox.Show("Input tidak boleh kosong !", "Peringatan", MessageBoxButtons.OK);
            }
            else
            {
                transaksiManager.addNewDataTransaksi(transaksiData);
                TransaksiUI transaksiUI = new TransaksiUI();

                if (transaksiManager.successed() == true)
                {
                    transaksiUI.refreshDataGrid();
                    nama_TextBox.Text           = "";
                    nomorHp_TextBox.Text        = "";
                    alamat_TextBox.Text         = "";
                    tanggalJual_datePicker.Text = "";
                    hargaJual_TextBox.Text      = "";
                    label_IDNomor.Text          = "-";
                    label_IDTrans.Text          = "-";
                    label_IDMotor.Text          = "-";

                    MessageBox.Show("Data Pengguna berhasil disimpan !", "Informasi", MessageBoxButtons.OK);
                    (this.Owner as Motorcycle).refreshDataGrid();
                    (this.Owner as Motorcycle).panelButton.Enabled = true;
                    (this.Owner as Motorcycle).panelSide.Hide();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Data Pengguna gagal disimpan !", "Pesan Kesalahan", MessageBoxButtons.OK);
                }
            }
        }