package sikd.sikd5.sikd5ejb.dao.login;

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

import org.apache.ibatis.session.SqlSession;

import sikd.sikd5.sikd5bean.fault.SIKDServiceException;
import sikd.sikd5.sikd5bean.tabel.Pemda;
import sikd.sikd5.sikd5bean.tabel.mgr.TUserAccount;
import sikd.sikd5.sikd5ejb.mapper.login.LoginMapper;

public class LoginDao {
	public TUserAccount getUserAccountbyName(String userName, SqlSession session)
			throws SIKDServiceException {
		TUserAccount info = null;
		try {
			LoginMapper mapper = session.getMapper(LoginMapper.class);
			info = mapper.getUserAccountbyName(userName);
			return info;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
		
	}
	public List<Pemda> getPemdaByTahuns(short tahun, SqlSession session) throws SIKDServiceException {
		List<Pemda> hasil = new ArrayList<Pemda>();
		try {
			LoginMapper mapper = session.getMapper(LoginMapper.class);
			hasil = mapper.getPemdaByTahuns(tahun);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}
	}
	
}
