Exemplo n.º 1
0
    /// <summary>
    /// 在标准的操作型XML中添加用户节点信息,以便能做一些操作日志的处理
    /// </summary>
    /// <param name="strDataInfo">标准操作型xml</param>
    /// <param name="userSession">当前用户的session</param>
    /// <returns>处理后的xml字符串</returns>
    public static string setOpDocXML(string strDataInfo, UserSession userSession)
    {
      try
      {
        XmlDocument doc = XmlFun.getDefaultDoc();

        string nodePath = Common.XDOC_ROOT;

        XmlFun.setNodeDOM(doc, nodePath, strDataInfo);

        
        // 设置用户节点
        string strNodeData = "<USERINFO><USERID>" + userSession.getUserID() +
                             "</USERID><USERTITLE>" + userSession.getUserTitle() +
                             "</USERTITLE><USERNAME>" + userSession.getUserName() +
                             "</USERNAME><UNITID>" + userSession.getUnitID() +
                             "</UNITID><UNITNAME>" + userSession.getUnitName() +
                             "</UNITNAME><MTYPE>" + userSession.getMType() +
                             "</MTYPE><LOGID>" + userSession.getLogID() +
                             "</LOGID><USERTYPE>" + userSession.getUserType() +
                             "</USERTYPE></USERINFO>";

        XmlFun.setNodeDOM(doc, nodePath, strNodeData);

        return doc.InnerXml;
      }
      catch (Exception e)
      {
        return null;
      }
    }