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

import java.util.List;

import android.content.Context;
import cn.net.caoyao.cpzshandset.bean.DealerInfoBean;
import cn.net.caoyao.cpzshandset.common.config.ConfigDBCreateService;
import cn.net.caoyao.cpzshandset.common.util.CacheGet;
import cn.net.caoyao.cpzshandset.db.presenter.DealerDal;
import cn.net.cpzslibs.prot.handset.bean.res.LiqueurDealerBean;

public class DealerBll {
	private DealerDal dal;
	public DealerBll(Context context) {
		ConfigDBCreateService service = new ConfigDBCreateService();
		dal = service.createDealerDal(new CacheGet(), context);
//		dal = new LiqueurDealerDal(context);
	}
	/**
	 * 插入白酒的经销商信息
	 * @param b
	 */
	public void insertLiqueurDealer(LiqueurDealerBean b){
		if(dal == null || b == null) return;
		dal.insertLiqueurDealer(b);
	}
	/**
	 * 插入白酒的经销商列表
	 * @param dealers
	 */
	public void insertLiqueurDealerList(List<LiqueurDealerBean> dealers){
		if(dal == null || dealers == null) return;
		dal.insertLiqueurDealerList(dealers);
	}
	/**
	 * 删除所有的经销商信息
	 */
	public void deleteAllDealer(){
		if(dal == null) return;
		dal.deleteAllDealer();
	}
	/**
	 * 通过经销商id，查询经销商信息
	 * @param id
	 * @return
	 */
	public DealerInfoBean queryDealerById(long id){
		if(dal == null) return null;
		return dal.queryDealerById(id);
	}
	/**
	 * 查询所有的经销商信息
	 */
	public List<DealerInfoBean> queryAllDealer(){
		if(dal == null) return null;
		return dal.queryAllDealer();
	}
	/**
	 * 通过条件查询经销商信息
	 * @param condition
	 * @return
	 */
	public List<DealerInfoBean> searchDealerByCondition(String condition){
		if(dal == null) return null;
		return dal.searchDealerByCondition(condition);
	}
}
