///<summary>Creates security log entries for all that PatNums passed in.</summary> public static void MakeLogEntry(Permissions permType, List <long> listPatNums, string logText) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), permType, listPatNums, logText); return; } List <SecurityLog> listSecLogs = new List <SecurityLog>(); foreach (long patNum in listPatNums) { SecurityLog secLog = MakeLogEntryNoInsert(permType, patNum, logText, 0); SecurityLogs.Insert(secLog); listSecLogs.Add(secLog); } List <SecurityLogHash> listHash = new List <SecurityLogHash>(); List <EntryLog> listEntries = new List <EntryLog>(); listSecLogs = SecurityLogs.GetMany(SQLWhere.CreateIn(nameof(SecurityLog.SecurityLogNum), listSecLogs.Select(x => x.SecurityLogNum).ToList())); foreach (SecurityLog log in listSecLogs) { SecurityLogHash secLogHash = new SecurityLogHash(); secLogHash.SecurityLogNum = log.SecurityLogNum; secLogHash.LogHash = SecurityLogHashes.GetHashString(log); listHash.Add(secLogHash); if (log.PermType == Permissions.AppointmentCreate) { listEntries.Add(new EntryLog(log.UserNum, EntryLogFKeyType.Appointment, log.FKey, log.LogSource)); } } EntryLogs.InsertMany(listEntries); SecurityLogHashes.InsertMany(listHash); }
///<summary>PatNum can be 0.</summary> public static void MakeLogEntry(Permissions permType, long patNum, string logText) { //No need to check RemotingRole; no call to db. SecurityLog securityLog = new SecurityLog(); securityLog.PermType = permType; securityLog.UserNum = Security.CurUser.UserNum; securityLog.LogText = logText; //"From: "+Environment.MachineName+" - "+logText; securityLog.CompName = Environment.MachineName; securityLog.PatNum = patNum; SecurityLogs.Insert(securityLog); }
///<summary>Take a SecurityLog object to save to the database. Creates a SecurityLogHash object as well.</summary> public static void MakeLogEntry(SecurityLog secLog) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), secLog); return; } secLog.SecurityLogNum = SecurityLogs.Insert(secLog); SecurityLogHashes.InsertSecurityLogHash(secLog.SecurityLogNum); //uses db date/time if (secLog.PermType == Permissions.AppointmentCreate) { EntryLogs.Insert(new EntryLog(secLog.UserNum, EntryLogFKeyType.Appointment, secLog.FKey, secLog.LogSource)); } }
///<summary>Takes a foreign key to a table associated with that PermType. PatNum can be 0.</summary> public static void MakeLogEntry(Permissions permType, long patNum, string logText, long fKey) { //No need to check RemotingRole; no call to db. SecurityLog securityLog = new SecurityLog(); securityLog.PermType = permType; if (Security.CurUser != null) //if this is generated by Patient Portal web service then we won't have a CurUser set { securityLog.UserNum = Security.CurUser.UserNum; } securityLog.LogText = logText; //"From: "+Environment.MachineName+" - "+logText; securityLog.CompName = Environment.MachineName; securityLog.PatNum = patNum; securityLog.FKey = fKey; securityLog.SecurityLogNum = SecurityLogs.Insert(securityLog); //Create a hash of the security log. SecurityLogHashes.InsertSecurityLogHash(securityLog.SecurityLogNum); //uses db date/time }