public void Addjurnal_Clicks(object sender, RoutedEventArgs e) { CashActivityBLL cashBLL = new CashActivityBLL(); if (cashBLL.Addtranscash(this.GetData()) > 0) { this.ClearForm(); MessageBox.Show("Add Order Cash Transaction successfully added !"); this.newCash.LoadDataAccount(); } else { MessageBox.Show("Add Order Cash Transaction failed to add !"); } this.Close(); }
private void Saveactivities_Click(object sender, RoutedEventArgs e) { if (cbActivitiesType.Text == "" || cbCurrency.Text == "" || tgl.Text == "" || txtCashActivitiesNo.Text == "" || cbCash.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } CashActivityBLL cashBLL = new CashActivityBLL(); CashActivityBLL CashBLL = new CashActivityBLL(); CashActivity cash = new CashActivity(); OrderTransaksiCash ordercash = new OrderTransaksiCash(); if (this.dropdownCashActivitySelected != null) { cash.PulldownCashActivities = this.dropdownCashActivitySelected.Id; cash.IdKodeTransaksi = this.dropdownCashActivitySelected.IdKodeTransaksi; cash.KodeTransaksi = this.dropdownCashActivitySelected.KodeTransaksi; cash.KategoriTransaksi = this.dropdownCashActivitySelected.KategoriTransaksi; } if (this.kontakSelected != null) { cash.IdKontak = this.kontakSelected.Id; cash.NamaKontak = this.kontakSelected.NamaA; } cash.Email = txtemail.Text; cash.NoHp = double.Parse(txthp.Text); if (this.dataMataUangSelected != null) { cash.IdMataUang = this.dataMataUangSelected.Id; cash.MataUang = this.dataMataUangSelected.NamaMataUang; cash.KursTukar = this.dataMataUangSelected.KursTukar; } cash.Tanggal = DateTime.Parse(tgl.Text); if (this.dokumenSelected != null) { cash.IdNoReferensiDokumen = this.dokumenSelected.Id; cash.NoReferensiDokumen = this.dokumenSelected.NoReferensiDokumen; } cash.NoCashActivities = double.Parse(txtCashActivitiesNo.Text); if (this.rekeningPerkiraanSelected != null) { cash.IdAkunKas = this.rekeningPerkiraanSelected.Id; cash.NamaAkunKas = this.rekeningPerkiraanSelected.NamaRekeningPerkiraan; } if (this.kontakSelecteds != null) { cash.IdPetugas = this.kontakSelecteds.Id; cash.NamaPetugas = this.kontakSelecteds.NamaA; } cash.Nilai = double.Parse(txtTotalPaymentValue.Text); cash.IdPeriodeAkuntansi = 1; cash.RealRecordTime = DateTime.Now; if (CashBLL.AddCashActivity(cash) > 0) { // this.ClearForm(); MessageBox.Show("Cash Activity successfully added !"); } else { MessageBox.Show("Cash Activity failed to add !"); } if (DGCashActivities.Items.Count > 0) { foreach (var item in DGCashActivities.Items) { if (item is OrderTransaksiCash) { OrderTransaksiCash oNewData1 = (OrderTransaksiCash)item; oNewData1.NoReferensiTransaksi = double.Parse(txtCashActivitiesNo.Text); if (this.rekeningPerkiraanSelected != null) { oNewData1.IdAkunHutangPiutangReferensi = this.rekeningPerkiraanSelected.Id; } if (this.dropdownCashActivitySelected != null) { oNewData1.IdDropdownPaymentCashActivity = this.dropdownCashActivitySelected.Id; oNewData1.IdKodeTransaksi = this.dropdownCashActivitySelected.IdKodeTransaksi; oNewData1.KodeTransaksi = this.dropdownCashActivitySelected.KodeTransaksi; } if (this.kontakSelected != null) { oNewData1.IdPelanggan = this.kontakSelected.Id; oNewData1.NamaPelanggan = this.kontakSelected.NamaA; } oNewData1.Email = txtemail.Text; oNewData1.NoHp = double.Parse(txthp.Text); if (this.dataMataUangSelected != null) { oNewData1.IdMataUang = this.dataMataUangSelected.Id; oNewData1.MataUang = this.dataMataUangSelected.NamaMataUang; oNewData1.KursTukar = this.dataMataUangSelected.KursTukar; } if (this.dokumenSelected != null) { oNewData1.IdNoReferensiDokumen = this.dokumenSelected.Id; oNewData1.NoReferensiDokumen = this.dokumenSelected.NoReferensiDokumen; } oNewData1.TanggalTransaksi = DateTime.Parse(tgl.Text); if (this.kontakSelecteds != null) { oNewData1.IdPetugas = this.kontakSelecteds.Id; oNewData1.NamaPetugas = this.kontakSelecteds.NamaA; } oNewData1.RealRecordingTime = DateTime.Now; oNewData1.IdPeriodeTransaksi = cash.IdPeriodeAkuntansi; oNewData1.Checkboxaktif = false; if (cashBLL.Edittranscash(oNewData1, cash) == true) { } } } CashActivities v = new CashActivities(); Switcher.Switchnewcash(v); } }