コード例 #1
0
ファイル: AlertSender.cs プロジェクト: fra9001/TicketReminder
        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;
        }
コード例 #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;
 }
コード例 #3
0
ファイル: AlertSender.cs プロジェクト: fra9001/TicketReminder
 public void RegisterSent(ReportCollection ticket)
 {
     _TicketStati.Remove(ticket.ticket);
     _TicketStati.Add(new TicketStatus(ticket.ticket, DateTime.Now.Date, ticket.level));
 }
コード例 #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;
        }
コード例 #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);
        }