public bool load(string id) { #region 싱글데이터 로드하기 //this.OBJECT_ID = id; OraDB DB = new OraDB(); OracleDataReader rd = DB.ExecuteQuery(string.Format(sql_getinfo, id)); try { if (rd.HasRows) { rd.Read(); this.loadFromReader(rd); } } finally { if (rd != null) { rd.Close(); } rd = null; DB.Close(); } #endregion return(true); }
public static List <clsClassfication> getList(string person_id, string cls_code, bool expandAll) { #region 싱글데이터 로드하기 OraDB DB = new OraDB(); List <clsClassfication> res = new List <clsClassfication>(); string likecondition = "_____"; if (expandAll == true) { likecondition = "%"; } string sql_getlist = "SELECT * FROM " + __TABLE_NAME__ + " WHERE CATE_STATE != 'D' AND CLASSIFICATION_CODE LIKE '{0}" + likecondition + "' ORDER BY NVL( SUBSTR( CLASSIFICATION_CODE, 0, LENGTH( CLASSIFICATION_CODE ) -5 ), CLASSIFICATION_CODE ) , CATE_ORDER"; OracleDataReader rd = DB.ExecuteQuery(string.Format(sql_getlist, cls_code)); try { if (rd.HasRows) { while (rd.Read()) { clsClassfication cls = new clsClassfication(); cls.OBJECT_ID = rd["OBJECT_ID"].ToString(); cls.CREATE_DATE = rd["CREATE_DATE"].ToString(); cls.CREATOR_ID = rd["CREATOR_ID"].ToString(); cls.UPDATE_DATE = rd["UPDATE_DATE"].ToString(); cls.UPDATOR_ID = rd["UPDATOR_ID"].ToString(); cls.CLASSIFICATION_CODE = rd["CLASSIFICATION_CODE"].ToString(); cls.CATE_NAME = rd["CATE_NAME"].ToString(); cls.CATE_ORDER = rd["CATE_ORDER"].ToString(); cls.CATE_COMMENT = rd["CATE_COMMENT"].ToString(); cls.CATE_STATE = rd["CATE_STATE"].ToString(); cls.DESCR = rd["DESCR"].ToString(); res.Add(cls); } } } finally { if (rd != null) { rd.Close(); } rd = null; DB.Close(); } #endregion return(res); }
public bool insert(string person_id, string parent_id) { // 자아.. INSERT.. // 그나마 복잡한게 INSERT라고 보면 된다.. // 우선 CLS코드를 직접 구해줘야만 하고.. // 그에 맞는 ORDER도 만들어주어야 한다.. // 그외에는 머.. 별겨 없다.. if (parent_id == null || "".Equals(parent_id)) { parent_id = "0"; } OraDB DB = new OraDB(); try { string sql_getCls = "SELECT PARENTCODE || CHILDCODE RES, CHILDCODE FROM ( SELECT (SELECT CLASSIFICATION_CODE CLASSIFICATION_CODE FROM TB_OBJECT_CLASSIFICATION WHERE OBJECT_ID = {0} ) PARENTCODE, CHILDCODE FROM (SELECT SUBSTR( CHILDCODE, LENGTH(CHILDCODE)-4 ) CHILDCODE FROM (SELECT MAX( B.CLASSIFICATION_CODE ) PARENTCODE, '0000000' || ( NVL( SUBSTR( MAX(A.CLASSIFICATION_CODE), LENGTH( NVL( MAX( B.CLASSIFICATION_CODE ), 0 ) ) + 1 ), 0 ) + 1 ) CHILDCODE FROM TB_OBJECT_CLASSIFICATION A, (SELECT MAX(CLASSIFICATION_CODE) CLASSIFICATION_CODE, COUNT(*) CNT FROM TB_OBJECT_CLASSIFICATION WHERE OBJECT_ID = {0} ) B WHERE A.CLASSIFICATION_CODE LIKE B.CLASSIFICATION_CODE || '_____' ) ))"; OracleDataReader rd = DB.ExecuteQuery(String.Format(sql_getCls, parent_id)); try { if (rd.HasRows) { rd.Read(); CLASSIFICATION_CODE = rd["RES"].ToString(); CATE_ORDER = rd["CHILDCODE"].ToString(); } else { return(false); } } finally { if (rd != null) { rd.Close(); } rd = null; } string sql = string.Format(sql_insert, person_id, CLASSIFICATION_CODE, CATE_NAME, CATE_ORDER, CATE_COMMENT, DESCR); DB.Execute(sql); } finally { DB.Close(); } return(true); }
public static List <clsObject> getList(string person_id, string cls_code, string where) { #region 목록 데이터 로드하기 OraDB DB = new OraDB(); List <clsObject> res = new List <clsObject>(); if (cls_code == null || "".Equals(cls_code)) { cls_code = "%"; } string sql_getlist = "SELECT A.*, B.PERSON_NAME FROM TB_OBJECT A, TB_PERSON B WHERE A.STATUS != 'D' AND A.UPDATOR_ID = B.OBJECT_ID AND A.OBJECT_ID IN ( SELECT MAX( A.OBJECT_ID ) FROM TB_OBJECT A, TB_OBJECT_CLASSIFICATION B " + " WHERE A.CATE_PCODE = B.OBJECT_ID AND B.CLASSIFICATION_CODE LIKE '" + cls_code + "' " + where + " GROUP BY MASTER_ID ) ORDER BY CODE, TITLE"; OracleDataReader rd = DB.ExecuteQuery(string.Format(sql_getlist, "")); try { if (rd.HasRows) { while (rd.Read()) { clsObject obj = new clsObject(); // 실제 데이터 읽기.. obj.loadFromReader(rd); res.Add(obj); } } } finally { if (rd != null) { rd.Close(); } rd = null; DB.Close(); } #endregion return(res); }
public bool load(string id) { #region 싱글데이터 로드하기 this.OBJECT_ID = id; OraDB DB = new OraDB(); OracleDataReader rd = DB.ExecuteQuery(string.Format(sql_getinfo, id)); try { if (rd.HasRows) { rd.Read(); OBJECT_ID = rd["OBJECT_ID"].ToString(); CREATE_DATE = rd["CREATE_DATE"].ToString(); CREATOR_ID = rd["CREATOR_ID"].ToString(); UPDATE_DATE = rd["UPDATE_DATE"].ToString(); UPDATOR_ID = rd["UPDATOR_ID"].ToString(); CLASSIFICATION_CODE = rd["CLASSIFICATION_CODE"].ToString(); CATE_NAME = rd["CATE_NAME"].ToString(); CATE_ORDER = rd["CATE_ORDER"].ToString(); CATE_COMMENT = rd["CATE_COMMENT"].ToString(); CATE_STATE = rd["CATE_STATE"].ToString(); DESCR = rd["DESCR"].ToString(); } } finally { if (rd != null) { rd.Close(); } rd = null; DB.Close(); } #endregion return(true); }