public void ReceiveEmailEvents(IMessage events) { try { if ((Settings.SFDCOptions.SFDCPopupPages != null) && (events != null)) { this._logger.Info("Agent Email Event : " + events.Name); switch (events.Id) { case EventInvite.MessageId: this._eventInvite = (EventInvite)events; Settings.EmailProxyClientId = _eventInvite.ProxyClientId; IXNCustomData emailInviteData = new IXNCustomData(); emailInviteData.InteractionId = this._eventInvite.Interaction.InteractionId; emailInviteData.OpenMediaInteraction = this._eventInvite.Interaction; emailInviteData.UserData = this._eventInvite.Interaction.InteractionUserData; GetEmailData(emailInviteData.InteractionId, emailInviteData); EmailInvite.GetInstance().PopupRecords(emailInviteData, emailInviteData.InteractionType); if ((this._eventInvite.VisibilityMode.ToString() != "Coach") && (this._eventInvite.VisibilityMode.ToString() != "Conference")) { } break; case EventPulledInteractions.MessageId: this._eventPulledInteractions = (EventPulledInteractions)events; if (this._eventPulledInteractions.Interactions.Count == 1) { string str = this._eventPulledInteractions.Interactions.AllKeys.GetValue(0).ToString(); object[] kvc = this._eventPulledInteractions.Interactions.GetValues(str); KeyValueCollection collection = (KeyValueCollection)kvc[0]; IXNCustomData emailPulledData = new IXNCustomData(); emailPulledData.InteractionId = collection["InteractionId"].ToString(); GetEmailData(emailPulledData.InteractionId, emailPulledData); if (emailPulledData.IXN_Attributes.TypeId == "Inbound") { emailPulledData.InteractionType = SFDCCallType.InboundEmailPulled; } else if (emailPulledData.IXN_Attributes.TypeId == "Outbound") { emailPulledData.InteractionType = SFDCCallType.OutboundEmailPulled; } EmailPulled.GetInstance().PopupRecords(emailPulledData, emailPulledData.InteractionType); } break; case EventAck.MessageId: this._eventAck = (EventAck)events; if (_eventAck.Extension != null && _eventAck.Extension.ContainsKey("InteractionId") && _eventAck.Extension["InteractionId"] != null) { string type = GetEmailInteractionContent(_eventAck.Extension["InteractionId"].ToString(), "type"); if (type.Equals("OutboundNew")) { string ToAddress = GetEmailInteractionContent(_eventAck.Extension["InteractionId"].ToString(), "to"); if (!String.IsNullOrEmpty(ToAddress)) { IXNCustomData emailAckData = new IXNCustomData(); emailAckData.InteractionType = SFDCCallType.OutboundEmailSuccess; emailAckData.InteractionId = _eventAck.Extension["InteractionId"].ToString(); GetEmailData(emailAckData.InteractionId, emailAckData); if (IsClick2Email && SFDCHttpServer._emailData.ContainsKey(ToAddress)) { Settings.ClickToEmailData.Add(_eventAck.Extension["InteractionId"].ToString(), SFDCHttpServer._emailData[ToAddress]); EmailManager.GetInstance().GetClickToEmailLogs(emailAckData, _eventAck.Extension["InteractionId"].ToString(), SFDCCallType.OutboundEmailSuccess, SFDCHttpServer._emailData[ToAddress], "create"); IsClick2Email = false; } else { EmailCreate.GetInstance().PopupRecords(emailAckData, SFDCCallType.OutboundEmailSuccess); } } else { this._logger.Warn("ReceiveEmailEvents : ToAddress is not found in EventAck"); } } else if (type.Equals("OutboundReply")) { string ToAddress = GetEmailInteractionContent(_eventAck.Extension["InteractionId"].ToString(), "to"); if (!String.IsNullOrEmpty(ToAddress)) { IXNCustomData outEmailData = new IXNCustomData(); outEmailData.InteractionType = SFDCCallType.OutboundEmailSuccess; outEmailData.InteractionId = _eventAck.Extension["InteractionId"].ToString(); GetEmailData(outEmailData.InteractionId, outEmailData); if (IsClick2Email && SFDCHttpServer._emailData.ContainsKey(ToAddress)) { Settings.ClickToEmailData.Add(_eventAck.Extension["InteractionId"].ToString(), SFDCHttpServer._emailData[ToAddress]); EmailManager.GetInstance().GetClickToEmailLogs(outEmailData, _eventAck.Extension["InteractionId"].ToString(), SFDCCallType.OutboundEmailSuccess, SFDCHttpServer._emailData[ToAddress], "create"); IsClick2Email = false; } else { EmailCreate.GetInstance().PopupRecords(outEmailData, SFDCCallType.OutboundEmailSuccess); } } else { this._logger.Warn("ReceiveEmailEvents : ToAddress is not found in EventAck"); } } } break; } } } catch (Exception exception) { this._logger.Error("ReceiveEmailEvents : Error occured while receiving Email events " + exception.ToString()); } }
/// <summary> /// Notifies the email interaction. /// </summary> /// <param name="message">The message.</param> public void NotifyEmailInteraction(Genesyslab.Platform.Commons.Protocols.IMessage message) { try { switch (message.Id) { case EventInvite.MessageId: // Newly Added // Start CheckAutoAnswer(message as EventInvite); // Stop //Old Code // Start // EventInvite eventInvite = message as EventInvite; //if (ConfigContainer.Instance().AllKeys.Contains("email.enable.auto-answer") // && ((string)ConfigContainer.Instance().GetValue("email.enable.auto-answer")).ToLower().Equals("true")) //{ // //EmailNotifier.needPerformAccept = true; // _taskbarNotifier.eventInvite = eventInvite; // _taskbarNotifier.ReadContactName(); // _taskbarNotifier.DoEmailAccept(); //} //else // ShowEmailNotifier(eventInvite); // Stop break; case EventRevoked.MessageId: EventRevoked eventRevoked = message as EventRevoked; if (_taskbarNotifier != null) { _taskbarNotifier.BindInfo(eventRevoked); } break; case EventAck.MessageId: EventAck eventAck = message as EventAck; break; case EventPulledInteractions.MessageId: EventPulledInteractions puledIteraction = message as EventPulledInteractions; if (puledIteraction.Interactions != null && puledIteraction.Interactions.Count > 0) { string[] keys = puledIteraction.Interactions.AllKeys; var _interactionID = keys[0]; if (_interactionID != null) { EmailMainWindow mailWindow = new EmailMainWindow(puledIteraction); mailWindow.Show(); } } break; } } catch (Exception exception) { logger.Error("NotifyEmailInteraction" + exception.ToString()); } }