示例#1
0
    public void addSecurityLog(string sUserID, SecurityLogTypes LogType, SecurityLogActions Action, acObjectTypes ObjectType,
                               string ObjectID, string LogMessage, ref string sErr)
    {
        string sSQL        = null;
        string sTrimmedLog = LogMessage.Replace("'", "''").Trim();

        if (!string.IsNullOrEmpty(sTrimmedLog))
        {
            if (sTrimmedLog.Length > 7999)
            {
                sTrimmedLog = sTrimmedLog.Substring(0, 7998);
            }
        }

        sSQL = "insert into user_security_log (log_type, action, user_id, log_dt, object_type, object_id, log_msg)" +
               " values (" +
               "'" + LogType.ToString() + "'," +
               "'" + Action.ToString() + "'," +
               "'" + sUserID + "'," +
               "now()," + Convert.ToString((ObjectType == acObjectTypes.None ? "NULL" : ((int)ObjectType).ToString())) + "," +
               Convert.ToString((string.IsNullOrEmpty(ObjectID) ? "NULL" : "'" + ObjectID + "'")) + "," +
               "'" + sTrimmedLog + "'" +
               ")";

        sqlExecuteUpdate(sSQL, ref sErr);
    }
示例#2
0
文件: dataAccess.cs 项目: you8/cato
    public void addSecurityLog(string sUserID, SecurityLogTypes LogType, SecurityLogActions Action, acObjectTypes ObjectType, string ObjectID, string LogMessage, ref string sErr, ref acTransaction oTrans)
    {
        string sSQL = null;
        string sTrimmedLog = LogMessage.Replace("'", "''").Trim();
        if (!string.IsNullOrEmpty(sTrimmedLog))
            if (sTrimmedLog.Length > 7999)
                sTrimmedLog = sTrimmedLog.Substring(0, 7998);

        sSQL = "insert into user_security_log (log_type, action, user_id, log_dt, object_type, object_id, log_msg)" +
            " values (" +
            "'" + LogType.ToString() + "'," +
            "'" + Action.ToString() + "'," +
            "'" + sUserID + "'," +
            "now()," + Convert.ToString((ObjectType == acObjectTypes.None ? "NULL" : ((int)ObjectType).ToString())) + "," +
            Convert.ToString((string.IsNullOrEmpty(ObjectID) ? "NULL" : "'" + ObjectID + "'")) + "," +
            "'" + sTrimmedLog + "'" +
            ")";

        if (oTrans == null)
        {
            //not in a transaction
            sqlExecuteUpdate(sSQL, ref sErr);
        }
        else
        {
            //use the provided transaction
            oTrans.Command.CommandText = sSQL;

            //if it fails, it will set the error flag
            oTrans.ExecUpdate(ref sErr);
        }
    }
示例#3
0
    public void addSecurityLog(string sUserID, SecurityLogTypes LogType, SecurityLogActions Action, acObjectTypes ObjectType, string ObjectID, string LogMessage, ref string sErr, ref acTransaction oTrans)
    {
        string sSQL        = null;
        string sTrimmedLog = LogMessage.Replace("'", "''").Trim();

        if (!string.IsNullOrEmpty(sTrimmedLog))
        {
            if (sTrimmedLog.Length > 7999)
            {
                sTrimmedLog = sTrimmedLog.Substring(0, 7998);
            }
        }

        sSQL = "insert into user_security_log (log_type, action, user_id, log_dt, object_type, object_id, log_msg)" +
               " values (" +
               "'" + LogType.ToString() + "'," +
               "'" + Action.ToString() + "'," +
               "'" + sUserID + "'," +
               "now()," + Convert.ToString((ObjectType == acObjectTypes.None ? "NULL" : ((int)ObjectType).ToString())) + "," +
               Convert.ToString((string.IsNullOrEmpty(ObjectID) ? "NULL" : "'" + ObjectID + "'")) + "," +
               "'" + sTrimmedLog + "'" +
               ")";

        if (oTrans == null)
        {
            //not in a transaction
            sqlExecuteUpdate(sSQL, ref sErr);
        }
        else
        {
            //use the provided transaction
            oTrans.Command.CommandText = sSQL;

            //if it fails, it will set the error flag
            oTrans.ExecUpdate(ref sErr);
        }
    }
示例#4
0
文件: dataAccess.cs 项目: you8/cato
    public void addSecurityLog(string sUserID, SecurityLogTypes LogType, SecurityLogActions Action, acObjectTypes ObjectType,
        string ObjectID, string LogMessage, ref  string sErr)
    {
        string sSQL = null;
        string sTrimmedLog = LogMessage.Replace("'", "''").Trim();
        if (!string.IsNullOrEmpty(sTrimmedLog))
            if (sTrimmedLog.Length > 7999)
                sTrimmedLog = sTrimmedLog.Substring(0, 7998);

        sSQL = "insert into user_security_log (log_type, action, user_id, log_dt, object_type, object_id, log_msg)" +
            " values (" +
            "'" + LogType.ToString() + "'," +
            "'" + Action.ToString() + "'," +
            "'" + sUserID + "'," +
            "now()," + Convert.ToString((ObjectType == acObjectTypes.None ? "NULL" : ((int)ObjectType).ToString())) + "," +
            Convert.ToString((string.IsNullOrEmpty(ObjectID) ? "NULL" : "'" + ObjectID + "'")) + "," +
            "'" + sTrimmedLog + "'" +
            ")";

        sqlExecuteUpdate(sSQL, ref sErr);
    }