コード例 #1
0
        ///<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);
        }