public int Create(Pembukuan buku) { int result = 0; if (string.IsNullOrEmpty(buku.Tanggal.ToString())) { MessageBox.Show("Tanggal harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } if (string.IsNullOrEmpty(buku.Item)) { MessageBox.Show("Nama item harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } using (DbContext context = new DbContext()) { _repository = new PembukuanRepository(context); result = _repository.Create(buku); } if (result > 0) { MessageBox.Show("Data item berhasil ditambahkan!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Data item gagal ditambahkan!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }
public double GetLastSaldo(DateTime tanggal) { double saldo = 0; using (DbContext context = new DbContext()) { _repository = new PembukuanRepository(context); saldo = _repository.GetLastSaldo(tanggal); } return(saldo); }
public List <Pembukuan> ReadByMonth(int bulan, int tahun) { List <Pembukuan> listOfBuku = new List <Pembukuan>(); using (DbContext context = new DbContext()) { _repository = new PembukuanRepository(context); listOfBuku = _repository.ReadByMonth(bulan, tahun); } return(listOfBuku); }
public List <Pembukuan> ReadByDate(DateTime tanggalAwal, DateTime tanggalAkhir) { List <Pembukuan> listOfBuku = new List <Pembukuan>(); using (DbContext context = new DbContext()) { _repository = new PembukuanRepository(context); listOfBuku = _repository.ReadByDate(tanggalAwal, tanggalAkhir); } return(listOfBuku); }
public List <Pembukuan> ReadAll() { List <Pembukuan> listOfBuku = new List <Pembukuan>(); using (DbContext context = new DbContext()) { _repository = new PembukuanRepository(context); listOfBuku = _repository.ReadAll(); } return(listOfBuku); }