package com.csc.library.databean;

import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
import com.csc.library.session.DbInquiry;
import com.csc.library.session.DbRecord;
import com.csc.library.session.DbTable;
import com.csc.library.session.InitialInquiry;
import com.csc.library.session.RecordCmp;

public class Tforgetcard1_tmp extends RecordCmp {

	private DbInquiry inqEmp = null;
	
	public Tforgetcard1_tmp() {
		super("Tforgetcard1_tmp", "Tforgetcard1_tmp Table");
	}
	
	private void setEmployeeDetail(){
		try {
			if (this.inqEmp ==null) {
				this.inqEmp = new InitialInquiry(this.userPro).getDbInquiry();
				this.inqEmp.setParam(this.param);
				this.inqEmp.setSchemaName(this.userPro.getSchemaName());
				this.inqEmp.initMyTable("Memployee", "", "");
			}
			this.inqEmp.setFilter("employeeid='"+this.getString("employeeid")+"'");
			this.inqEmp.setColumn("employeeid, runno, branch, job, bossid, bu1, bu2, bu3, bu4, bu5, " +
					"salatype, workarea,  emp_position, emp_group, companyid");	 
			this.inqEmp.setParam("rsc_skip","true");
			this.inqEmp.refresh();
			while (this.inqEmp.next()) {
				this.set("bu1", this.inqEmp.getString("bu1"));
				this.set("bu2", this.inqEmp.getString("bu2"));
				this.set("bu3", this.inqEmp.getString("bu3"));
				this.set("bu4", this.inqEmp.getString("bu4"));
				this.set("bu5", this.inqEmp.getString("bu5"));
				this.set("job", this.inqEmp.getString("job"));
				this.set("emp_group", this.inqEmp.getString("emp_group"));
				this.set("emp_position", this.inqEmp.getString("emp_position"));
				this.set("branch", this.inqEmp.getString("branch"));
				this.set("bossid", this.inqEmp.getString("bossid"));
				this.set("salatype", this.inqEmp.getString("salatype"));
				this.set("workarea", this.inqEmp.getString("workarea"));			
			}
		} catch (Exception e) {
			MyLog.error(this, e);			
		}		
	}	
	
	protected boolean preInsertTrigger() throws Exception {
		boolean result = super.preInsertTrigger();		
		if (!this.getString("employeeid").equals("")) {
			this.setEmployeeDetail();
		}
		return result;
	}
	
}