package sikd.sikd5.sikd5ejb.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import sikd.sikd5.sikd5bean.DashboardChartValue;

import sikd.sikd5.sikd5bean.fault.SIKDServiceException;
import sikd.sikd5.sikd5ejb.mapper.HomeMapper;

/**
 *
 * @author : soraturaes
 */
public class HomeDao {

//        public List<DashboardValue> getDashboardValue(short tahun,short bulan, String kodesatker, SqlSession session)
//			throws SIKDServiceException {
//		List<DashboardValue> hasil = new ArrayList<DashboardValue>();
//		try {
//			HomeMapper mapper = session.getMapper(HomeMapper.class);
//			hasil = mapper.getDashboardValues(tahun, bulan, kodesatker);
//			return hasil;
//		} catch (Exception e) {
//			throw new SIKDServiceException(e.getMessage());
//		}
//	}
//	public List<StatusData> getLraPemda(short tahun, SqlSession session)
//			throws SIKDServiceException {
//		List<StatusData> hasil = new ArrayList<StatusData>();
//		try {
//			HomeMapper mapper = session.getMapper(HomeMapper.class);
//			hasil = mapper.getLraPemda(tahun);
//			return hasil;
//		} catch (Exception e) {
//			throw new SIKDServiceException(e.getMessage());
//		}
//	}
        
	public List<DashboardChartValue> getDashboardChartValue(short tahun, short bulan, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getDashboardChartValue(tahun, bulan, kodesatker);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<DashboardChartValue> getDashboardNasionalChartValue(short tahun, short bulan, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getDashboardNasionalChartValue(tahun, bulan);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<DashboardChartValue> getRangkingBelanjaNasional(short tahun, short bulan, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getRangkingPemdaNasional(tahun, bulan);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<DashboardChartValue> getRangkingBelanjaPemda(short tahun, short bulan, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getRangkingSkpdPemda(tahun, bulan, kodesatker);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
        public List<DashboardChartValue> getDashboardNasionalValue(short tahun, short bulan, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getDashboardNasionalValue(tahun, bulan);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
	public List<DashboardChartValue> getDashboardPemdaValue(short tahun, short bulan, String kodesatker, SqlSession session)
			throws SIKDServiceException {
		List<DashboardChartValue> hasil = new ArrayList<DashboardChartValue>();
		try {
			HomeMapper mapper = session.getMapper(HomeMapper.class);
			hasil = mapper.getDashboardPemdaValue(tahun, bulan, kodesatker);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
        
}
