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

import java.util.List;

import android.content.Context;
import cn.net.caoyao.cpzshandset.bean.PackPackageInfoBean;
import cn.net.caoyao.cpzshandset.common.config.ConfigCreateService;
import cn.net.caoyao.cpzshandset.common.util.CacheGet;
import cn.net.caoyao.cpzshandset.db.presenter.PackPackageDal;

public class PackPackageBll {
	private PackPackageDal dal;
	public PackPackageBll(Context context) {
//		dal = new CommonPackPackageDal(context);
		ConfigCreateService service = new ConfigCreateService();
		dal = service.createPackPackageDal(new CacheGet(),context);
	}
	
	
	public int insertPackPackage(PackPackageInfoBean pBean) {
		if(dal == null) return -1;
		return dal.insertPackPackage(pBean);
	}

	
	public List<PackPackageInfoBean> queryAllPackPackageDESC(int option_id, int option_type) {
		if(dal == null) return null;
		return dal.queryAllPackPackageDESC(option_id, option_type);
	}

	
	public List<PackPackageInfoBean> queryAllPackPackageASC(int option_id, int option_type) {
		if(dal == null) return null;		
		return dal.queryAllPackPackageASC(option_id, option_type);
	}

	
	public PackPackageInfoBean queryPackPackageById(int id) {
		if(dal == null) return null;
		return dal.queryPackPackageById(id);
	}

	
	public void deletePackPackageById(int id) {
		if(dal == null) return;
		dal.deletePackPackageById(id);
	}

	
	public void deletePackPackageByOptionId(int option_id, int option_type) {
		if(dal == null) return;
		dal.deletePackPackageByOptionId(option_id, option_type);
	}
	
	
	public void updatePackPackageCountById(int id, int count) {
		if(dal == null) return;
		dal.updatePackPackageCountById(id, count);
	}

	
	public void updatePackPackageSubmitStatus(int id, int status, int error_code) {
		if(dal == null) return;
		dal.updatePackPackageSubmitStatus(id, status, error_code);
	}

	public boolean hasExisPackageInOtherPack(String packageLabel, int option_type, int option_id,
			int other_option_type) {
		if(dal == null) return true;
		return dal.hasExisPackageInOtherPack(packageLabel, option_type, option_id, other_option_type);
	}
	public boolean hasExisPackageInOtherActivate(String packageLabel) {
		if(dal == null) return true;
		return dal.hasExisPackageInOtherActivate(packageLabel);
	}
	public int queryPackageCountByOption(int option_id, int option_type) {
		if(dal == null) return 0;
		return dal.queryPackageCountByOption(option_id, option_type);
	}
}
