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

import java.util.List;

import android.content.Context;
import cn.net.caoyao.cpzshandset.bean.TruckConsigeeBean;
import cn.net.caoyao.cpzshandset.common.config.ConfigDBCreateService;
import cn.net.caoyao.cpzshandset.common.util.CacheGet;
import cn.net.caoyao.cpzshandset.common.util.StringUtils;
import cn.net.caoyao.cpzshandset.db.presenter.TruckConsigneeDal;

public class TruckConsigneeBll {
	private TruckConsigneeDal dal;
	public TruckConsigneeBll(Context context) {
//		dal = new YthImageTruckConsigneeDal(context);
		ConfigDBCreateService service = new ConfigDBCreateService();
		dal = service.createTruckConsigneeDal(new CacheGet(), context);
	}

	/**
	 * 插入本地生成的客户信息
	 * @param consigeeBean
	 */
	public void insertNativeConsignee(TruckConsigeeBean consigeeBean){
		if (dal == null) {
			return;
		}
		dal.insertNativeConsignee(consigeeBean);
	}
	/**
	 * 插入服务器获取的客户信息
	 * @param consigeeBean
	 */
	public void insertOnlineConsignee(TruckConsigeeBean consigeeBean){
		if (dal == null) {
			return;
		}
		dal.insertOnlineConsignee(consigeeBean);
	}
	/**
	 * 插入客户信息列表
	 * @param consigeeBeans
	 */
	public void insertConsigneeList(List<TruckConsigeeBean> consigeeBeans){
		if (dal == null || consigeeBeans == null) {
			return;
		}
		dal.insertConsigneeList(consigeeBeans);
	}
	/**
	 * 删除所有的汽车客户信息
	 */
	public void deleteAllTruckConsignee(){
		if (dal == null) {
			return;
		}
		dal.deleteAllTruckConsignee();
	}
	/**
	 * 查询所有的汽车客户信息
	 * @return
	 */
	public List<TruckConsigeeBean> queryAllTruckConsignee(){
		if (dal == null) {
			return null;
		}
		return dal.queryAllTruckConsignee();
	}
	
	/**
	 * 查询所有的汽车客户信息
	 * @return
	 */
	public List<String> queryAllTruckConsigneeName(){
		if (dal == null) {
			return null;
		}
		return dal.queryAllTruckConsigneeName();
	}

	/**
	 * 通过条件查询客户信息
	 * @param conditionStr
	 * @return
	 */
	public List<TruckConsigeeBean> searchConsigneeByCondition(String conditionStr){
		if (dal == null || StringUtils.isEmpty(conditionStr)) {
			return null;
		}
		return dal.searchConsigneeByCondition(conditionStr);
	}
	
	/**
	 * 通过条件查询客户信息
	 * @param conditionStr
	 * @return
	 */
	public List<String> searchConsigneeNameByCondition(String conditionStr){
		if (dal == null || StringUtils.isEmpty(conditionStr)) {
			return null;
		}
		return dal.searchConsigneeNameByCondition(conditionStr);
	}

}
