Esempio n. 1
0
    public static string getQueryXml(OleDbDataReader rst,
                                    string[] strDicFieldList,
                                    string[] strDicNameList,
                                    string[] strDateFieldList,
                                    int int_TotalRecords,
                                    int int_TotalPages,
                                    Boolean blnDicInSv,
                                    string strListName)
    {
      strListName = strListName==null ? Common.XDOC_ROW : strListName;

      ReturnDoc docReturn = new ReturnDoc();
        try
        {
          if (docReturn.getQueryInfo(rst, strListName))
          {  
            XmlDocument doc = docReturn.getDocument();
            XmlNodeList nodeList = doc.SelectNodes(Common.BAR2 + strListName);

            for (int k = 0; k < nodeList.Count;k++ )
            {
              XmlNode node = (XmlElement)nodeList.Item(k);

              XmlElement node_Temp;
              /// 处理字典的翻译
              DicCache obj_DicCache = DicCache.getInstance();
              if (strDicFieldList != null)
              {
                for (int i = 0; i < strDicFieldList.Length; i++)
                {
                  node_Temp = (XmlElement)node.SelectSingleNode(strDicFieldList[i]);
                  string str_Text = node_Temp.InnerText;

                  if (General.empty(str_Text)) continue;

                  string str_SV = obj_DicCache.getText(strDicNameList[i], str_Text);


                  if (!blnDicInSv)
                  {
                    if (str_SV != null) node_Temp.InnerText = str_SV;
                  }
                  else
                  {
                    if (str_SV != null)
                      node_Temp.SetAttribute(Common.XML_PROP_SV, str_SV);
                  }
                }
              }

              /// 处理日期类型的字段
              if (strDateFieldList != null)
              {
                for (int i = 0; i < strDateFieldList.Length; i++)
                {
                  node_Temp = (XmlElement)node.SelectSingleNode(strDateFieldList[i]);
                  string str_Text = node_Temp.InnerText;

                  if (General.empty(str_Text)) continue;

                  string str_SV = General.cDateStr(str_Text);
                  str_Text = General.strToDate(str_SV);
                  node_Temp.InnerText = str_Text;

                  if (blnDicInSv)
                  {

                    if (str_SV != null)
                      node_Temp.SetAttribute(Common.XML_PROP_SV, str_SV);
                  }
                }
              }
            }
	          docReturn.addErrorResult(Common.RT_QUERY_SUCCESS);
	        }
	        else
	        {
	          docReturn.addErrorResult(Common.RT_QUERY_NOTHING);
	        }
	        docReturn.addPropToQueryInfo(Common.XML_PROP_TOTALPAGES, int_TotalPages.ToString());
	        docReturn.addPropToQueryInfo(Common.XML_PROP_RECORDS, int_TotalRecords.ToString());
  	      
        }
        catch(Exception e)
        {
    	    
        }
        return docReturn.getXml();
    }