private void BtnSimpan_Click(object sender, RoutedEventArgs e) { try { var Dto = new IptAnggotaDto(); if (string.IsNullOrEmpty(IdAnggota.Text)) { System.Windows.MessageBox.Show("Id Anggota tidak boleh kosong", "Info", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (string.IsNullOrEmpty(Tanggal.Text)) { System.Windows.MessageBox.Show("Tanggal tidak boleh kosong", "Info", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (string.IsNullOrEmpty(Pokok.Text)) { Pokok.Text = "0"; } if (string.IsNullOrEmpty(Wajib.Text)) { Wajib.Text = "0"; } if (string.IsNullOrEmpty(Sukarela.Text)) { Sukarela.Text = "0"; } if (string.IsNullOrEmpty(Belanja.Text)) { Belanja.Text = "0"; } if (string.IsNullOrEmpty(BungaPinjaman.Text)) { BungaPinjaman.Text = "0"; } Dto.Id = Convert.ToInt64(Id.Text); Dto.CreatedBy = CreatedBy.Text; Dto.CreatedDate = Convert.ToDateTime(CreatedDate.Text); Dto.IdAnggota = IdAnggota.Text; var CheckAnggota = CheckAnggotaExist(Dto.IdAnggota); if (CheckAnggota == null) { System.Windows.MessageBox.Show("ID tersebut tidak terdaftar", "Info", MessageBoxButton.OK, MessageBoxImage.Information); return; } Dto.NamaAnggota = CheckAnggota.NamaAnggota; Dto.Tanggal = Convert.ToDateTime(Tanggal.Text); Dto.Pokok = Convert.ToDouble(Pokok.Text); Dto.Wajib = Convert.ToDouble(Wajib.Text); Dto.Sukarela = Convert.ToDouble(Sukarela.Text); Dto.Belanja = Convert.ToDouble(Belanja.Text); Dto.BungaPinjaman = Convert.ToDouble(BungaPinjaman.Text); Dto = _iptAnggotaServices.InserOrUpdate(Dto); System.Windows.MessageBox.Show("Data sudah tersimpan", "Info", MessageBoxButton.OK, MessageBoxImage.Information); CloseWin(); } catch (Exception ex) { LogError.WriteError(ex); System.Windows.MessageBox.Show("Error!! \n telah terjadi kesalahan, Hubungi administrator", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }