Esempio n. 1
0
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            #region validasi
            if (txt_norek.Text == "")
            {
                MessageBox.Show("No Rekening Harus di Isi");
                txt_norek.Focus();
                return;
            }
            if (txt_nama.Text == "")
            {
                MessageBox.Show("Nama Harus di Isi");
                txt_nama.Focus();
                return;
            }
            if (txt_setoranAwal.Text == "")
            {
                MessageBox.Show("Nominal Setoran Harus di Isi");
                txt_setoranAwal.Focus();
                return;
            }

            int m_nominal = 0;
            if (!int.TryParse(txt_setoranAwal.Text.Trim(), out m_nominal))
            {
                MessageBox.Show("Inputan Harus Berupa Angka");
                txt_setoranAwal.ResetText();
                txt_setoranAwal.Focus();
                return;
            }
            #endregion

            #region proses
            account myaccount = new account();
            myaccount.Account_number = txt_norek.Text.Trim();
            myaccount.Account_nama   = txt_nama.Text.Trim();
            myaccount.Balance        = m_nominal;
            Program.Currentaccount   = myaccount;
            this.Close();
            #endregion
        }
        private void btn_simpan_Click(object sender, EventArgs e)
        {
            #region validasi
            int m_nominal = 0;
            if (!int.TryParse(txt_penarikan.Text.Trim(), out m_nominal))
            {
                MessageBox.Show("Inputan Harus Berupa Angka");
                txt_penarikan.ResetText();
                txt_penarikan.Focus();
                return;
            }

            #endregion

            #region proses
            account myaccount = Program.Currentaccount;
            myaccount.Balance      = myaccount.deposit(m_nominal);
            Program.Currentaccount = myaccount;
            this.Close();
            #endregion
        }