public static EmailRejected GetInstance()
 {
     if (_EmailRejected == null)
     {
         _EmailRejected = new EmailRejected();
     }
     return(_EmailRejected);
 }
        /// <summary>
        /// Receives the email events from commands.
        /// </summary>
        /// <param name="emailData">The email data.</param>
        public void ReceiveEmailEventsFromCommands(IXNCustomData emailData)
        {
            try
            {
                switch (emailData.EventName)
                {
                case "ToasterInteractionEmailAccept":
                    GetEmailData(emailData.InteractionId, emailData);
                    if (Settings.SFDCListener.EmailActivityIdCollection.Keys.Contains(emailData.InteractionId))
                    {
                        if (Settings.SFDCOptions.EmailAttachActivityId)
                        {
                            Settings.SFDCListener.SetAttachedData(emailData.InteractionId, Settings.SFDCOptions.EmailAttachActivityIdKeyname, Settings.SFDCListener.EmailActivityIdCollection[emailData.InteractionId], Settings.EmailProxyClientId);
                            Settings.SFDCListener.EmailActivityIdCollection.Remove(emailData.InteractionId);
                        }
                    }
                    EmailConnected.GetInstance().PopupRecords(emailData, SFDCCallType.InboundEmail);
                    return;

                case "ToasterInteractionEmailDecline":
                    GetEmailData(emailData.InteractionId, emailData);
                    EmailRejected.GetInstance().UpdateRecords(emailData, emailData.InteractionType);
                    return;

                case "InteractionMarkDone":    //InteractionEmailWorkflow"://mark done
                    GetEmailData(emailData.InteractionId, emailData);
                    EmailMarkDone.GetInstance().UpdateRecords(emailData, emailData.InteractionType);
                    return;

                case "InteractionEmailMoveToWorkbin":
                    GetEmailData(emailData.InteractionId, emailData);
                    EmailMoveToWorkbin.GetInstance().UpdateRecords(emailData, emailData.InteractionType);
                    return;

                case "InteractionEmailReply":
                case "InteractionEmailReplyById":
                    GetEmailData(emailData.InteractionId, emailData);
                    EmailReply.GetInstance().PopupRecords(emailData, emailData.InteractionType);
                    return;

                case "InteractionEmailSend":
                    emailData.InteractionType = SFDCCallType.OutboundEmailSuccess;
                    GetEmailData(emailData.InteractionId, emailData);
                    EmailSend.GetInstance().PopupRecords(emailData, SFDCCallType.OutboundEmailSuccess);
                    return;

                case "InteractionEmailDelete":
                    if (emailData.InteractionId != null)
                    {
                        emailData.InteractionType = SFDCCallType.OutboundEmailSuccess;
                        GetEmailData(emailData.InteractionId, emailData);
                        EmailDelete.GetInstance().UpdateRecords(emailData, SFDCCallType.OutboundEmailSuccess);
                    }
                    return;

                case "InteractionEmailDeleteById":
                    if (emailData.InteractionId != null)
                    {
                        emailData.InteractionType = SFDCCallType.OutboundEmailSuccess;
                        GetEmailData(emailData.InteractionId, emailData);
                        EmailDelete.GetInstance().UpdateRecords(emailData, SFDCCallType.OutboundEmailSuccess);
                    }
                    return;

                default:
                    _logger.Info("Event skip :" + emailData.EventName);
                    break;
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Error Occurred, Exception :" + generalException.ToString());
            }
        }