public void NotifySuppliersTest()
        {
            controller.NotifySuppliers(client.Id);
            var objectType = AuditRecord.GetLogObjectType(client);
            var audit      = session.Query <AuditRecord>().Where(a => a.ObjectId == client.Id && a.Type == objectType).ToList();

            Assert.IsTrue(audit.Any(a => a.Message.Contains("Разослано повторное уведомление о регистрации клиента")));
        }
Example #2
0
        public IList <AuditRecord> Execute(User user, ISession session)
        {
            var objectType  = AuditRecord.GetLogObjectType(user);
            var serviceType = AuditRecord.GetLogObjectType(user.RootService);
            var userAudit   = session.Query <AuditRecord>()
                              .Where(l => (l.ObjectId == user.Id && l.Type == objectType) || (l.ObjectId == user.RootService.Id && l.Type == serviceType))
                              .Where(l => Types.Contains(l.MessageType))
                              .OrderByDescending(l => l.WriteTime)
                              .Fetch(l => l.Administrator)
                              .ToList();

            return(userAudit.Concat(
                       ForPayer(user.Payer, session)
                       .Where(u => !(u.ShowOnlyPayer && u.Type == LogObjectType.User && u.ObjectId == user.Id)))
                   .OrderByDescending(o => o.WriteTime)
                   .ToList());
        }