/*********************************************************************************************************
	프로그램명		: User.java
	프로그램설명	: 사용자에 대한 정보를 얻을 수 있는 class
	작성자				: 강원중
	작성일				: 2003.12.09
	변경일				:	2003.12.09
**********************************************************************************************************/

package kr.co.kihyun.beans.totsys.sysadm.user;

import java.sql.ResultSet;
import java.sql.SQLException;

import kr.co.kihyun.db.DBManager;
import kr.co.kihyun.lang.MString;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * @Deprecated
 * use kr.co.kihyun.beans.entity Package and {@link Moumi#getEntityManager()} method
 */
@Deprecated
public class UserView extends DBManager{
	private static final Logger LOG = LoggerFactory.getLogger(UserView.class);
	
	ResultSet rs = null;

	String id = "";
	String passwd = "";
	String name = "";
	String slNo1 = "";
	String slNo2 = "";
	String email = "";
	String phone = "";
	String handTell = "";
	int sysAuth = 0;
	String deptID = "";
	String deptName = "";
	String passcode = "";
	String domainName = "";

	String partID = "";
	String partName = "";
	String dutyName = "";
	int partSysAuth = 0;
	int priority = 0;
	
	String naraAuth = "";

	/******** 사용자의 소속 기관 한글 이름 ********/	
  public void executeQuery(String id){		
		String sql = "";		
		try{						
			//DB에서 select해온 data 얻어오기.
			sql = "select us.passwd, us.name, us.sl_no_1, us.sl_no_2, us.email, us.phone, us.cell_phone, us.sys_auth, dp.id, dp.name, dp.passcode, pt.id, pt.name, pt.sys_auth, us.duty_name, us.priority, dp.location from moumi_muser us, moumi_dept dp, moumi_dept pt where us.dept_id = dp.id and dp.organ=pt.id and us.id=?";
			
			rs = execQuery(sql,id);
			if(rs.next()){				
				passwd = rs.getString(1);
				name = rs.getString(2);
				slNo1 = rs.getString(3);
				slNo2 = rs.getString(4);
				email = rs.getString(5);
				phone = rs.getString(6);
				handTell = rs.getString(7);
				sysAuth = rs.getInt(8);
				deptID = rs.getString(9);
				deptName = rs.getString(10);
				passcode = rs.getString(11);
				partID = rs.getString(12);
				partName = rs.getString(13);
				partSysAuth = rs.getInt(14);
				dutyName = rs.getString(15);
				priority = rs.getInt(16);
				domainName = rs.getString(17);

			}
		}catch(SQLException sqlEx){
			this.id = "NOID";
			LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
					new Object[] {sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql});
		}catch(Exception ex){
			this.id = "NOID";
			ex.printStackTrace();
		}finally{
			close(rs);
			execClose();
		}
	}

	public String getID(){return id;}
	public String getPasswd(){return passwd;}
	public String getName(){return name;}
	public String getSlNo1(){return slNo1;}
	public String getSlNo2(){return slNo2;}
	public String getEmail(){return email;}
	public String getPhone(){return phone;}
	public String getHandTell(){return handTell;}
	public int getSysAuth(){return sysAuth;}
	public String getDeptID(){return deptID;}
	public String getDeptName(){return deptName;}
	public String getPasscode(){return passcode;}
	public String getPartID(){return partID;}
	public String getPartName(){return partName;}
	public int getPartSysAuth(){return partSysAuth;}
	public String getDomainName() {return domainName;}
	public String getDutyName(){return dutyName;}
	public int getPriority(){return priority;}
	public String getNaraAuth() {return naraAuth;}
}
