Esempio n. 1
0
        public IList <Kasbon> GetAll()
        {
            IList <Kasbon> oList = new List <Kasbon>();

            try
            {
                _sql = SQL_TEMPLATE.Replace("{WHERE}", "");
                _sql = _sql.Replace("{ORDER BY}", "ORDER BY t_kasbon.tanggal");

                oList = MappingRecordToObject(_sql).ToList();

                if (oList.Count > 0)
                {
                    IPembayaranKasbonRepository pembayaranKasbonRepo = new PembayaranKasbonRepository(_context, _log);

                    foreach (var kasbon in oList)
                    {
                        kasbon.item_pembayaran_kasbon = pembayaranKasbonRepo.GetByKasbonId(kasbon.kasbon_id).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("Error:", ex);
            }

            return(oList);
        }
        public IList <GajiKaryawan> GetByBulanAndTahun(int bulan, int tahun)
        {
            IList <GajiKaryawan> oList = new List <GajiKaryawan>();

            try
            {
                _sql = SQL_TEMPLATE.Replace("{WHERE}", "WHERE t_gaji_karyawan.bulan = @bulan AND t_gaji_karyawan.tahun = @tahun");
                _sql = _sql.Replace("{ORDER BY}", "ORDER BY m_karyawan.nama_karyawan");

                oList = MappingRecordToObject(_sql, new { bulan, tahun }).ToList();

                IPembayaranKasbonRepository pembayaranKasbonRepo = new PembayaranKasbonRepository(_context, _log);

                foreach (var gaji in oList)
                {
                    gaji.item_pembayaran_kasbon = pembayaranKasbonRepo.GetByGajiKaryawan(gaji.gaji_karyawan_id).ToList();
                }
            }
            catch (Exception ex)
            {
                _log.Error("Error:", ex);
            }

            return(oList);
        }
Esempio n. 3
0
        public IList <Kasbon> GetByStatus(bool isLunas)
        {
            IList <Kasbon> oList = new List <Kasbon>();

            try
            {
                if (isLunas)
                {
                    _sql = SQL_TEMPLATE.Replace("{WHERE}", "WHERE (t_kasbon.nominal  - t_kasbon.total_pelunasan) <= 0");
                }
                else
                {
                    _sql = SQL_TEMPLATE.Replace("{WHERE}", "WHERE (t_kasbon.nominal  - t_kasbon.total_pelunasan) > 0");
                }

                _sql = _sql.Replace("{ORDER BY}", "ORDER BY t_kasbon.tanggal");

                oList = MappingRecordToObject(_sql).ToList();

                if (oList.Count > 0)
                {
                    IPembayaranKasbonRepository pembayaranKasbonRepo = new PembayaranKasbonRepository(_context, _log);

                    foreach (var kasbon in oList)
                    {
                        kasbon.item_pembayaran_kasbon = pembayaranKasbonRepo.GetByKasbonId(kasbon.kasbon_id).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("Error:", ex);
            }

            return(oList);
        }