Ejemplo n.º 1
0
        /// <summary>
        /// Gets the Inbound Popup Data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public SFDCData GetInboundPopupData(IXNCustomData chatPopupData, SFDCCallType callType, string eventName)
        {
            SFDCData sfdcData = new SFDCData();

            try
            {
                _logger.Info("Reading inbound chat popup data....");
                if (this._popupPages != null)
                {
                    bool IsCurrentEventEnabled = false;
                    if (Settings.SFDCOptions.CanUseCommonSearchForChat)
                    {
                        if (Settings.SFDCOptions.ChatInboutPopupEvent != null && Settings.SFDCOptions.ChatInboutPopupEvent.Contains(eventName))
                        {
                            IsCurrentEventEnabled          = true;
                            sfdcData.CommonSearchData      = GetChatCommonSearchData(chatPopupData, callType);
                            sfdcData.CommonPopupObjects    = Settings.CommonPopupObjects;
                            sfdcData.CommonSearchFormats   = Settings.SFDCOptions.PhoneNumberSearchFormat;
                            sfdcData.CommonSearchCondition = Settings.SFDCOptions.CommonSearchConditionForChat;
                            if (this._userActivityLog != null)
                            {
                                sfdcData.ProfileActivityLogData = this._sFDCUtility.GetCreateActivityLogData(this._userActivityLog, null, callType, emailData: chatPopupData);
                            }
                        }
                        else
                        {
                            return(null);
                        }
                    }
                    foreach (string key in this._popupPages)
                    {
                        switch (key)
                        {
                        case "lead":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.LeadData = SFDCLead.GetInstance().GetLeadChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            else if (this._leadOptions != null && this._leadOptions.InboundPopupEvent != null && this._leadOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.LeadData = SFDCLead.GetInstance().GetLeadChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        case "contact":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.ContactData = SFDCContact.GetInstance().GetContactChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            else if (this._contactOptions != null && this._contactOptions.InboundPopupEvent != null && this._contactOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.ContactData = SFDCContact.GetInstance().GetContactChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        case "account":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.AccountData = SFDCAccount.GetInstance().GetAccountChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            else if (this._accountOptions != null && this._accountOptions.InboundPopupEvent != null && this._accountOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.AccountData = SFDCAccount.GetInstance().GetAccountChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        case "case":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.CaseData = SFDCCase.GetInstance().GetCaseChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            if (this._caseOptions != null && this._caseOptions.InboundPopupEvent != null && this._caseOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.CaseData = SFDCCase.GetInstance().GetCaseChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        case "opportunity":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.OpportunityData = SFDCOpportunity.GetInstance().GetOpportunityChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            else if (this._opportunityOptions != null && this._opportunityOptions.InboundPopupEvent != null && this._opportunityOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.OpportunityData = SFDCOpportunity.GetInstance().GetOpportunityChatPopupData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        case "useractivity":
                            if (IsCurrentEventEnabled)
                            {
                                sfdcData.UserActivityData = SFDCUserActivity.GetInstance().GetChatCreateUserAcitivityData(chatPopupData, chatPopupData.InteractionType);
                            }
                            else if (this._userActivityOptions != null && this._userActivityOptions.InboundPopupEvent != null && this._userActivityOptions.InboundPopupEvent.Equals(eventName))
                            {
                                sfdcData.UserActivityData = SFDCUserActivity.GetInstance().GetChatCreateUserAcitivityData(chatPopupData, chatPopupData.InteractionType);
                            }
                            break;

                        default:
                            if (this._customObjectOptions != null)
                            {
                                if (IsCurrentEventEnabled && this._customObjectOptions.ContainsKey(key))
                                {
                                    CustomObjectData cstobject = SFDCCustomObject.GetInstance().GetCustomObjectChatPopupData(chatPopupData, chatPopupData.InteractionType, key);
                                    if (cstobject != null)
                                    {
                                        this._tempCustomObject.Add(cstobject);
                                    }
                                }
                                else if (this._customObjectOptions[key] != null && this._customObjectOptions[key].InboundPopupEvent != null &&
                                         this._customObjectOptions[key].InboundPopupEvent.Equals(eventName))
                                {
                                    CustomObjectData cstobject = SFDCCustomObject.GetInstance().GetCustomObjectChatPopupData(chatPopupData, chatPopupData.InteractionType, key);
                                    if (cstobject != null)
                                    {
                                        this._tempCustomObject.Add(cstobject);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    if (this._tempCustomObject.Count > 0)
                    {
                        CustomObjectData[] temp = this._tempCustomObject.ToArray();
                        sfdcData.CustomObjectData = temp;
                        this._tempCustomObject.Clear();
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("GetInboundPopupData : Error Occurred While Getting Inbound Popup Data : " + generalException.ToString());
            }
            return(sfdcData);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the Chat Consult Update data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <param name="callDuration"></param>
        /// <param name="chatContent"></param>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public SFDCData GetConsultUpdateData(IMessage message, SFDCCallType callType, string callDuration, string chatContent, string eventName)
        {
            SFDCData sfdcData = new SFDCData();

            try
            {
                logger.Info("GetConsultUpdateData : Getting lead Consult update data");
                if (this.PopupPages != null)
                {
                    foreach (string key in this.PopupPages)
                    {
                        switch (key)
                        {
                        case "lead":
                            if (this.leadOptions != null && this.leadOptions.ConsultUpdateEvent != null && this.leadOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading lead popup data");
                                sfdcData.LeadData = SFDCLead.GetInstance().GetLeadChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "contact":
                            if (this.contactOptions != null && this.contactOptions.ConsultUpdateEvent != null && this.contactOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading contact popup data");
                                sfdcData.ContactData = SFDCContact.GetInstance().GetContactChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "account":
                            if (this.accountOptions != null && this.accountOptions.ConsultUpdateEvent != null && this.accountOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading account popup data");
                                sfdcData.AccountData = SFDCAccount.GetInstance().GetAccountChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "case":
                            if (this.caseOptions != null && this.caseOptions.ConsultUpdateEvent != null && this.caseOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading case popup data");
                                sfdcData.CaseData = SFDCCase.GetInstance().GetCaseChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "opportunity":
                            if (this.opportunityOptions != null && this.opportunityOptions.ConsultUpdateEvent != null && this.opportunityOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading opportunity popup data");
                                sfdcData.OpportunityData = SFDCOpportunity.GetInstance().GetOpportunityChatUpdateData(message, callType, callDuration, chatContent);
                            }
                            break;

                        case "useractivity":
                            if (this.userActivityOptions != null && this.userActivityOptions.ConsultUpdateEvent != null &&
                                this.userActivityOptions.ConsultUpdateEvent.Contains(eventName))
                            {
                                logger.Info("GetConsultUpdateData : Reading useractivity popup data");
                                sfdcData.UserActivityData = SFDCUserActivity.GetInstance().GetChatUpdateUserAcitivityData(message, callType, callDuration, chatContent);
                            }
                            break;

                        default:
                            if (this.customObjectOptions.ContainsKey(key))
                            {
                                if (this.customObjectOptions[key] != null && this.customObjectOptions[key].ConsultUpdateEvent != null &&
                                    this.customObjectOptions[key].ConsultUpdateEvent.Contains(eventName))
                                {
                                    ICustomObject cstobject = SFDCCustomObject.GetInstance().GetCustomObjectChatUpdateData(message, callType, callDuration, chatContent, key);
                                    if (cstobject != null)
                                    {
                                        logger.Info("GetConsultUpdateData : Reading customObject popup data");
                                        this.tempCustomObject.Add(cstobject);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    if (this.tempCustomObject.Count > 0)
                    {
                        ICustomObject[] temp = this.tempCustomObject.ToArray();
                        sfdcData.CustomObjectData = temp;
                        this.tempCustomObject.Clear();
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("GetConsultUpdateData : Error Occurred while collecting Consult Update data : " + generalException.ToString());
            }
            return(sfdcData);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the inbound update data.
        /// </summary>
        /// <param name="chatData">The chat data.</param>
        /// <param name="eventName">Name of the event.</param>
        /// <returns></returns>
        public SFDCData GetInboundUpdateData(IXNCustomData chatData, string eventName)
        {
            SFDCData sfdcData = new SFDCData();

            try
            {
                _logger.Info("GetInboundUpdateData : Getting Inbound Update Data");
                if (this._popupPages != null)
                {
                    foreach (string key in this._popupPages)
                    {
                        switch (key)
                        {
                        case "lead":
                            if (this._leadOptions != null && this._leadOptions.InboundUpdateEvent != null && this._leadOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading Lead popup data");
                                sfdcData.LeadData = SFDCLead.GetInstance().GetLeadChatUpdateData(chatData, eventName);
                            }
                            break;

                        case "contact":
                            if (this._contactOptions != null && this._contactOptions.InboundUpdateEvent != null && this._contactOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading contact popup data");
                                sfdcData.ContactData = SFDCContact.GetInstance().GetContactChatUpdateData(chatData, eventName);
                            }
                            break;

                        case "account":
                            if (this._accountOptions != null && this._accountOptions.InboundUpdateEvent != null && this._accountOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading account popup data");
                                sfdcData.AccountData = SFDCAccount.GetInstance().GetAccountChatUpdateData(chatData, eventName);
                            }
                            break;

                        case "case":
                            if (this._caseOptions != null && this._caseOptions.InboundUpdateEvent != null && this._caseOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading case popup data");
                                sfdcData.CaseData = SFDCCase.GetInstance().GetCaseChatUpdateData(chatData, eventName);
                            }
                            break;

                        case "opportunity":
                            if (this._opportunityOptions != null && this._opportunityOptions.InboundUpdateEvent != null && this._opportunityOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading opportunity popup data");
                                sfdcData.OpportunityData = SFDCOpportunity.GetInstance().GetOpportunityChatUpdateData(chatData, eventName);
                            }
                            break;

                        case "useractivity":
                            if (this._userActivityOptions != null && this._userActivityOptions.InboundUpdateEvent != null &&
                                this._userActivityOptions.InboundUpdateEvent.Contains(eventName))
                            {
                                _logger.Info("GetInboundUpdateData : Reading useractivity popup data");
                                sfdcData.UserActivityData = SFDCUserActivity.GetInstance().GetChatUpdateUserAcitivityData(chatData, eventName);
                            }
                            break;

                        default:
                            if (this._customObjectOptions.ContainsKey(key))
                            {
                                if (this._customObjectOptions[key] != null && this._customObjectOptions[key].InboundUpdateEvent != null &&
                                    this._customObjectOptions[key].InboundUpdateEvent.Contains(eventName))
                                {
                                    CustomObjectData cstobject = SFDCCustomObject.GetInstance().GetCustomObjectChatUpdateData(chatData, key, eventName);
                                    if (cstobject != null)
                                    {
                                        _logger.Info("GetInboundUpdateData : Reading customObject popup data");
                                        this._tempCustomObject.Add(cstobject);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    if (this._tempCustomObject.Count > 0)
                    {
                        CustomObjectData[] temp = this._tempCustomObject.ToArray();
                        sfdcData.CustomObjectData = temp;
                        this._tempCustomObject.Clear();
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("GetInboundUpdateData : Error Occurred while Collecting Inbound Update Data : " + generalException.ToString());
            }
            return(sfdcData);
        }