예제 #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);
        }
예제 #2
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);
        }