package com.steering.pss.sale.base;

import java.sql.SQLException;
import java.util.ArrayList;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;

import com.steering.comm.db.DBCommon;

public class CoreRegion extends DBCommon {
	/**
	 * 获取树形结构
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetTivCode() {
		return this.getDataBySqlID("CoreRegion.GetRegionTree");
	}
	/**
	 * 获取区域属性
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetRegIonCode(String name) {
		Object[] params = new Object[] {name};
		return this.getDataBySqlID("CoreRegion.GetRegIonCode",params);
	}
	/**
	 * 获取所有区域属性
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetRegIonCodeS() {  
		return this.getDataBySqlID("CoreRegion.GetRegIonCodeS");
	}
	/**
	 * 获取过滤区域属性
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetRegIonCodeNo(String name) { 
		Object[] params = new Object[] {name};
		return this.getDataBySqlID("CoreRegion.GetRegIonCodeNo",params);
	}
	/**
	 * 获取上级区域属性
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetSelAdminRegion() {
		return this.getDataBySqlID("CoreRegion.GetSelAdminRegion");
	}
	/**
	 * 过滤上级区域属性
	 * @param name
	 * @return 
	 */
	public CoreReturnObject GetSelAdminRegionFilter(String name) {
		Object[] params = new Object[] {name};
		return this.getDataBySqlID("CoreRegion.GetSelAdminRegionFilter",params);
	}
	/**
	 * 获取单击树形查询Grid
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetQueryRegIonCode(String name) {
		Object[] params = new Object[] {name};
		return this.getDataBySqlID("CoreRegion.doQueryRegIonCode",params);
	}
	/**
	 * 获取查询所有Grid
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetQueryReg() {
		return this.getDataBySqlID("CoreRegion.doQuery");
	}
	/**
	 * 保存查询数据是否存在
	 * @param name
	 * @return
	 */
	public CoreReturnObject GetSaveQuery(String name,String toName) {
		Object[] params = new Object[] {name,toName};
		return this.getDataBySqlID("CoreRegion.saveQuery",params);
	}
	
	/**
	 * 保存查询数据是否存在
	 * @param name
	 * @return
	 */
	public CoreReturnObject saveQueryName(String name) {
		Object[] params = new Object[] {name};
		return this.getDataBySqlID("CoreRegion.saveQueryName",params);
	}
	
	/**
	 * 新增
	 */
	public CoreReturnObject SetAddRegion(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory.getSql("CoreRegion.toAdd");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}
	/**
	 * 作废
	 */
	public CoreReturnObject SetDleteRegion(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory.getSql("CoreRegion.toDlete");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}
	/**
	 * 恢复
	 */
	public CoreReturnObject SetResumeIon(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory.getSql("CoreRegion.doResume");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}
	/**
	 * 修改
	 */
	public CoreReturnObject SetUpdateIon(ArrayList<Object> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		String strSql = CoreXmlSqlParsersFactory.getSql("CoreRegion.toUpdate");
		try {
			cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteNonQuery(strSql, parm.toArray());
		} catch (SQLException e) {
			cro = cro.SetErrInfo(e.getMessage());
		}
		return cro;
	}
}
