private void InsertAppType() { XmlNode xNode = _XmlRequest.DocumentElement.SelectSingleNode(".//SET"); XmlNode root = null; string insertSql = string.Empty; string strSql = string.Empty; if (_XmlRequest.DocumentElement.SelectSingleNode("APP_OPERATION_TYPE") != null) { root = _XmlRequest.DocumentElement.SelectSingleNode("APP_OPERATION_TYPE"); insertSql = "INSERT APP_OPERATION_TYPE "; string appGuid = ((XmlElement)root).GetAttribute("appGuid"); string strOrgSort = ((XmlElement)root).GetAttribute("strSort"); string typeGuid = Guid.NewGuid().ToString(); InsertSqlClauseBuilder ic = new InsertSqlClauseBuilder(); ic.AppendItem <string>("GUID", typeGuid); ic.AppendItem <string>("APP_GUID", appGuid); ic.AppendItem <string>("DISPLAYNAME", xNode.SelectSingleNode("DISPLAYNAME").InnerText); ic.AppendItem <string>("CODE_NAME", xNode.SelectSingleNode("CODE_NAME").InnerText); ic.AppendItem <string>("DISCRIPTION", xNode.SelectSingleNode("DESCRIPTION").InnerText); ic.AppendItem <string>("VISIBLE", "y"); ic.AppendItem <string>("CLASS", LogReader.GetNewClassValue(appGuid, strOrgSort)); strSql = insertSql + ic.ToSqlString(TSqlBuilder.Instance); UserDataWrite.InsertUserLog("APP_LOG", "", "", "", "ADD_OP_TYPE", "向日志审计系统添加新的操作类型:" + xNode.SelectSingleNode("DISPLAYNAME").InnerText, _XmlRequest.DocumentElement.InnerXml, true); } else { root = _XmlRequest.DocumentElement.SelectSingleNode("APP_LOG_TYPE"); insertSql = "INSERT APP_LOG_TYPE "; string appGuid = Guid.NewGuid().ToString(); InsertSqlClauseBuilder ic = new InsertSqlClauseBuilder(); ic.AppendItem <string>("GUID", appGuid); ic.AppendItem <string>("CODE_NAME", xNode.SelectSingleNode("CODE_NAME").InnerText); ic.AppendItem <string>("DISPLAYNAME", xNode.SelectSingleNode("DISPLAYNAME").InnerText); ic.AppendItem <string>("VISIBLE", "y"); ic.AppendItem <string>("DISCRIPTION", xNode.SelectSingleNode("DESCRIPTION").InnerText); ic.AppendItem <string>("CLASS", LogReader.GetClassForApp()); strSql = insertSql + ic.ToSqlString(TSqlBuilder.Instance); UserDataWrite.InsertUserLog("APP_LOG", "ADD_APP_TYPE", "向日志审计系统添加新的应用:" + xNode.SelectSingleNode("DISPLAYNAME").InnerText, _XmlRequest.DocumentElement.InnerXml, true); } InnerCommon.ExecuteNonQuery(strSql); }
public void GetTreeDataList() { XmlElement root = _XmlRequest.DocumentElement; string strLot = root.GetAttribute("listObjectType"); //要求查询的对象类型 string strGuid = root.GetAttribute("appTypeGuid"); string strSql = string.Empty; if (strGuid != string.Empty) { strSql = "SELECT GUID, 'OPTYPE' AS NODE_NAME, CODE_NAME, DISPLAYNAME, APP_GUID, VISIBLE, DISCRIPTION, CLASS FROM APP_OPERATION_TYPE WHERE APP_GUID = '" + strGuid + "' AND VISIBLE = 'y' ORDER BY CLASS"; } else { strSql = "SELECT GUID, 'APPNAME' AS NODE_NAME, CODE_NAME, DISPLAYNAME, VISIBLE, DISCRIPTION, CLASS FROM APP_LOG_TYPE WHERE VISIBLE = 'y' ORDER BY CLASS, CODE_NAME"; } DataSet ds = InnerCommon.ExecuteDataset(strSql); _XmlResult = LogReader.GetLevelSortXmlDocAttr(ds.Tables[0], "CLASS", "NODE_NAME", LogReader.LOG_ORIGINAL_SORT.Length); }
private string GetWhereSqlString() { string strWhereSql = string.Empty; string start_time = _RootElement.GetAttribute("start_time"); string end_time = _RootElement.GetAttribute("end_time"); string sUserName = _RootElement.GetAttribute("userName"); string sAppGuid = _RootElement.GetAttribute("appGuid"); string sFileID = _RootElement.GetAttribute("fileID"); string sOPGuid = _RootElement.GetAttribute("Guid"); string sListCtr = _RootElement.GetAttribute("listCtr"); string sOrgSort = _RootElement.GetAttribute("orgSort"); if (sOrgSort.Length == 4 && sListCtr == "search") { strWhereSql += "AND UOL.LOG_DATE >= " + TSqlBuilder.Instance.CheckQuotationMark(start_time, true) + " AND UOL.LOG_DATE < " + TSqlBuilder.Instance.CheckQuotationMark(end_time, true); sAppGuid = LogReader.GetGuidByDisplayName(_RootElement.GetAttribute("appName"), "APP_LOG_TYPE"); if (sAppGuid != "") { strWhereSql += " AND UOL.APP_GUID = " + TSqlBuilder.Instance.CheckQuotationMark(sAppGuid, true); } if (_RootElement.GetAttribute("opTypeName").Trim() != string.Empty) { sOPGuid = LogReader.GetGuidByDisplayName(_RootElement.GetAttribute("opTypeName"), "APP_OPERATION_TYPE"); } if (sOPGuid != "") { strWhereSql += " AND UOL.OP_GUID = " + TSqlBuilder.Instance.CheckQuotationMark(sOPGuid, true); } if (sUserName != "") { strWhereSql += " AND UOL.OP_USER_DISPLAYNAME = " + TSqlBuilder.Instance.CheckQuotationMark(sUserName, true); } if (sFileID != "") { strWhereSql += " AND UOL.ID = " + TSqlBuilder.Instance.CheckQuotationMark(sFileID, true); } } else if (sOrgSort.Length == 8) { if (sAppGuid != "") { strWhereSql += " AND UOL.APP_GUID = " + TSqlBuilder.Instance.CheckQuotationMark(sOPGuid, true); } } else if (sOrgSort.Length == 12) { if (sOPGuid != "") { strWhereSql += " AND UOL.OP_GUID = " + TSqlBuilder.Instance.CheckQuotationMark(sOPGuid, true); } if (sAppGuid != "") { strWhereSql += " AND UOL.APP_GUID = " + TSqlBuilder.Instance.CheckQuotationMark(sAppGuid, true); } } return(strWhereSql); }