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