/// <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 OpportunityData GetOpportunityEmailUpdateData(IXNCustomData emailData, SFDCCallType callType, string eventName)
        {
            OpportunityData opportunity = new OpportunityData();

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

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

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

                    #endregion Collect Lead Data

                    return(opportunity);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetOpportunityOutboundEmailUpdateData : Error occurred while reading Account Data : " + generalException.ToString());
                return(opportunity);
            }
            return(null);
        }
        public IOpportunity GetOpportunityVoiceUpdateData(IMessage message, SFDCCallType callType, string duration)
        {
            try
            {
                this.logger.Info("GetOpportunityVoiceUpdateData :  Reading Opportunity Update Data.....");
                this.logger.Info("GetOpportunityVoiceUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null)
                {
                    IOpportunity opportunity = new OpportunityData();

                    #region Collect opportunity Data

                    opportunity.ObjectName = opportunityVoiceOptions.ObjectName;

                    if (callType == SFDCCallType.Inbound)
                    {
                        if (opportunityVoiceOptions.InboundCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetVoiceUpdateActivityLog(this.OpportunityLogConfig, popupEvent, callType, duration);
                        }
                    }
                    else if (callType == SFDCCallType.OutboundSuccess || callType == SFDCCallType.OutboundFailure)
                    {
                        if (opportunityVoiceOptions.OutboundCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetVoiceUpdateActivityLog(this.OpportunityLogConfig, popupEvent, callType, duration);
                        }
                    }
                    else if (callType == SFDCCallType.ConsultSuccess || callType == SFDCCallType.ConsultReceived || callType == SFDCCallType.ConsultFailure)
                    {
                        if (opportunityVoiceOptions.ConsultCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetVoiceUpdateActivityLog(this.OpportunityLogConfig, popupEvent, callType, duration);
                        }
                    }

                    if (opportunityVoiceOptions.CanUpdateRecordData)
                    {
                        opportunity.UpdateRecordFields     = true;
                        opportunity.UpdateRecordFieldsData = this.sfdcObject.GetVoiceUpdateRecordData(this.OpportunityRecordConfig, popupEvent, callType, duration);
                    }

                    #endregion Collect opportunity Data

                    return(opportunity);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetOpportunityVoiceUpdateData : Error occurred while reading opportunity Data : " + generalException.ToString());
            }
            return(null);
        }
        public IOpportunity GetOpportunityChatPopupData(IMessage message, SFDCCallType callType)
        {
            try
            {
                this.logger.Info("GetOpportunityChatPopupData :  Reading Opportunity Popup Data.....");
                this.logger.Info("GetOpportunityChatPopupData :  Event Name : " + message.Name);
                this.logger.Info("GetOpportunityChatPopupData :  CallType Name : " + callType.ToString());
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());
                if (popupEvent != null)
                {
                    IOpportunity Opportunity = new OpportunityData();

                    #region Collect Lead Data

                    Opportunity.SearchData              = GetOpportunityChatSearchValue(popupEvent.Interaction.InteractionUserData, message, callType);
                    Opportunity.ObjectName              = opportunityChatOptions.ObjectName;
                    Opportunity.NoRecordFound           = GetNoRecordFoundAction(callType, opportunityChatOptions);
                    Opportunity.MultipleMatchRecord     = GetMultiMatchRecordAction(callType, opportunityChatOptions);
                    Opportunity.NewRecordFieldIds       = opportunityChatOptions.NewrecordFieldIds;
                    Opportunity.SearchCondition         = opportunityChatOptions.SearchCondition;
                    Opportunity.CreateLogForNewRecord   = opportunityChatOptions.CanCreateLogForNewRecordCreate;
                    Opportunity.MaxRecordOpenCount      = opportunityChatOptions.MaxNosRecordOpen;
                    Opportunity.SearchpageMode          = opportunityChatOptions.SearchPageMode;
                    Opportunity.PhoneNumberSearchFormat = opportunityChatOptions.PhoneNumberSearchFormat;
                    if (Opportunity.NoRecordFound.Equals("createnew"))
                    {
                        Opportunity.CreateRecordFieldData = this.sfdcObject.GetChatRecordData(this.OpportunityRecordConfig, message, callType);
                    }
                    if (callType == SFDCCallType.InboundChat)
                    {
                        if (opportunityChatOptions.InboundCanCreateLog)
                        {
                            Opportunity.CreateActvityLog = true;
                            Opportunity.ActivityLogData  = this.sfdcObject.GetChatActivityLog(this.OpportunityChatLogConfig, popupEvent, callType);
                        }
                    }
                    else if (callType == SFDCCallType.ConsultChatSuccess || callType == SFDCCallType.ConsultChatFailure || callType == SFDCCallType.ConsultChatReceived)
                    {
                        if (opportunityChatOptions.ConsultCanCreateLog)
                        {
                            Opportunity.CreateActvityLog = true;
                            Opportunity.ActivityLogData  = this.sfdcObject.GetChatActivityLog(this.OpportunityChatLogConfig, popupEvent, callType);
                        }
                    }
                    return(Opportunity);

                    #endregion Collect Lead Data
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetOpportunityChatPopupData : Error occurred while reading Opportunity Data : " + generalException.ToString());
            }
            return(null);
        }
Example #4
0
        public async Task <OpportunityData> GetOpportunityDetail(Guid opportunityId)
        {
            OpportunityData opportunityData = null;
            SqlConnection   sqlConnection   = null;

            try
            {
                sqlConnection = new SqlConnection(connectionString);
                SqlCommand cmd = new SqlCommand("GetOpportunityDetail", sqlConnection)
                {
                    CommandType = CommandType.StoredProcedure
                };

                cmd.Parameters.Add(new SqlParameter("@opportunitySourceId", opportunityId));
                sqlConnection.Open();
                using (var reader = await cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection))
                {
                    if (reader.HasRows && await reader.ReadAsync())
                    {
                        opportunityData = new OpportunityData()
                        {
                            Active = (bool)reader["Active"],
                            OpportunitySourceCode        = (string)reader["OpportunitySourceCode"],
                            OpportunitySourceDescription = (string)reader["OpportunitySourceDescription"],
                            OpportunitySourceId          = (Guid)reader["OpportunitySourceId"],
                            OpportunitySourceName        = (string)reader["OpportunitySourceName"],
                            OrganizationId = (Guid)reader["OrganizationId"],
                            UserId         = (Guid)reader["UserId"],
                            Void           = (bool)reader["Void"]
                        };
                    }
                }
            }
            catch (SqlException sqlEx) { throw sqlEx; }
            catch (Exception ex) { throw; }
            finally
            {
                if (sqlConnection != null)
                {
                    sqlConnection.Dispose();
                }
            }
            return(opportunityData);
        }
        internal static void Load(MatchingDbContext context)
        {
            context.AddRange(EmailTemplateData.Create().ToList());
            context.AddRange(EmployerData.Create().ToList());
            context.AddRange(RouteAndPathData.Create().ToList());
            context.AddRange(ProviderVenueData.Create());
            context.AddRange(OpportunityData.Create());
            context.AddRange(ServiceStatusHistoryData.Create().ToList());
            context.AddRange(LearningAimReferenceData.Create().ToList());
            context.AddRange(OpportunityData.CreateReferralSingle());
            context.AddRange(OpportunityData.CreateProvisionGapSingle());
            context.AddRange(OpportunityData.CreateReferralMultiple());
            context.AddRange(OpportunityData.CreateReferralMultipleAndProvisionGap());
            context.AddRange(OpportunityData.CreateReferralSingleAndProvisionGap());
            context.AddRange(OpportunityData.CreateProvidersMultiple());
            context.AddRange(OpportunityData.CreateNReferrals(1000));

            context.SaveChanges();
        }
 public OpportunityData GetOpportunityVoicePopupData(IMessage message, SFDCCallType callType)
 {
     try
     {
         this._logger.Info("GetOpportunityVoicePopupData :  Reading Opportunity Popup Data.....");
         this._logger.Info("GetOpportunityVoicePopupData :  Event Name : " + message.Name);
         this._logger.Info("GetOpportunityVoicePopupData :  CallType Name : " + callType.ToString());
         dynamic _popupEvent = Convert.ChangeType(message, message.GetType());
         if (_popupEvent != null)
         {
             OpportunityData _opportunity = new OpportunityData();
             _opportunity.SearchData                             = this._sfdcUtilityHelper.GetVoiceSearchValue(_opportunityVoiceOptions, message, callType);
             _opportunity.ObjectName                             = _opportunityVoiceOptions.ObjectName;
             _opportunity.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, _opportunityVoiceOptions);
             _opportunity.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, _opportunityVoiceOptions);
             _opportunity.NewRecordFieldIds                      = _opportunityVoiceOptions.NewrecordFieldIds;
             _opportunity.SearchCondition                        = _opportunityVoiceOptions.SearchCondition;
             _opportunity.CreateLogForNewRecord                  = _opportunityVoiceOptions.CanCreateLogForNewRecordCreate;
             _opportunity.MaxRecordOpenCount                     = _opportunityVoiceOptions.MaxNosRecordOpen;
             _opportunity.SearchpageMode                         = _opportunityVoiceOptions.SearchPageMode;
             _opportunity.PhoneNumberSearchFormat                = _opportunityVoiceOptions.PhoneNumberSearchFormat;
             _opportunity.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, _opportunityVoiceOptions, true);
             _opportunity.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, _opportunityVoiceOptions, true);
             _opportunity.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, _opportunityVoiceOptions);
             _opportunity.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, _opportunityVoiceOptions);
             _opportunity.CanCreateProfileActivityforInbNoRecord = _opportunityVoiceOptions.CanCreateProfileActivityforInbNoRecord;
             _opportunity.CanCreateProfileActivityforOutNoRecord = _opportunityVoiceOptions.CanCreateProfileActivityforOutNoRecord;
             _opportunity.CanCreateProfileActivityforConNoRecord = _opportunityVoiceOptions.CanCreateProfileActivityforConNoRecord;
             if (_opportunity.NoRecordFound.Equals("createnew") && this._opportunityVoiceRecordConfig != null)
             {
                 _opportunity.CreateRecordFieldData = this._sfdcUtility.GetCreateActivityLogData(this._opportunityVoiceRecordConfig, message, callType);
             }
             if (callType == SFDCCallType.InboundVoice)
             {
                 if (_opportunityVoiceOptions.InboundCanCreateLog)
                 {
                     _opportunity.CreateActvityLog = true;
                     _opportunity.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._opportunityLogConfig, _popupEvent, callType);
                 }
             }
             else if (callType == SFDCCallType.OutboundVoiceSuccess)
             {
                 if (_opportunityVoiceOptions.OutboundCanCreateLog)
                 {
                     _opportunity.CreateActvityLog = true;
                     _opportunity.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._opportunityLogConfig, _popupEvent, callType);
                 }
             }
             else if (callType == SFDCCallType.OutboundVoiceFailure)
             {
                 if (_opportunityVoiceOptions.OutboundFailureCanCreateLog)
                 {
                     _opportunity.CreateActvityLog = true;
                     _opportunity.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._opportunityLogConfig, _popupEvent, callType);
                 }
             }
             else if (callType == SFDCCallType.ConsultVoiceReceived)
             {
                 if (_opportunityVoiceOptions.ConsultCanCreateLog)
                 {
                     _opportunity.CreateActvityLog = true;
                     _opportunity.ActivityLogData  = this._sfdcUtility.GetCreateActivityLogData(this._opportunityLogConfig, _popupEvent, callType);
                 }
             }
             return(_opportunity);
         }
     }
     catch (Exception generalException)
     {
         this._logger.Error("GetOpportunityVoicePopupData : Error occurred while reading Opportunity Data : " + generalException.ToString());
     }
     return(null);
 }
        public OpportunityData GetOpportunityChatUpdateData(IXNCustomData chatData, string eventName)
        {
            try
            {
                IMessage     message  = chatData.InteractionEvent;
                SFDCCallType callType = chatData.InteractionType;
                string       duration = chatData.Duration;
                this._logger.Info("GetOpportunityChatUpdateData :  Reading Opportunity Update Data.....");
                this._logger.Info("GetOpportunityChatUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null)
                {
                    OpportunityData opportunity = new OpportunityData();

                    #region Collect opportunity Data

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

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

                    #endregion Collect opportunity Data

                    return(opportunity);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetOpportunityChatUpdateData : Error occurred while reading Opportunity Data : " + generalException.ToString());
            }
            return(null);
        }
        public OpportunityData GetOpportunityVoiceUpdateData(IMessage message, string eventName, SFDCCallType callType, string duration, string notes)
        {
            try
            {
                this._logger.Info("GetOpportunityVoiceUpdateData :  Reading Opportunity Update Data.....");
                this._logger.Info("GetOpportunityVoiceUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null)
                {
                    OpportunityData opportunity = new OpportunityData();

                    #region Collect opportunity Data

                    opportunity.ObjectName = _opportunityVoiceOptions.ObjectName;

                    if (callType == SFDCCallType.InboundVoice)
                    {
                        if (_opportunityVoiceOptions.InboundCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, popupEvent, callType, duration, voiceComments: notes);
                            if (!string.IsNullOrWhiteSpace(_opportunityVoiceOptions.VoiceAppendActivityLogEventNames) && _opportunityVoiceOptions.VoiceAppendActivityLogEventNames.Contains(eventName))
                            {
                                opportunity.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, null, callType, duration, voiceComments: notes, isAppendLogData: true);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundVoiceSuccess || callType == SFDCCallType.OutboundVoiceFailure)
                    {
                        if (_opportunityVoiceOptions.OutboundCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, popupEvent, callType, duration, voiceComments: notes);
                            if (!string.IsNullOrWhiteSpace(_opportunityVoiceOptions.VoiceAppendActivityLogEventNames) && _opportunityVoiceOptions.VoiceAppendActivityLogEventNames.Contains(eventName))
                            {
                                opportunity.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, null, callType, duration, voiceComments: notes, isAppendLogData: true);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.ConsultVoiceReceived)
                    {
                        if (_opportunityVoiceOptions.ConsultCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, popupEvent, callType, duration, voiceComments: notes);
                            if (!string.IsNullOrWhiteSpace(_opportunityVoiceOptions.VoiceAppendActivityLogEventNames) && _opportunityVoiceOptions.VoiceAppendActivityLogEventNames.Contains(eventName))
                            {
                                opportunity.AppendActivityLogData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityLogConfig, null, callType, duration, voiceComments: notes, isAppendLogData: true);
                            }
                        }
                    }

                    if (_opportunityVoiceOptions.CanUpdateRecordData)
                    {
                        opportunity.UpdateRecordFields     = true;
                        opportunity.UpdateRecordFieldsData = this._sfdcUtility.GetUpdateActivityLogData(this._opportunityVoiceRecordConfig, popupEvent, callType, duration);
                    }

                    #endregion Collect opportunity Data

                    return(opportunity);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetOpportunityVoiceUpdateData : Error occurred while reading opportunity Data : " + generalException.ToString());
            }
            return(null);
        }
        /// <summary>
        /// Get Account Popup Data for Email
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <returns></returns>
        public OpportunityData GetOpportunityEmailPopupData(IXNCustomData emailData, SFDCCallType callType)
        {
            try
            {
                this._logger.Info("GetLeadEmailPopupData :  Reading Account Popup Data.....");
                this._logger.Info("GetLeadEmailPopupData :  CallType Name : " + callType.ToString());

                if (emailData != null)
                {
                    OpportunityData _opportunity = new OpportunityData();

                    #region Collect opportunity Data

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

                    #endregion Collect opportunity Data

                    return(_opportunity);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Error("GetLeadEmailPopupData : Error occurred while reading Account Data : " + generalException.ToString());
            }
            return(null);
        }
        public IOpportunity GetOpportunityChatUpdateData(IMessage message, SFDCCallType callType, string duration, string chatContent)
        {
            try
            {
                this.logger.Info("GetOpportunityChatUpdateData :  Reading Opportunity Update Data.....");
                this.logger.Info("GetOpportunityChatUpdateData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                if (popupEvent != null)
                {
                    IOpportunity opportunity = new OpportunityData();

                    #region Collect Lead Data

                    opportunity.ObjectName = opportunityChatOptions.ObjectName;
                    if (callType == SFDCCallType.InboundChat)
                    {
                        if (opportunityChatOptions.InboundCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetChatUpdateActivityLog(this.OpportunityChatLogConfig, popupEvent, callType, duration, chatContent);
                        }
                    }
                    else
                    if (callType == SFDCCallType.ConsultChatReceived)
                    {
                        if (opportunityChatOptions.ConsultCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetChatUpdateActivityLog(this.OpportunityChatLogConfig, popupEvent, callType, duration, chatContent);
                        }
                    }
                    else if (callType == SFDCCallType.ConsultChatSuccess || callType == SFDCCallType.ConsultChatFailure)
                    {
                        if (opportunityChatOptions.ConsultCanUpdateLog)
                        {
                            opportunity.UpdateActivityLog     = true;
                            opportunity.UpdateActivityLogData = this.sfdcObject.GetChatUpdateActivityLog(this.OpportunityChatLogConfig, popupEvent, callType, duration, chatContent);
                        }
                    }
                    //update opportunity record fields
                    opportunity.UpdateRecordFields = opportunityChatOptions.CanUpdateRecordData;
                    if (GetNoRecordFoundAction(callType, opportunityChatOptions).Equals("createnew") && this.OpportunityRecordConfig != null)
                    {
                        if (opportunityChatOptions.CanUpdateRecordData)
                        {
                            opportunity.UpdateRecordFieldsData = this.sfdcObject.GetChatUpdateActivityLog(this.OpportunityRecordConfig, popupEvent, callType, duration, chatContent);
                        }
                    }

                    #endregion Collect Lead Data

                    return(opportunity);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetOpportunityChatUpdateData : Error occurred while reading Opportunity Data : " + generalException.ToString());
            }
            return(null);
        }