public C_REASON_CODE GetObjById(OleExec sfcdb, string id) { if (string.IsNullOrEmpty(id)) { return(null); } string sql = $@"select * from {TableName} where id='{id.Replace("'", "''")}' "; Row_C_REASON_CODE row_code = null; DataTable dt = null; try { dt = sfcdb.ExecSelect(sql).Tables[0]; if (dt.Rows.Count > 0) { row_code = (Row_C_REASON_CODE)this.NewRow(); row_code.loadData(dt.Rows[0]); } } catch (Exception ex) { throw ex; } return(row_code?.GetDataObject()); }
public List <C_REASON_CODE> GetAllReasonCode(OleExec sfcdb) { string sql = $@"select * from {TableName} "; List <C_REASON_CODE> lists = new List <C_REASON_CODE>(); Row_C_REASON_CODE row_code = null; DataTable dt = null; if (this.DBType == DB_TYPE_ENUM.Oracle) { try { dt = sfcdb.ExecSelect(sql).Tables[0]; foreach (DataRow dr in dt.Rows) { row_code = (Row_C_REASON_CODE)this.NewRow(); row_code.loadData(dr); if (row_code != null) { lists.Add(row_code.GetDataObject()); } } } catch (Exception ex) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000037", new string[] { ex.Message })); } } else { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { this.DBType.ToString() })); } return(lists); }