Пример #1
0
        /// <summary>
        /// Gets the Chat Update data.
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <param name="duration"></param>
        /// <param name="emailContent"></param>
        /// <returns></returns>
        public CaseData GetCaseEmailUpdateData(IXNCustomData emailData, SFDCCallType callType, string eventName)
        {
            CaseData cases = new CaseData();

            try
            {
                this._logger.Info("GetCaseOutboundEmailUpdateData :  Reading Account Update Data.....");

                if (emailData != null)
                {
                    #region Collect Case Data

                    cases.ObjectName = _caseEmailOptions.ObjectName;
                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        if (_caseEmailOptions.InboundCanUpdateLog)
                        {
                            cases.UpdateActivityLog     = true;
                            cases.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseEmailLogOptions, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(_caseEmailOptions.EmailAppendActivityLogEventNames) && _caseEmailOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                cases.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseEmailLogOptions, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        if (_caseEmailOptions.OutboundCanUpdateLog)
                        {
                            cases.UpdateActivityLog     = true;
                            cases.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseEmailLogOptions, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(_caseEmailOptions.EmailAppendActivityLogEventNames) && _caseEmailOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                cases.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseEmailLogOptions, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }
                    //update account record fields
                    cases.UpdateRecordFields = _caseEmailOptions.CanUpdateRecordData;
                    cases.NoRecordFound      = SFDCObjectHelper.GetNoRecordFoundAction(callType, _caseEmailOptions);
                    if (cases.NoRecordFound.Equals("createnew") && this._caseEmailRecordConfig != null)
                    {
                        if (_caseEmailOptions.CanUpdateRecordData)
                        {
                            cases.UpdateRecordFieldsData = this._sfdcUtility.GetUpdateActivityLogData(this._caseEmailRecordConfig, null, callType, emailData.Duration, emailData: emailData);
                        }
                    }

                    #endregion Collect Case Data

                    return(cases);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetCaseOutboundEmailUpdateData : Error occurred while reading Account Data : " + generalException.ToString());
                return(cases);
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Gets Case Popup Data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <returns></returns>
        public CaseData GetCaseChatPopupData(IXNCustomData chatData, SFDCCallType callType)
        {
            try
            {
                IMessage message = chatData.InteractionEvent;
                this._logger.Info("GetCaseChatPopupData :  Reading Case Popup Data.....");
                this._logger.Info("GetCaseChatPopupData :  Event Name : " + message.Name);
                this._logger.Info("GetCaseChatPopupData :  CallType Name : " + callType.ToString());
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null)
                {
                    CaseData cases = new CaseData();
                    cases.SearchData                             = this._sfdcUtilityHelper.GetChatSearchValue(_caseChatOptions, chatData, callType);
                    cases.ObjectName                             = _caseChatOptions.ObjectName;
                    cases.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, _caseChatOptions);
                    cases.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, _caseChatOptions);
                    cases.NewRecordFieldIds                      = _caseChatOptions.NewrecordFieldIds;
                    cases.SearchCondition                        = _caseChatOptions.SearchCondition;
                    cases.CreateLogForNewRecord                  = _caseChatOptions.CanCreateLogForNewRecordCreate;
                    cases.MaxRecordOpenCount                     = _caseChatOptions.MaxNosRecordOpen;
                    cases.SearchpageMode                         = _caseChatOptions.SearchPageMode;
                    cases.PhoneNumberSearchFormat                = _caseChatOptions.PhoneNumberSearchFormat;
                    cases.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, _caseChatOptions, true);
                    cases.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, _caseChatOptions, true);
                    cases.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, _caseChatOptions);
                    cases.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, _caseChatOptions);
                    cases.CanCreateProfileActivityforInbNoRecord = _caseChatOptions.CanCreateProfileActivityforInbNoRecord;
                    if (cases.NoRecordFound.Equals("createnew") && this._caseChatRecordConfig != null)
                    {
                        cases.CreateRecordFieldData = this._sfdcUtility.GetCreateActivityLogData(this._caseChatRecordConfig, message, callType, emailData: chatData);
                    }
                    if (callType == SFDCCallType.InboundChat)
                    {
                        if (_caseChatOptions.InboundCanCreateLog)
                        {
                            cases.CreateActvityLog = true;
                            cases.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._caseChatLogOptions, popupEvent, callType, emailData: chatData);
                        }
                    }
                    else if (callType == SFDCCallType.ConsultChatReceived)
                    {
                        if (_caseChatOptions.ConsultCanCreateLog)
                        {
                            cases.CreateActvityLog = true;
                            cases.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._caseChatLogOptions, popupEvent, callType, emailData: chatData);
                        }
                    }
                    return(cases);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetCaseChatPopupData : Error occurred while reading Case Data : " + generalException.ToString());
            }
            return(null);
        }
Пример #3
0
        /// <summary>
        /// Get Account Popup Data for Email
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <returns></returns>
        public CaseData GetCaseEmailPopupData(IXNCustomData emailData, SFDCCallType callType)
        {
            try
            {
                this._logger.Info("GetAccountEmailPopupData :  Reading Account Popup Data.....");
                this._logger.Info("GetAccountEmailPopupData :  CallType Name : " + callType.ToString());

                if (emailData != null)
                {
                    CaseData cases = new CaseData();

                    #region Collect Case Data

                    cases.SearchData              = this._sfdcUtilityHelper.GetEmailSearchValue(_caseEmailOptions, emailData, callType);
                    cases.ObjectName              = _caseEmailOptions.ObjectName;
                    cases.NoRecordFound           = SFDCObjectHelper.GetNoRecordFoundAction(callType, _caseEmailOptions);
                    cases.MultipleMatchRecord     = SFDCObjectHelper.GetMultiMatchRecordAction(callType, _caseEmailOptions);
                    cases.NewRecordFieldIds       = _caseEmailOptions.NewrecordFieldIds;
                    cases.SearchCondition         = _caseEmailOptions.SearchCondition;
                    cases.CreateLogForNewRecord   = _caseEmailOptions.CanCreateLogForNewRecordCreate;
                    cases.MaxRecordOpenCount      = _caseEmailOptions.MaxNosRecordOpen;
                    cases.SearchpageMode          = _caseEmailOptions.SearchPageMode;
                    cases.PhoneNumberSearchFormat = _caseEmailOptions.PhoneNumberSearchFormat;
                    if (cases.NoRecordFound.Equals("createnew") && this._caseEmailRecordConfig != null)
                    {
                        cases.CreateRecordFieldData = this._sfdcUtility.GetCreateActivityLogData(this._caseEmailRecordConfig, null, callType, emailData);
                    }
                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        if (_caseEmailOptions.InboundCanCreateLog)
                        {
                            cases.CreateActvityLog = true;
                            cases.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._caseChatLogOptions, null, callType, emailData);
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        if (_caseEmailOptions.OutboundCanCreateLog)
                        {
                            cases.CreateActvityLog = true;
                            cases.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._caseChatLogOptions, null, callType, emailData);
                        }
                    }

                    #endregion Collect Case Data

                    return(cases);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetAccountEmailPopupData : Error occurred while reading Account Data : " + generalException.ToString());
            }
            return(null);
        }
Пример #4
0
        /// <summary>
        /// Gets chat Update Data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <param name="duration"></param>
        /// <param name="chatContent"></param>
        /// <returns></returns>
        public CaseData GetCaseChatUpdateData(IXNCustomData chatData, string eventName)
        {
            try
            {
                IMessage     message  = chatData.InteractionEvent;
                SFDCCallType callType = chatData.InteractionType;
                string       duration = chatData.Duration;
                this._logger.Info("GetCaseChatUpdateData :  Reading Case Update Data.....");
                this._logger.Info("GetCaseChatUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());
                if (popupEvent != null)
                {
                    CaseData cases = new CaseData();

                    #region Collect Case Data

                    cases.ObjectName = _caseChatOptions.ObjectName;
                    if (callType == SFDCCallType.InboundChat)
                    {
                        if (_caseChatOptions.InboundCanUpdateLog)
                        {
                            cases.UpdateActivityLog     = true;
                            cases.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseChatLogOptions, popupEvent, callType, duration, emailData: chatData);
                            if (!string.IsNullOrWhiteSpace(_caseChatOptions.ChatAppendActivityLogEventNames) && _caseChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                            {
                                cases.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseChatLogOptions, null, callType, duration, emailData: chatData, isAppendLogData: true);
                            }
                        }
                    }
                    else
                    if (callType == SFDCCallType.ConsultChatReceived)
                    {
                        if (_caseChatOptions.ConsultCanUpdateLog)
                        {
                            cases.UpdateActivityLog     = true;
                            cases.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseChatLogOptions, popupEvent, callType, duration, emailData: chatData);
                            if (!string.IsNullOrWhiteSpace(_caseChatOptions.ChatAppendActivityLogEventNames) && _caseChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                            {
                                cases.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._caseChatLogOptions, null, callType, duration, emailData: chatData, isAppendLogData: true);
                            }
                        }
                    }

                    //update case record fields
                    cases.UpdateRecordFields = _caseChatOptions.CanUpdateRecordData;
                    if (SFDCObjectHelper.GetNoRecordFoundAction(callType, _caseChatOptions).Equals("createnew") && this._caseChatRecordConfig != null)
                    {
                        if (_caseChatOptions.CanUpdateRecordData)
                        {
                            cases.UpdateRecordFieldsData = this._sfdcUtility.GetUpdateActivityLogData(this._caseChatRecordConfig, popupEvent, callType, duration, emailData: chatData);
                        }
                    }

                    #endregion Collect Case Data

                    return(cases);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetCaseChatUpdateData : Error occurred while reading Case Data : " + generalException.ToString());
            }
            return(null);
        }
Пример #5
0
        /// <summary>
        /// Gets Contact Popup Data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <returns></returns>
        public ContactData GetContactVoicePopupData(IMessage message, SFDCCallType callType)
        {
            try
            {
                this.logger.Info("GetContactVoicePopupData :  Reading Contact Popup Data.....");
                this.logger.Info("GetContactVoicePopupData :  Event Name : " + message.Name);
                this.logger.Info("GetContactVoicePopupData :  CallType Name : " + callType.ToString());
                dynamic _popupEvent = Convert.ChangeType(message, message.GetType());
                if (_popupEvent != null)
                {
                    ContactData _contact = new ContactData();

                    #region Collect contact Data

                    _contact.SearchData                             = this.sfdcUtilityHelper.GetVoiceSearchValue(contactVoiceOptions, message, callType);
                    _contact.ObjectName                             = contactVoiceOptions.ObjectName;
                    _contact.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, contactVoiceOptions);
                    _contact.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, contactVoiceOptions);
                    _contact.NewRecordFieldIds                      = contactVoiceOptions.NewrecordFieldIds;
                    _contact.SearchCondition                        = contactVoiceOptions.SearchCondition;
                    _contact.CreateLogForNewRecord                  = contactVoiceOptions.CanCreateLogForNewRecordCreate;
                    _contact.MaxRecordOpenCount                     = contactVoiceOptions.MaxNosRecordOpen;
                    _contact.SearchpageMode                         = contactVoiceOptions.SearchPageMode;
                    _contact.PhoneNumberSearchFormat                = contactVoiceOptions.PhoneNumberSearchFormat;
                    _contact.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, contactVoiceOptions, true);
                    _contact.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, contactVoiceOptions, true);
                    _contact.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, contactVoiceOptions);
                    _contact.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, contactVoiceOptions);
                    _contact.CanCreateProfileActivityforInbNoRecord = contactVoiceOptions.CanCreateProfileActivityforInbNoRecord;
                    _contact.CanCreateProfileActivityforOutNoRecord = contactVoiceOptions.CanCreateProfileActivityforOutNoRecord;
                    _contact.CanCreateProfileActivityforConNoRecord = contactVoiceOptions.CanCreateProfileActivityforConNoRecord;
                    if (_contact.NoRecordFound.Equals("createnew") && this.ContactVoiceRecordConfig != null)
                    {
                        _contact.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(this.ContactVoiceRecordConfig, message, callType);
                    }
                    if (callType == SFDCCallType.InboundVoice)
                    {
                        if (contactVoiceOptions.InboundCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactLogConfig, _popupEvent, callType);
                        }
                    }
                    else if (callType == SFDCCallType.OutboundVoiceSuccess)
                    {
                        if (contactVoiceOptions.OutboundCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactLogConfig, _popupEvent, callType);
                        }
                    }
                    else if (callType == SFDCCallType.OutboundVoiceFailure)
                    {
                        if (contactVoiceOptions.OutboundFailureCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactLogConfig, _popupEvent, callType);
                        }
                    }
                    else if (callType == SFDCCallType.ConsultVoiceReceived)
                    {
                        if (contactVoiceOptions.ConsultCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactLogConfig, _popupEvent, callType);
                        }
                    }
                    return(_contact);
                }

                #endregion Collect contact Data
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetContactVoicePopupData : Error occurred while reading Contact Data on EventRinging Event : " + generalException.ToString());
            }
            return(null);
        }
Пример #6
0
        /// <summary>
        /// Gets Custom Object Popup Data
        /// </summary>
        /// <param name="message"></param>
        /// <param name="callType"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        public CustomObjectData GetCustomObjectVoicePopupData(IMessage message, SFDCCallType callType, string objectName)
        {
            try
            {
                this.logger.Info("GetCustomObjectVoicePopupData :  Reading CustomObject Popup Data.....");
                this.logger.Info("GetCustomObjectVoicePopupData :  Event Name : " + message.Name);
                this.logger.Info("GetCustomObjectVoicePopupData :  CallType Name : " + callType.ToString());
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());
                if (popupEvent != null && customvoiceOptions.ContainsKey(objectName))
                {
                    CustomObjectData custom = new CustomObjectData();
                    VoiceOptions     customObjectOptions = customvoiceOptions[objectName];

                    #region Collect CustomObject Popup data

                    custom.SearchData                             = this.sfdcUtilityHelper.GetVoiceSearchValue(customObjectOptions, message, callType);
                    custom.ObjectName                             = customObjectOptions.ObjectName;
                    custom.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, customObjectOptions);
                    custom.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, customObjectOptions);
                    custom.NewRecordFieldIds                      = customObjectOptions.NewrecordFieldIds;
                    custom.SearchCondition                        = customObjectOptions.SearchCondition;
                    custom.CreateLogForNewRecord                  = customObjectOptions.CanCreateLogForNewRecordCreate;
                    custom.MaxRecordOpenCount                     = customObjectOptions.MaxNosRecordOpen;
                    custom.SearchpageMode                         = customObjectOptions.SearchPageMode;
                    custom.CustomObjectURL                        = customObjectOptions.CustomObjectURL;
                    custom.PhoneNumberSearchFormat                = customObjectOptions.PhoneNumberSearchFormat;
                    custom.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, customObjectOptions, true);
                    custom.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, customObjectOptions, true);
                    custom.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, customObjectOptions);
                    custom.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, customObjectOptions);
                    custom.CanCreateProfileActivityforInbNoRecord = customObjectOptions.CanCreateProfileActivityforInbNoRecord;
                    custom.CanCreateProfileActivityforOutNoRecord = customObjectOptions.CanCreateProfileActivityforOutNoRecord;
                    custom.CanCreateProfileActivityforConNoRecord = customObjectOptions.CanCreateProfileActivityforConNoRecord;

                    if (CustomVoiceRecordConfigs != null && CustomVoiceRecordConfigs.ContainsKey(objectName))
                    {
                        KeyValueCollection RecordConfig = CustomVoiceRecordConfigs[objectName];
                        if (RecordConfig != null)
                        {
                            if (custom.NoRecordFound.Equals("createnew"))
                            {
                                custom.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(RecordConfig, message, callType);
                            }
                        }
                    }
                    KeyValueCollection LogConfig = null;
                    if (this.CustomVoiceLogConfigs != null && this.CustomVoiceLogConfigs.ContainsKey(objectName))
                    {
                        LogConfig = this.CustomVoiceLogConfigs[objectName];
                    }

                    if (callType == SFDCCallType.InboundVoice)
                    {
                        custom.CreateActvityLog = customObjectOptions.InboundCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.InboundCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, popupEvent, callType);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundVoiceSuccess)
                    {
                        custom.CreateActvityLog = customObjectOptions.OutboundCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.OutboundCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, popupEvent, callType);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundVoiceFailure)
                    {
                        custom.CreateActvityLog = customObjectOptions.OutboundFailureCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.OutboundFailureCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, popupEvent, callType);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.ConsultVoiceReceived)
                    {
                        custom.CreateActvityLog = customObjectOptions.ConsultCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.ConsultCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, popupEvent, callType);
                            }
                        }
                    }

                    return(custom);
                }

                #endregion Collect CustomObject Popup data
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetCustomObjectVoicePopupData : Error occurred while reading Contact Data on EventRinging Event : " + generalException.ToString());
            }
            return(null);
        }
Пример #7
0
        /// <summary>
        /// Get Account Popup Data for Email
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <returns></returns>
        public ContactData GetContactEmailPopupData(IXNCustomData emailData, SFDCCallType callType)
        {
            try
            {
                this.logger.Info("GetContactEmailPopupData :  Reading Account Popup Data.....");
                this.logger.Info("GetContactEmailPopupData :  CallType Name : " + callType.ToString());

                if (emailData != null)
                {
                    ContactData _contact = new ContactData();

                    #region Collect Contact Data

                    _contact.SearchData                             = this.sfdcUtilityHelper.GetEmailSearchValue(contactEmailOptions, emailData, callType);
                    _contact.ObjectName                             = contactEmailOptions.ObjectName;
                    _contact.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, contactEmailOptions);
                    _contact.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, contactEmailOptions);
                    _contact.NewRecordFieldIds                      = contactEmailOptions.NewrecordFieldIds;
                    _contact.SearchCondition                        = contactEmailOptions.SearchCondition;
                    _contact.CreateLogForNewRecord                  = contactEmailOptions.CanCreateLogForNewRecordCreate;
                    _contact.MaxRecordOpenCount                     = contactEmailOptions.MaxNosRecordOpen;
                    _contact.SearchpageMode                         = contactEmailOptions.SearchPageMode;
                    _contact.PhoneNumberSearchFormat                = contactEmailOptions.PhoneNumberSearchFormat;
                    _contact.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, contactEmailOptions, true);
                    _contact.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, contactEmailOptions, true);
                    _contact.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, contactEmailOptions);
                    _contact.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, contactEmailOptions);
                    _contact.CanCreateProfileActivityforInbNoRecord = contactEmailOptions.CanCreateProfileActivityforInbNoRecord;
                    _contact.CanCreateProfileActivityforOutNoRecord = contactEmailOptions.CanCreateProfileActivityforOutNoRecord;
                    //_contact.CanCreateProfileActivityforConNoRecord = contactEmailOptions.CanCreateProfileActivityforConNoRecord;
                    if (_contact.NoRecordFound.Equals("createnew") && this.ContactEmailRecordConfig != null)
                    {
                        _contact.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(this.ContactEmailRecordConfig, null, callType, emailData);
                    }
                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        if (contactEmailOptions.InboundCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactEmailLogConfig, null, callType, emailData);
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        if (contactEmailOptions.OutboundCanCreateLog)
                        {
                            _contact.CreateActvityLog = true;
                            _contact.ActivityLogData  = this.sfdcUtility.GetCreateActivityLogData(this.ContactEmailLogConfig, null, callType, emailData);
                        }
                    }

                    #endregion Collect Contact Data

                    return(_contact);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetAccountEmailPopupData : Error occurred while reading Account Data : " + generalException.ToString());
            }
            return(null);
        }
Пример #8
0
        public CustomObjectData GetCustomObjectChatUpdateData(IXNCustomData chatData, string objectName, string eventName)
        {
            try
            {
                IMessage     message      = chatData.InteractionEvent;
                SFDCCallType callType     = chatData.InteractionType;
                string       callDuration = chatData.Duration;
                this.logger.Info("GetCustomObjectChatUpdateData :  Reading CustomObject Chat Update Data.....");
                this.logger.Info("GetCustomObjectChatUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null && customchatOptions.ContainsKey(objectName))
                {
                    CustomObjectData   customObject              = new CustomObjectData();
                    ChatOptions        currentObjectOptions      = this.customchatOptions[objectName];
                    KeyValueCollection currentObjectLogConfigs   = null;
                    KeyValueCollection currentObjectRecordConfig = null;
                    if (CustomChatLogConfigs != null && CustomChatLogConfigs.ContainsKey(objectName))
                    {
                        currentObjectLogConfigs = CustomChatLogConfigs[objectName];
                    }
                    if (CustomChatRecordConfigs != null && CustomChatRecordConfigs.ContainsKey(objectName))
                    {
                        currentObjectRecordConfig = CustomChatRecordConfigs[objectName];
                    }

                    #region Collect customObject Data

                    customObject.ObjectName = currentObjectOptions.ObjectName;

                    if (callType == SFDCCallType.InboundChat)
                    {
                        if (currentObjectOptions.InboundCanUpdateLog)
                        {
                            customObject.UpdateActivityLog     = true;
                            customObject.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, popupEvent, callType, callDuration, emailData: chatData);
                            if (!string.IsNullOrWhiteSpace(currentObjectOptions.ChatAppendActivityLogEventNames) && currentObjectOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                            {
                                customObject.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, callDuration, emailData: chatData, isAppendLogData: true);
                            }
                        }
                    }
                    if (callType == SFDCCallType.ConsultChatReceived)
                    {
                        if (currentObjectOptions.ConsultCanUpdateLog)
                        {
                            customObject.UpdateActivityLog     = true;
                            customObject.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, popupEvent, callType, callDuration, emailData: chatData);
                            if (!string.IsNullOrWhiteSpace(currentObjectOptions.ChatAppendActivityLogEventNames) && currentObjectOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                            {
                                customObject.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, callDuration, emailData: chatData, isAppendLogData: true);
                            }
                        }
                    }

                    //update CustomObject record fields
                    customObject.UpdateRecordFields = customchatOptions[objectName].CanUpdateRecordData;
                    if (SFDCObjectHelper.GetNoRecordFoundAction(callType, customchatOptions[objectName]).Equals("createnew") && this.CustomChatRecordConfigs[objectName] != null)
                    {
                        if (customchatOptions[objectName].CanUpdateRecordData)
                        {
                            customObject.UpdateRecordFieldsData = this.sfdcUtility.GetUpdateActivityLogData(this.CustomChatRecordConfigs[objectName], popupEvent, callType, callDuration, emailData: chatData);
                        }
                    }

                    #endregion Collect customObject Data

                    return(customObject);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetCustomObjectChatUpdateData : Error occurred : " + generalException.ToString());
            }
            return(null);
        }
Пример #9
0
        public CustomObjectData GetCustomObjectEmailUpdateData(IXNCustomData emailData, SFDCCallType callType, string objectName, string eventName)
        {
            CustomObjectData customObject = new CustomObjectData();

            try
            {
                this.logger.Info("GetCustomObjectOutboundEmailUpdateData :  Reading CustomObject Chat Update Data.....");

                if (emailData != null && customemailOptions.ContainsKey(objectName))
                {
                    EmailOptions       currentObjectOptions      = this.customemailOptions[objectName];
                    KeyValueCollection currentObjectLogConfigs   = null;
                    KeyValueCollection currentObjectRecordConfig = null;
                    if (CustomEmailLogConfigs != null && CustomEmailLogConfigs.ContainsKey(objectName))
                    {
                        currentObjectLogConfigs = CustomEmailLogConfigs[objectName];
                    }
                    if (CustomEmailRecordConfigs != null && CustomEmailRecordConfigs.ContainsKey(objectName))
                    {
                        currentObjectRecordConfig = CustomEmailRecordConfigs[objectName];
                    }

                    #region Collect customObject Data

                    customObject.ObjectName = currentObjectOptions.ObjectName;
                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        if (currentObjectOptions.InboundCanUpdateLog)
                        {
                            customObject.UpdateActivityLog     = true;
                            customObject.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(currentObjectOptions.EmailAppendActivityLogEventNames) && currentObjectOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                customObject.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        if (currentObjectOptions.OutboundCanUpdateLog)
                        {
                            customObject.UpdateActivityLog     = true;
                            customObject.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(currentObjectOptions.EmailAppendActivityLogEventNames) && currentObjectOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                customObject.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(currentObjectLogConfigs, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }

                    //update CustomObject record fields
                    customObject.UpdateRecordFields = customemailOptions[objectName].CanUpdateRecordData;
                    customObject.NoRecordFound      = SFDCObjectHelper.GetNoRecordFoundAction(callType, customemailOptions[objectName]);
                    if (customObject.NoRecordFound.Equals("createnew") && this.CustomEmailRecordConfigs[objectName] != null)
                    {
                        if (customemailOptions[objectName].CanUpdateRecordData)
                        {
                            customObject.UpdateRecordFieldsData = this.sfdcUtility.GetUpdateActivityLogData(this.CustomEmailRecordConfigs[objectName], null, callType, emailData.Duration, emailData: emailData);
                        }
                    }

                    #endregion Collect customObject Data

                    return(customObject);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetCustomObjectOutboundEmailUpdateData : Error occurred : " + generalException.ToString());
                return(customObject);
            }
            return(null);
        }
Пример #10
0
        /// <summary>
        /// Gets Custom Object Chat Popup Data
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        public CustomObjectData GetCustomObjectEmailPopupData(IXNCustomData emailData, SFDCCallType callType, string objectName)
        {
            try
            {
                this.logger.Info("GetCustomObjectEmailPopupData :  Reading CustomObject Chat Popup Data.....");
                this.logger.Info("GetCustomObjectEmailPopupData :  CallType Name : " + callType.ToString());

                if (emailData != null && customchatOptions.ContainsKey(objectName))
                {
                    CustomObjectData custom = new CustomObjectData();
                    EmailOptions     customObjectOptions = customemailOptions[objectName];

                    #region Collect CustomObject Popup data

                    custom.SearchData                             = this.sfdcUtilityHelper.GetEmailSearchValue(customObjectOptions, emailData, callType);
                    custom.ObjectName                             = customObjectOptions.ObjectName;
                    custom.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, customObjectOptions);
                    custom.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, customObjectOptions);
                    custom.NewRecordFieldIds                      = customObjectOptions.NewrecordFieldIds;
                    custom.SearchCondition                        = customObjectOptions.SearchCondition;
                    custom.CreateLogForNewRecord                  = customObjectOptions.CanCreateLogForNewRecordCreate;
                    custom.MaxRecordOpenCount                     = customObjectOptions.MaxNosRecordOpen;
                    custom.SearchpageMode                         = customObjectOptions.SearchPageMode;
                    custom.PhoneNumberSearchFormat                = customObjectOptions.PhoneNumberSearchFormat;
                    custom.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, customObjectOptions, true);
                    custom.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, customObjectOptions, true);
                    custom.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, customObjectOptions);
                    custom.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, customObjectOptions);
                    custom.CanCreateProfileActivityforInbNoRecord = customObjectOptions.CanCreateProfileActivityforInbNoRecord;
                    custom.CanCreateProfileActivityforOutNoRecord = customObjectOptions.CanCreateProfileActivityforOutNoRecord;
                    if (CustomEmailRecordConfigs != null && CustomEmailRecordConfigs.ContainsKey(objectName))
                    {
                        KeyValueCollection RecordConfig = CustomEmailRecordConfigs[objectName];
                        if (RecordConfig != null)
                        {
                            if (custom.NoRecordFound.Equals("createnew"))
                            {
                                custom.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(RecordConfig, null, callType, emailData);
                            }
                        }
                    }
                    KeyValueCollection LogConfig = null;
                    if (this.CustomEmailLogConfigs != null && this.CustomEmailLogConfigs.ContainsKey(objectName))
                    {
                        LogConfig = this.CustomEmailLogConfigs[objectName];
                    }

                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        custom.CreateActvityLog = customObjectOptions.InboundCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.InboundCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, null, callType, emailData);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        custom.CreateActvityLog = customObjectOptions.OutboundCanCreateLog;
                        if (LogConfig != null)
                        {
                            if (customObjectOptions.OutboundCanCreateLog)
                            {
                                custom.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(LogConfig, null, callType, emailData);
                            }
                        }
                    }
                    return(custom);
                }

                #endregion Collect CustomObject Popup data
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetCustomObjectEmailPopupData : Error occurred  : " + generalException.ToString());
            }
            return(null);
        }
Пример #11
0
        public LeadData GetLeadVoicePopupData(IMessage message, SFDCCallType callType)
        {
            try
            {
                this.logger.Info("GetLeadVoicePopupData :  Reading Lead Popup Data.....");
                this.logger.Info("GetLeadVoicePopupData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());
                if (this.leadVoiceOptions != null)
                {
                    if (popupEvent != null)
                    {
                        LeadData lead = new LeadData();

                        #region Collect Lead Data

                        lead.SearchData                             = this.sfdcUtilityHelper.GetVoiceSearchValue(leadVoiceOptions, message, callType);
                        lead.ObjectName                             = leadVoiceOptions.ObjectName;
                        lead.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, leadVoiceOptions);
                        lead.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, leadVoiceOptions);
                        lead.NewRecordFieldIds                      = leadVoiceOptions.NewrecordFieldIds;
                        lead.SearchCondition                        = leadVoiceOptions.SearchCondition;
                        lead.CreateLogForNewRecord                  = leadVoiceOptions.CanCreateLogForNewRecordCreate;
                        lead.MaxRecordOpenCount                     = leadVoiceOptions.MaxNosRecordOpen;
                        lead.SearchpageMode                         = leadVoiceOptions.SearchPageMode;
                        lead.PhoneNumberSearchFormat                = leadVoiceOptions.PhoneNumberSearchFormat;
                        lead.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, leadVoiceOptions, true);
                        lead.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, leadVoiceOptions, true);
                        lead.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, leadVoiceOptions);
                        lead.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, leadVoiceOptions);
                        lead.CanCreateProfileActivityforInbNoRecord = leadVoiceOptions.CanCreateProfileActivityforInbNoRecord;
                        lead.CanCreateProfileActivityforOutNoRecord = leadVoiceOptions.CanCreateProfileActivityforOutNoRecord;
                        lead.CanCreateProfileActivityforConNoRecord = leadVoiceOptions.CanCreateProfileActivityforConNoRecord;
                        if (lead.NoRecordFound.Equals("createnew") && this.LeadVoiceRecordConfig != null)
                        {
                            lead.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(this.LeadVoiceRecordConfig, message, callType);
                        }

                        switch (callType)
                        {
                        case SFDCCallType.InboundVoice:
                            lead.CreateActvityLog = leadVoiceOptions.InboundCanCreateLog;
                            if (leadVoiceOptions.InboundCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.OutboundVoiceSuccess:
                            lead.CreateActvityLog = leadVoiceOptions.OutboundCanCreateLog;
                            if (leadVoiceOptions.OutboundCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.OutboundVoiceFailure:
                            lead.CreateActvityLog = leadVoiceOptions.OutboundFailureCanCreateLog;
                            if (leadVoiceOptions.OutboundFailureCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.ConsultVoiceReceived:
                            lead.CreateActvityLog = leadVoiceOptions.ConsultCanCreateLog;
                            if (leadVoiceOptions.ConsultCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        default:
                            break;
                        }

                        #endregion Collect Lead Data

                        return(lead);
                    }
                }
                else
                {
                    this.logger.Info("Can not Collect Lead Popup data because Lead Configuration is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadVoicePopupData : Error occurred while reading Lead Data : " + generalException.ToString());
            }
            return(null);
        }
Пример #12
0
        // public LeadData GetLeadChatUpdateData(IMessage message, string eventName, SFDCCallType callType, string duration, string chatContent)
        public LeadData GetLeadChatUpdateData(IXNCustomData chatData, string eventName)
        {
            try
            {
                this.logger.Info("GetLeadChatUpdateData :  Reading Lead Update Data.....");
                this.logger.Info("GetLeadChatUpdateData :  Event Name : " + chatData.EventName);
                if (this.leadChatOptions != null)
                {
                    dynamic popupEvent = Convert.ChangeType(chatData.InteractionEvent, chatData.InteractionEvent.GetType());

                    if (popupEvent != null)
                    {
                        LeadData lead = new LeadData();

                        #region Collect Lead Data

                        lead.ObjectName = leadChatOptions.ObjectName;

                        if (chatData.InteractionType == SFDCCallType.InboundChat)
                        {
                            if (leadChatOptions.InboundCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                                if (!string.IsNullOrWhiteSpace(leadChatOptions.ChatAppendActivityLogEventNames) && leadChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                                {
                                    lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, null, chatData.InteractionType, chatData.Duration, emailData: chatData, isAppendLogData: true);
                                }
                            }
                        }
                        if (chatData.InteractionType == SFDCCallType.ConsultChatReceived)
                        {
                            if (leadChatOptions.ConsultCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                                if (!string.IsNullOrWhiteSpace(leadChatOptions.ChatAppendActivityLogEventNames) && leadChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                                {
                                    lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, null, chatData.InteractionType, chatData.Duration, emailData: chatData, isAppendLogData: true);
                                }
                            }
                        }
                        //update lead record fields
                        lead.UpdateRecordFields = leadChatOptions.CanUpdateRecordData;
                        if (SFDCObjectHelper.GetNoRecordFoundAction(chatData.InteractionType, leadChatOptions).Equals("createnew") && this.LeadChatRecordConfig != null)
                        {
                            if (leadChatOptions.CanUpdateRecordData)
                            {
                                lead.UpdateRecordFieldsData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatRecordConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                            }
                        }

                        #endregion Collect Lead Data

                        return(lead);
                    }
                }
                else
                {
                    this.logger.Info("Can not Collect Lead Update data because Lead Configuration is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadChatUpdateData : Error occurred while reading Lead Data : " + generalException.ToString());
            }
            return(null);
        }