Esempio n. 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (TxtNumber.Text == "")
            {
                //Insert Data
                if (Txtdeskripsi.Text == "")
                {
                    MessageBox.Show("Deskripsi Kosong");
                    Txtdeskripsi.Focus();
                }
                else if (Txtnominal.Text == "")
                {
                    MessageBox.Show("Nominal Kosong");
                    Txtnominal.Focus();
                }
                else if (CmbDebit.Text == "101")
                {
                    //Proses Insert
                    Akuntansi AK = new Akuntansi();
                    AK.No_Transaksi = TxtNumber.Text;
                    AK.Tanggal      = DTPTransaksi.Text;
                    AK.Keterangan   = Txtdeskripsi.Text;
                    AK.Akun_DT      = CmbDebit.Text;
                    AK.Akun_KR      = Cmbkredit.Text;
                    AK.Nominal      = Convert.ToDouble(Txtnominal.Text);

                    AKD.InsertData(AK);
                }
                else
                {
                    MessageBox.Show("Ini Form Untuk Kas Masuk(Cash In)");
                }
            }
            else
            {
                //Update Data
                Akuntansi AK = new Akuntansi();
                AK.No_Transaksi = TxtNumber.Text;
                AK.Tanggal      = DTPTransaksi.Text;
                AK.Keterangan   = Txtdeskripsi.Text;
                AK.Akun_DT      = CmbDebit.Text;
                AK.Akun_KR      = Cmbkredit.Text;
                AK.Nominal      = Convert.ToDouble(Txtnominal.Text);

                AKD.UpdateData(AK, TxtNumber.Text);
            }
        }
Esempio n. 2
0
        public bool UpdateData(Akuntansi AK, string No_Transaksi)
        {
            Boolean stat = false;

            try
            {
                Connection.Open();
                Command             = new SqlCommand();
                Command.Connection  = Connection;
                Command.CommandType = System.Data.CommandType.Text;
                Command.CommandText = "UPDATE Table_Transaksi SET No_Transaksi='" + AK.No_Transaksi + "',Tanggal='" + AK.Tanggal + "',Keterangan='" + AK.Keterangan + "',Akun_DT='" + AK.Akun_DT + "',Akun_KR='" + AK.Akun_KR + "',Nominal='" + AK.Nominal + "'WHERE No_Transaksi='" + No_Transaksi + "'";
                Command.ExecuteNonQuery();
                stat = true;
                Connection.Close();
            }
            catch (SqlException)
            { }
            return(stat);
        }
Esempio n. 3
0
        public bool InsertData(Akuntansi AK)
        {
            Boolean stat = false;

            try
            {
                Connection.Open();
                Command             = new SqlCommand();
                Command.Connection  = Connection;
                Command.CommandType = System.Data.CommandType.Text;
                Command.CommandText = "INSERT INTO Table_Transaksi VALUE('" + AK.No_Transaksi + "','" + AK.Tanggal + "','" + AK.Keterangan + "','" + AK.Akun_DT + "','" + AK.Akun_KR + "','" + AK.Nominal + "')";
                Command.ExecuteNonQuery();
                stat = true;
                Connection.Close();
            }
            catch (SqlException)
            { }
            return(stat);
        }