package cn.net.caoyao.cpzshandset.service.bll;

import java.util.List;

import android.content.Context;
import cn.net.caoyao.cpzshandset.bean.DriverInfoBean;
import cn.net.caoyao.cpzshandset.db.dal.ythScaner.YthScannerDriverInfoDal;
import cn.net.caoyao.cpzshandset.db.presenter.DriverInfoDal;
import cn.net.cpzslibs.prot.handset.bean.res.YthDriverInfoBean;

public class DriverInfoPunitBll {
	private DriverInfoDal dal;
	public DriverInfoPunitBll(Context context) {
		dal = new YthScannerDriverInfoDal(context);
	}
	/**
	 * 插入司机信息列表
	 * @param beans
	 */
	public void insertDriverInfoList(List<YthDriverInfoBean> beans){
		if (dal == null || beans == null) return;
		dal.insertDriverInfoList(beans);
	}
	
	/**
	 * 插入单个司机信息
	 * @param b
	 */
	public void insertDriverInfo(YthDriverInfoBean b){
		if(dal == null || b == null) return;
		dal.insertDriverInfo(b);
	}
	/**
	 * 查询所有的司机信息
	 * @return
	 */
	public List<DriverInfoBean> queryAllDriverInfoDESC(){
		if(dal == null) return null;
		return dal.queryAllDriverInfoDESC();
	}
	
	/**
	 * 查询所有的司机信息
	 * @return
	 */
	public List<DriverInfoBean> queryAllDriverInfoASC(){
		if(dal == null) return null;
		return dal.queryAllDriverInfoASC();
	}
	/**
	 * 通过订单id查询司机信息
	 * @param orderId
	 * @return
	 */
	public List<DriverInfoBean> queryDriverInfoByOrderId(long orderId){
		if(dal == null) return null;
		return dal.queryDriverInfoByOrderId(orderId);
	}
	/**
	 * 根据司机id，查询司机信息
	 * @param id
	 * @return
	 */
	public DriverInfoBean queryDriverInfoById(long id){
		if(dal == null) return null;
		return dal.queryDriverInfoById(id);
	}
	
	/**
	 * 删除所有的司机信息
	 */
	public void deleteAllDriverInfo(){
		if(dal == null) return;
		dal.deleteAllDriverInfo();
	}
	/**
	 * 通过订单id删除司机信息
	 * @param orderId
	 */
	public void deleteDriverInfoByOrderId(long orderId){
		if(dal == null) return;
		dal.deleteDriverInfoByOrderId(orderId);
	}
	/**
	 * 通过司机id，删除司机信息
	 * @param id
	 */
	public void deleteDriverInfoById(DriverInfoBean b){
		if(dal == null) return;
		dal.deleteDriverInfoById(b);
	}
	/**
	 * 通过订单id，统计司机信息的个数
	 * @param orderId
	 * @return
	 */
	public int countDriverByOrderId(long orderId){
		if(dal == null) return 0;
		return dal.countDriverByOrderId(orderId);
	}
	
	public void updateDriverStatusById(int error_code,int native_status,long id){
		if(dal == null) return;
		dal.updateDriverStatusById(error_code, native_status, id);
	}
	
	public boolean insertHasExist(long id){
		if(dal == null) return false;
		return dal.insertHasExist(id);
	}
}
