コード例 #1
0
        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);
        }
コード例 #2
0
        public double GetLastSaldo(DateTime tanggal)
        {
            double saldo = 0;

            using (DbContext context = new DbContext())
            {
                _repository = new PembukuanRepository(context);
                saldo       = _repository.GetLastSaldo(tanggal);
            }

            return(saldo);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public List <Pembukuan> ReadAll()
        {
            List <Pembukuan> listOfBuku = new List <Pembukuan>();

            using (DbContext context = new DbContext())
            {
                _repository = new PembukuanRepository(context);
                listOfBuku  = _repository.ReadAll();
            }

            return(listOfBuku);
        }