function jsJsonData()
{

};
jsJsonData.getListData=function(DataObj)
{
    var obj=null;
    if(DBReader.DObjectIsNull(DataObj)==false)
    {
        var strObj = new StringBuffer();
        var strColumnObj = new StringBuffer();
        var fieldsCount = parseInt(DataObj.Fields.Count);
        var rowCount = parseInt(DataObj.RecordCount);
        
        strObj.appendLine('[');
        strColumnObj.appendLine('[');
        if(rowCount>0)
        {
            DataObj.MoveFirst();
        }
        for (var i = 0; i < rowCount; i++) 
        {
            if (i != 0)
            {
                strObj.appendLine(',');
            }
            strObj.appendLine('[');
            for (n = 0; n < fieldsCount; n++) 
            {
                if (n !== 0)
                {
                    strObj.appendLine(",");
                    if(i==0)
                    {
                        strColumnObj.appendLine(",");
                    }
                }
                if (DataObj.Fields(n).Type == 135) 
                {
                    if (DataObj.Fields(n).Value == "" || DataObj.Fields(n).Value == null || DataObj.Fields(n).Value == undefined)
                    {
                        strObj.appendLine("''");
                    }
                    else 
                    {
                        var dt = new Date(DataObj.Fields(n).Value);
                        
                        strObj.appendLine("'"+dt.Format("yyyy-MM-dd hh:mm:ss")+"'");
                        dt=null;
                    }
                }
                else 
                {
                    strObj.appendLine("'"+DataObj.Fields(n).Value+"'");
                }
                if(i==0)
                {
                    strColumnObj.appendLine("{name:'"+DataObj.Fields(n).Name+"'}");
                }
            }
            strObj.appendLine(']');
            DataObj.MoveNext();
        }
        strObj.appendLine(']');
        strColumnObj.appendLine(']');
        var arrValue=eval(strObj.toString());
        var arrColumn=eval(strColumnObj.toString());
        obj = new Ext.data.Store({
                                proxy: new Ext.ux.data.PagingMemoryProxy(arrValue),
                                reader: new Ext.data.ArrayReader({}, arrColumn)
                                });
        arrValue=null;
        arrColumn=null;
        strObj=null;
        strColumnObj=null;
        fieldsCount=null;
        rowCount=null;
        
        CollectGarbage();
    }
    return obj;
};
/*获取列表分页数据*/
jsJsonData.getListPagerData=function(strSql,conditon,OrderString,KeyFieldString,pagesize,pageindex)
{
    var JSonObj=new Array();
    
    var selectSql=strSql;
    var tmpArr=selectSql.split('SELECT');
    
    var SelectField=tmpArr[1];
    tmpArr=SelectField.split('FROM');
    SelectField=tmpArr[0];
    
    var SelectTable=tmpArr[1];
    tmpArr=OrderString.split(',');
    
    var lastOrdertype="";
    var arrLen=tmpArr.length;
    var OrderStringValue="";
    if(tmpArr.length>1)
    {
        lastOrdertype=tmpArr[tmpArr.length-1];
        arrLen=arrLen-1;
        for(var i=0;i<arrLen;i++)
        {
            OrderStringValue+=tmpArr[i];
        }
        OrderStringValue+=",";
    }
    else
    {
        lastOrdertype=tmpArr[0];
    }
    lastOrdertype=lastOrdertype.toUpperCase();
    OrderStringValue+=lastOrdertype.replace("DESC","").replace("ASC","");
    
    var orderType=0;
    if(lastOrdertype.indexOf('DESC')!=-1)
    {
        orderType=1;
    }
    
    var execSqlstr="exec eOA_CMB_GetPagerData '"+SelectTable+"','"+SelectField+"',"+pagesize+","+pageindex+",'"+KeyFieldString+"','"+conditon+"','"+OrderStringValue+"',"+orderType;
    
    var obj = DBReader.selectSql(execSqlstr, 'eOA_CMB_GetPagerData'); 
    if(DBReader.DObjectIsNull(obj)==false)
    {
        var rowCount = parseInt(obj.RecordCount);
        if (rowCount == 0) 
        {
            DBReader.Dispose(obj);
            var tmpObj=eval('[{"result" :0,"returnval" :"暂时没有结果"}]');
            JSonObj.push(tmpObj);
            tmpObj=null;
        }
        else
        {
            var result = new StringBuffer();
            var strColumnObj = new StringBuffer();
            var fieldsCount = parseInt(obj.Fields.Count);
            var totalValue=obj.Fields("AllCount").Value;
            
            strColumnObj.appendLine('[');
            result.appendLine('{"result" :1,"returnval" :"操作成功","total":'+totalValue+' ,"pageIndex":' + pageindex + ', "recordcount":' + rowCount + ',"root":[');
            if(rowCount>0)
            {
                obj.MoveFirst();
            }
            for (var i = 0; i < rowCount; i++) 
            {
                if (i != 0)
                {
                    result.appendLine(',');
                }
                result.appendLine('{');
                for (n = 0; n < fieldsCount; n++) 
                {
                    if (n !== 0)
                    {
                        result.appendLine(",");
                        if(i==0)
                        {
                            strColumnObj.appendLine(",");
                        }
                    }
                    if (obj.Fields(n).Type == 135) 
                    {
                        if (obj.Fields(n).Value == "" || obj.Fields(n).Value == null || obj.Fields(n).Value == undefined)
                        {
                            result.appendLine('"' + obj.Fields(n).Name.replace(/'"'/g, "'") + '"' + ':"null"');
                        }
                        else 
                        {
                            var dt = new Date(obj.Fields(n).Value);
                            
                            result.appendLine('"' + obj.Fields(n).Name + '"' + ':"' + dt.Format("yyyy-MM-dd hh:mm:ss") + '"');
                             
                            dt=null;
                        }
                    }
                    else 
                    {
                        result.appendLine('"' + obj.Fields(n).Name + '"' + ':"' + obj.Fields(n).Value + '"');
                    }
                    if(i==0)
                    {
                        strColumnObj.appendLine("{name:'"+obj.Fields(n).Name+"'}");
                    }
                }
                result.appendLine('}')
                obj.MoveNext();
            }
            result.appendLine(']}');
//            window.clipboardData.setData('text',result.toString());
//            alert(result);
            strColumnObj.appendLine(']');
            
            var StoreData=eval("["+result.toString()+"]");
            
            JSonObj.push(StoreData[0]);
            
            var arrColumn=eval(strColumnObj.toString());
            
            JSonObj.push(arrColumn);
//            JSonObj = new Ext.data.Store({
//                                    proxy: new Ext.ux.data.PagingMemoryProxy(StoreData),
//                                    reader: new Ext.data.JsonReader({
//                                                                        totalProperty: 'total', 
//                                                                        root: 'root'
//                                                                    },arrColumn)
//                                    });
            StoreData=null;
            arrColumn=null;
            
            result=null;
            strColumnObj=null;
            fieldsCount=null;
            totalValue=null;
        }
        rowCount=null;
    }
    selectSql=null;
    SelectField=null;
    tmpArr=null;
    SelectTable=null;
    lastOrdertype=null;
    arrLen=null;
    OrderStringValue=null;
    orderType=null;
    execSqlstr=null;
    
    DBReader.Dispose(obj);
    CollectGarbage();
    
    return JSonObj;
};
//新列表执行Sql返回JSON数据
jsJsonData.getDataList=function (strSql,tableName)
{
    var DataObj = DBReader.selectSql(strSql,tableName);
    var obj=jsJsonData.getListData(DataObj);
    DBReader.Dispose(DataObj);
    return obj;
};
/*获取列表分页数据*/
jsJsonData.getListPagerSqlData=function(strSql)
{
    var JSonObj=new Array();    
    
    var obj = DBReader.selectSql(strSql, 'getListPagerSqlData'); 
    
    if(DBReader.DObjectIsNull(obj)==false)
    {
        var rowCount = parseInt(obj.RecordCount);
        if (rowCount == 0) 
        {
            DBReader.Dispose(obj);
            var tmpObj=eval('[{"result" :0,"returnval" :"暂时没有结果"}]');
            JSonObj.push(tmpObj);
            tmpObj=null;
        }
        else
        {
            var result = new StringBuffer();
            var strColumnObj = new StringBuffer();
            var fieldsCount = parseInt(obj.Fields.Count);
            var totalValue=obj.Fields("AllCount").Value;
            
            strColumnObj.appendLine('[');
            result.appendLine('{"result" :1,"returnval" :"操作成功","total":'+totalValue+' ,"root":[');
            if(rowCount>0)
            {
                obj.MoveFirst();
            }
            for (var i = 0; i < rowCount; i++) 
            {
                if (i != 0)
                {
                    result.appendLine(',');
                }
                result.appendLine('{');
                for (n = 0; n < fieldsCount; n++) 
                {
                    if (n !== 0)
                    {
                        result.appendLine(",");
                        if(i==0)
                        {
                            strColumnObj.appendLine(",");
                        }
                    }
                    if (obj.Fields(n).Type == 135) 
                    {
                        if (obj.Fields(n).Value == "" || obj.Fields(n).Value == null || obj.Fields(n).Value == undefined)
                        {
                            result.appendLine('"' + obj.Fields(n).Name.replace(/'"'/g, "'") + '"' + ':""');
                        }
                        else 
                        {
                            var dt = new Date(obj.Fields(n).Value);
                            
                            result.appendLine('"' + obj.Fields(n).Name + '"' + ':"' + dt.Format("yyyy-MM-dd hh:mm:ss") + '"');
                             
                            dt=null;
                        }
                    }
                    else 
                    {
                        if (obj.Fields(n).Value == null)
                        {
                            result.appendLine('"' + obj.Fields(n).Name.replace(/'"'/g, "'") + '"' + ':""');
                        }
                        else
                        {
                            result.appendLine('"' + obj.Fields(n).Name + '"' + ':"' + strToString(obj.Fields(n).Value.toString().replace(/\\/g,"\\\\")) + '"');
                        }
                    }
                    if(i==0)
                    {
                        strColumnObj.appendLine("{name:'"+obj.Fields(n).Name+"'}");
                    }
                }
                result.appendLine('}')
                obj.MoveNext();
            }
            result.appendLine(']}');
//            window.clipboardData.setData('text',result.toString());

            strColumnObj.appendLine(']');
            
            var StoreData=eval("["+result.toString()+"]");
            
            JSonObj.push(StoreData[0]);
            
            var arrColumn=eval(strColumnObj.toString());
            
            JSonObj.push(arrColumn);
            
            StoreData=null;
            arrColumn=null;
            
            result=null;
            strColumnObj=null;
            fieldsCount=null;
            totalValue=null;
        }
        rowCount=null;
    }
    DBReader.Dispose(obj);
    
    CollectGarbage();
    
    return JSonObj;
};
//半角转全角
function strToString(changeStr)
{
    changeStr=changeStr.replace(/[(^*\n*)|(^*\r*)]/g,"");
    var reg=new RegExp("[\"\'<>,{}?\+\&]");
    if (reg.test(changeStr))
    {
         if(changeStr.indexOf("\&")!=-1)
         {
            changeStr=changeStr.replace(/\&/g,"＆");
         }
         if(changeStr.indexOf("\+")!=-1)
         {
            changeStr=changeStr.replace(/\+/g,"＋");
         } 
         if(changeStr.indexOf("\'")!=-1)
         {
            changeStr=changeStr.replace(/\'/g,"’");
         }
         if(changeStr.indexOf("<")!=-1)
         {
            changeStr=changeStr.replace(/\</g,"＜");
         }
         if(changeStr.indexOf(">")!=-1)
         {
            changeStr=changeStr.replace(/\>/g,"＞");
         }
         if(changeStr.indexOf("%")!=-1)
         {
            changeStr=changeStr.replace(/\%/g,"％");
         }
         if(changeStr.indexOf("?")!=-1)
         {
            changeStr=changeStr.replace(/\?/g,"？");
         }
         if(changeStr.indexOf("\"")!=-1)
         {
            changeStr=changeStr.replace(/\"/g,"”");
         }
         if(changeStr.indexOf("[")!=-1)
         {
            changeStr=changeStr.replace(/\[/g,"［");
         }
         if(changeStr.indexOf("]")!=-1)
         {
            changeStr=changeStr.replace(/\]/g,"］");
         }
         if(changeStr.indexOf("{")!=-1)
         {
            changeStr=changeStr.replace(/\{/g,"｛");
         }
         if(changeStr.indexOf("}")!=-1)
         {
            changeStr=changeStr.replace(/\}/g,"｝");
         } 
         if(changeStr.indexOf(",")!=-1)
         {
            changeStr=changeStr.replace(/\,/g,"，");
         }
    } 
    return changeStr;
}