Ejemplo n.º 1
0
        public bool ShouldBeSent(ReportCollection ticket)
        {
            if (!_TicketStati.Contains(ticket.ticket))
                return true;

            var status = _TicketStati[ticket.ticket];

            return status.LevelSent.LessThan(ticket.level) || status.DateSent < DateTime.Now.Date;
        }
Ejemplo n.º 2
0
 public AlertTemplate(ReportCollection ticket)
 {
     if (!ticket.level.GreaterThan(Level.Report))
         throw new ArgumentOutOfRangeException("Livello del ticket deve essere superiore a Report")
         {
             Data = { { "ticket", ticket } }
         };
     else
         Ticket = ticket;
 }
Ejemplo n.º 3
0
 public void RegisterSent(ReportCollection ticket)
 {
     _TicketStati.Remove(ticket.ticket);
     _TicketStati.Add(new TicketStatus(ticket.ticket, DateTime.Now.Date, ticket.level));
 }
Ejemplo n.º 4
0
        static MailAddressCollection To(ReportCollection ticket)
        {
            var result = new MailAddressCollection();

            switch(ticket.level)
            {
                case Level.TL_Owner:
                    result.Add(ticket.inCaricoA.Mail);
                    break;

                case Level.TeamGroup:
                    foreach (var mail in ContactsList.FindByGroupName(ticket.inCaricoA.Gruppo).Select(x => x.Mail).Distinct())
                        result.Add(mail);
                    break;

                case Level.CanoneGroup:
                    foreach (var mail in ContactsList.Users.Select(x => x.Mail).Distinct())
                        result.Add(mail);
                    break;

                case Level.Scaduto:
                    foreach (var mail in ContactsList.Users.Where(x => x.Ruolo == "TL").Select(x => x.Mail).Distinct())
                        result.Add(mail);
                    break;

                case Level.Report: throw new ArgumentOutOfRangeException("Livello del ticket deve essere superiore a Report")
                {
                    Data = { { "ticket", ticket } }
                };

                default: throw new ArgumentOutOfRangeException("Livello ticket non gestito")
                {
                    Data = { { "level", ticket.level } }
                };
            }

            return result;
        }
Ejemplo n.º 5
0
        static string Subject(ReportCollection ticket)
        {
            string template;
            switch(ticket.level)
            {
                case Level.TL_Owner: template = "[Avviso] Ticket '{0}' in scadenza"; break;
                case Level.TeamGroup: template = "[Urgente] Ticket '{0}' prossimo alla scadenza"; break;
                case Level.CanoneGroup: template = "[Urgente] Ticket '{0}' di imminente scadenza"; break;
                case Level.Scaduto: template = "[Reminder] Ticket '{0}' scaduto"; break;

                case Level.Report: throw new ArgumentOutOfRangeException("Livello del ticket deve essere superiore a Report")
                {
                    Data = { { "ticket", ticket } }
                };

                default: throw new ArgumentOutOfRangeException("Livello ticket non gestito")
                {
                    Data = { { "level", ticket.level } }
                };
            }

            return String.Format(template, ticket.ticket);
        }