/// <summary>
        /// Explicit algorithm for trying to handle an error ticket.
        /// </summary>
        public override void TryHandleTicket(ErrorTicket ticket)
        {
            bool handled = false;

            // 1) Try local support
            if (!handled)
            {
                handled = _localSupport.TryHandle(ticket);
            }

            // 2) Try national support
            if (!handled)
            {
                handled = _nationalSupport.TryHandle(ticket);
            }

            // 3) Try regional support (must translate ticket to English first)
            if (!handled)
            {
                _translatorService.TranslateToEnglish(ticket);
                handled = _regionalSupport.TryHandle(ticket);
            }

            // 4) Try world support (ticket has already been translated)
            if (!handled)
            {
                handled = _worldSupport.TryHandle(ticket);
            }

            // 5) If all else fails, add to unhandled ticket list
            if (!handled)
            {
                UnhandledTickets.Add(ticket);
            }
        }
Example #2
0
        public override void TryHandleTicket(ErrorTicket ticket)
        {
            if (_handler == null)
            {
                throw new ArgumentException("SupportCenterCoR::TryHandleTicket -> Handler not set!");
            }

            _handler.Handle(ticket);
        }
Example #3
0
        /// <summary>
        /// Try to handle all open tickets. After calling this method, it should hold that:
        /// 1) No tickets are in the Open list
        /// 2) Tickets successfully handled are in the Closed list
        /// 3) Tickets unsuccessfully handled are in the Unhandled list
        /// </summary>
        public void HandleOpenTickets()
        {
            while (OpenTicketCount > 0)
            {
                // Take a ticket from the list
                ErrorTicket ticket = OpenTickets[OpenTicketCount - 1];
                OpenTickets.RemoveAt(OpenTicketCount - 1);

                // Try to handle it
                TryHandleTicket(ticket);
            }
        }
Example #4
0
        /// <summary>
        /// General algorithm for trying to handle a single error ticket.
        /// If a ticket can be handled, it is set to Solved, and placed
        /// in the list of Closed error tickets.
        /// </summary>
        public bool TryHandle(ErrorTicket ticket)
        {
            bool canHandle = CanHandle(ticket);

            if (canHandle)
            {
                ticket.Level = ErrorLevel.Solved;
                _supportCenter.ClosedTickets.Add(ticket);
            }

            return(canHandle);
        }
Example #5
0
 /// <summary>
 /// General algorithm for how a support handler class
 /// handles an error ticket.
 /// </summary>
 public virtual void Handle(ErrorTicket ticket)
 {
     // First try to handle the ticket, by calling (abstract) TryHandle
     if (!TryHandle(ticket))
     {
         // TryHandle failed, try to forward ticket
         if (CanForward(ticket))
         {
             Forward(ticket);
         }
         else
         {
             UnhandledAction(ticket);
         }
     }
 }
Example #6
0
 /// <summary>
 /// Defines response to not being able to handle the ticket.
 /// Can be overrided in derived classes.
 /// </summary>
 public virtual void UnhandledAction(ErrorTicket ticket)
 {
     throw new ArgumentException($"SupportHandlerBase::Handle -> Could not handle ticket: {ticket}");
 }
Example #7
0
 /// <summary>
 /// Specific algorithms for trying to handle a ticket
 /// must be defined in derived classes.
 /// </summary>
 public abstract bool TryHandle(ErrorTicket ticket);
Example #8
0
 /// <summary>
 /// Forward the ticket down the CoR
 /// </summary>
 public void Forward(ErrorTicket ticket)
 {
     _nextHandler?.Handle(ticket);
 }
Example #9
0
 /// <summary>
 /// Ticket can be forwarded if another handler
 /// is available down the CoR.
 /// </summary>
 public bool CanForward(ErrorTicket ticket)
 {
     return(_nextHandler != null);
 }
 public void UnhandledAction(ErrorTicket ticket)
 {
     // Intentionally blank, cannot happen
 }
 // Not used, since we are overriding Handle
 public override bool TryHandle(ErrorTicket ticket)
 {
     return(false);
 }
Example #12
0
 /// <summary>
 /// Submit a single error ticket, which will be placed
 /// in the list of Open tickets.
 /// </summary>
 public void SubmitTicket(ErrorTicket ticket)
 {
     _openTickets.Add(ticket);
 }
Example #13
0
 /// <summary>
 /// Specific Support Center classes need to define a specific
 /// algorithm for how to handle an error ticket.
 /// </summary>
 public abstract void TryHandleTicket(ErrorTicket ticket);
Example #14
0
 /// <summary>
 /// Specific support classes need to define specific
 /// criteria for being able to handle an error ticket.
 /// </summary>
 public abstract bool CanHandle(ErrorTicket ticket);
Example #15
0
 /// <summary>
 /// National support must handle tickets with
 /// 1) Level: Moderate
 /// 2) Any language
 /// </summary>
 public override bool CanHandle(ErrorTicket ticket)
 {
     return(ticket.Level == ErrorLevel.Moderate);
 }
 public bool CanForward(ErrorTicket ticket)
 {
     return(false);
 }
Example #17
0
 /// <summary>
 /// Local support must handle tickets with
 /// 1) Level: Light
 /// 2) Any language
 /// </summary>
 public override bool CanHandle(ErrorTicket ticket)
 {
     return(ticket.Level == ErrorLevel.Light);
 }
Example #18
0
 /// <summary>
 /// Simulate a translation to English.
 /// </summary>
 public void TranslateToEnglish(ErrorTicket ticket)
 {
     ticket.Language = ErrorLanguage.English;
 }
 public override void Handle(ErrorTicket ticket)
 {
     // Translate the incoming ticket, and forward it unconditionally.
     _translatorService.TranslateToEnglish(ticket);
     Forward(ticket);
 }
 public void Handle(ErrorTicket ticket)
 {
     _supportCenter.UnhandledTickets.Add(ticket);
 }
Example #21
0
 /// <summary>
 /// World support must handle tickets with
 /// 1) Level: Catastrophic
 /// 2) English language
 /// </summary>
 public override bool CanHandle(ErrorTicket ticket)
 {
     return((ticket.Level == ErrorLevel.Catastrophic) && (ticket.Language == ErrorLanguage.English));
 }
 public void Forward(ErrorTicket ticket)
 {
     // Intentionally blank, cannot happen
 }
 /// <summary>
 /// Try to handle ticket by delegating to ISupport implementation.
 /// </summary>
 public override bool TryHandle(ErrorTicket ticket)
 {
     return(_actualHandler.TryHandle(ticket));
 }
 public override bool CanHandle(ErrorTicket ticket)
 {
     return(true);
 }