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); }
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); } }
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); } }
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); }