示例#1
0
 public void NotifyEventIMessage(KeyValueCollection userData)
 {
     if (userData.ContainsKey("GSW_USER_EVENT") && _campaignStatus.Contains(userData["GSW_USER_EVENT"]))
     {
         OutboundDataContext.GetInstance().Date           = DateTime.Now.ToString();
         OutboundDataContext.GetInstance().CampaignStatus = userData["GSW_USER_EVENT"].ToString();
         if (userData.ContainsKey("GSW_CAMPAIGN_NAME"))
         {
             OutboundDataContext.GetInstance().CampaignName = userData["GSW_CAMPAIGN_NAME"].ToString();
         }
         if (userData.ContainsKey("GSW_CAMPAIGN_DESCRIPTION"))
         {
             OutboundDataContext.GetInstance().Description = userData["GSW_CAMPAIGN_DESCRIPTION"].ToString();
         }
         if (userData.ContainsKey("GSW_CAMPAIGN_MODE"))
         {
             OutboundDataContext.GetInstance().DeliveryMode         = userData["GSW_CAMPAIGN_MODE"].ToString();
             OutboundDataContext.GetInstance().GRCampaignModeHeight = GridLength.Auto;
         }
         else
         {
             OutboundDataContext.GetInstance().DeliveryMode         = "-";
             OutboundDataContext.GetInstance().GRCampaignModeHeight = new GridLength(0);
         }
         _campaignNotifier.Show();
         _campaignNotifier.Notify(100, false);
         if (OutboundDataContext.GetInstance().MyCampaigns.Any(p => p.CampaignName == OutboundDataContext.GetInstance().CampaignName))
         {
             int i = OutboundDataContext.GetInstance().MyCampaigns.IndexOf(OutboundDataContext.GetInstance().MyCampaigns.Where(p => p.CampaignName == OutboundDataContext.GetInstance().CampaignName).FirstOrDefault());
             if (OutboundDataContext.GetInstance().CampaignStatus.ToLower().Trim() == "campaignstarted")
             {
                 OutboundDataContext.GetInstance().MyCampaigns.RemoveAt(i);
                 OutboundDataContext.GetInstance().CampaignStatusImageSource = new BitmapImage(new Uri("/Pointel.Interactions.Outbound;component/Images/Start.png", UriKind.Relative));
                 OutboundDataContext.GetInstance().MyCampaigns.Insert(0, (new MyCampaigns(OutboundDataContext.GetInstance().CampaignStatusImageSource, OutboundDataContext.GetInstance().CampaignName, OutboundDataContext.GetInstance().DeliveryMode, OutboundDataContext.GetInstance().Date, "")));
             }
             else if (OutboundDataContext.GetInstance().CampaignStatus.ToLower().Trim() == "campaignunloaded")
             {
                 var getCampaign = OutboundDataContext.GetInstance().MyCampaigns.Where(x => x.CampaignName == OutboundDataContext.GetInstance().CampaignName).ToList();
                 if (getCampaign.Count > 0)
                 {
                     foreach (var data in getCampaign)
                     {
                         OutboundDataContext.GetInstance().MyCampaigns.Remove(data);
                     }
                 }
             }
             else
             {
                 OutboundDataContext.GetInstance().MyCampaigns.RemoveAt(i);
                 OutboundDataContext.GetInstance().CampaignStatusImageSource = new BitmapImage(new Uri("/Pointel.Interactions.Outbound;component/Images/Stop.png", UriKind.Relative));
                 OutboundDataContext.GetInstance().MyCampaigns.Insert(0, (new MyCampaigns(OutboundDataContext.GetInstance().CampaignStatusImageSource, OutboundDataContext.GetInstance().CampaignName, OutboundDataContext.GetInstance().DeliveryMode, OutboundDataContext.GetInstance().Date, "")));
             }
         }
         else
         {
             OutboundDataContext.GetInstance().CampaignStatusImageSource = new BitmapImage(new Uri("/Pointel.Interactions.Outbound;component/Images/Stop.png", UriKind.Relative));
             OutboundDataContext.GetInstance().MyCampaigns.Add(new MyCampaigns(OutboundDataContext.GetInstance().CampaignStatusImageSource, OutboundDataContext.GetInstance().CampaignName, OutboundDataContext.GetInstance().DeliveryMode, OutboundDataContext.GetInstance().Date, ""));
         }
     }
 }
        /// <summary>
        /// Gets the supported object.
        /// </summary>
        /// <param name="statName">Name of the stat.</param>
        /// <returns></returns>
        public string GetSupportedObject(string statName)
        {
            string objectType = string.Empty;

            try
            {
                logger.Debug("StatisticsSupport : GetDescriptions Method : Entry");

                foreach (string statistics in Settings.GetInstance().DictServerStatistics.Keys)
                {
                    if (string.Compare(statistics, statName, true) == 0)
                    {
                        KeyValueCollection kvpcollection = new KeyValueCollection();
                        kvpcollection = Settings.GetInstance().DictServerStatistics[statistics];

                        if (kvpcollection.ContainsKey("Objects"))
                        {
                            if (kvpcollection["Objects"].ToString().Contains(","))
                            {
                                string[] Temp = kvpcollection["Objects"].ToString().Split(',');
                                objectType = Temp[0].ToString();
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception generalException)
            {
            }
            return(objectType);
        }
        private static KeyValueCollection GetUpdateUserData(Dictionary <string, string> UpdateUserData)
        {
            KeyValueCollection holdingUpdateUserData = new KeyValueCollection();

            foreach (string key in UpdateUserData.Keys)
            {
                if (!holdingUpdateUserData.ContainsKey(key))
                {
                    if (key == Settings.GetInstance().DispositionCollectionKey&& !string.IsNullOrEmpty(UpdateUserData[Settings.GetInstance().DispositionCollectionKey]))
                    {
                        var dict = UpdateUserData[Settings.GetInstance().DispositionCollectionKey].Split(';').Select(s => s.Split(':')).ToDictionary(a => a[0].Trim().ToString(), a => a[1].Trim().ToString());
                        KeyValueCollection tempKC = new KeyValueCollection();
                        if (dict == null && dict.Count == 0)
                        {
                            return(null);
                        }
                        foreach (string key1 in dict.Keys)
                        {
                            tempKC.Add(key1, dict[key1]);
                        }
                        holdingUpdateUserData.Add(key, tempKC);
                    }
                    else
                    {
                        holdingUpdateUserData.Add(key, UpdateUserData[key].ToString());
                    }
                }
            }
            return(holdingUpdateUserData);
        }
示例#4
0
 /// <summary>
 /// Sends the record processed.
 /// </summary>
 private void SendRecordProcessed(KeyValueCollection updateUserEventData)
 {
     try
     {
         if (updateUserEventData == null || _datacontext.userAttachData == null)
         {
             return;
         }
         if (_datacontext.userAttachData.ContainsKey("GSW_AGENT_REQ_TYPE") && updateUserEventData.ContainsKey("GSW_AGENT_REQ_TYPE"))
         {
             _datacontext.userAttachData["GSW_AGENT_REQ_TYPE"] = "RecordProcessed";
             updateUserEventData["GSW_AGENT_REQ_TYPE"]         = "RecordProceed";
             var          soft   = new SoftPhone();
             OutputValues output = soft.UpdateOCSCallData(_updateUserEventData);
             if (output.MessageCode == "200")
             {
                 _logger.Info("OCS Call Data Updated Successfully....");
             }
         }
     }
     catch (Exception generalException)
     {
         _logger.Error("Error occurred SendRecordProcessed() : " + generalException.ToString());
     }
 }
        public string GetUserDataSearchValues(KeyValueCollection userData, string[] userDataSearchKeys)
        {
            try
            {
                if (userData != null && userDataSearchKeys != null)
                {
                    string searchValues = string.Empty;
                    this.logger.Info("GetUserDataSearchValues : Reading User-Data Search Values, Keys : " + string.Join(",", userDataSearchKeys));
                    foreach (string key in userDataSearchKeys)
                    {
                        if (userData.ContainsKey(key))
                        {
                            searchValues += userData.GetAsString(key) + ",";
                        }
                        else
                        {
                            searchValues += "^,";
                        }
                    }

                    return((searchValues != string.Empty) ? searchValues.Substring(0, searchValues.Length - 1) : searchValues);
                }
                else
                {
                    this.logger.Info("GetUserDataSearchValues : user-data search key is empty");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetSearchUserDataValue : Error occurred while getting User-Data Search values : " + generalException.ToString());
            }
            return(null);
        }
 public void UpdateSelectedWorkbin()
 {
     try
     {
         if (ConfigContainer.Instance().AllKeys.Contains("CfgPerson"))
         {
             CfgPerson person = ConfigContainer.Instance().GetValue("CfgPerson") as CfgPerson;
             if (!person.UserProperties.ContainsKey("agent.ixn.desktop"))
             {
                 person.UserProperties.Add("agent.ixn.desktop", new KeyValueCollection());
             }
             KeyValueCollection option = person.UserProperties["agent.ixn.desktop"] as KeyValueCollection;
             if (!string.IsNullOrEmpty(WorkbinUtility.Instance().SelectedWorkbinName))
             {
                 if (!option.ContainsKey("workbins.workbin-selected"))
                 {
                     option.Add("workbins.workbin-selected", WorkbinUtility.Instance().SelectedWorkbinName);
                 }
                 else
                 {
                     option["workbins.workbin-selected"] = WorkbinUtility.Instance().SelectedWorkbinName;
                 }
             }
             person.UserProperties["agent.ixn.desktop"] = option;
             person.Save();
             person = null;
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error when updating selected workbin " + ex.ToString());
     }
 }
示例#7
0
        private void DoNAPopup(KeyValueCollection kvUserData)
        {
            try
            {
                _caseId = null;
                if (kvUserData != null)
                {
                    string mid = string.Empty;

                    if (kvUserData.ContainsKey("MID"))
                    {
                        mid = kvUserData.GetAsString("MID");
                    }
                    if (string.IsNullOrEmpty(mid))
                    {
                        mid = "undefined";
                    }

                    if (!string.IsNullOrEmpty(_himmsConfiguration.MIDPopupUrl))
                    {
                        if (kvUserData.ContainsKey("ConnectionId"))
                        {
                            DesktopMessenger.midHandler = this;
                            DesktopMessenger.communicateUI.NotifyMIDState(true, kvUserData.GetAsString("ConnectionId"));
                        }

                        //PopupMID(_himmsConfiguration.MIDPopupUrl + "?mid=" + mid, "MerchantPopup");
                        Navigate(_himmsConfiguration.MIDPopupUrl + "?mid=" + mid, "MerchantPopup");
                    }

                    else
                    {
                        _logger.Warn("The popup url is not specified.");
                    }
                }
                else
                {
                    _logger.Warn("The userdata object is null.");
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred as " + generalException.Message);
                _logger.Trace("Error Trace : " + generalException.StackTrace);
            }
        }
示例#8
0
        /// <summary>
        /// Gets if flags list contains the specified flag.
        /// </summary>
        /// <param name="flag">Message flag.</param>
        /// <returns>Returns true if flags list contains the specified flag.</returns>
        public bool Contains(string flag)
        {
            if (flag == null)
            {
                throw new ArgumentNullException("flag");
            }

            return(m_pFlags.ContainsKey(flag.ToLower()));
        }
示例#9
0
 /// <summary>
 /// Gets the name of the contact.
 /// </summary>
 /// <param name="keyValue">The key value.</param>
 /// <returns>System.String.</returns>
 private string getContactName(KeyValueCollection keyValue)
 {
     if (keyValue != null)
     {
         string name = string.Empty;
         if (keyValue.ContainsKey("FirstName"))
         {
             name += FirstName = keyValue["FirstName"].ToString();
         }
         if (keyValue.ContainsKey("LastName"))
         {
             LastName = keyValue["LastName"].ToString();
             name    += (string.IsNullOrEmpty(name) ? "" : " ") + LastName;
         }
         return(name);
     }
     return(null);
 }
示例#10
0
 private void HandleVoice(iCallData value)
 {
     try
     {
         Type               objType        = null;
         object             obj            = null;
         KeyValueCollection userdata       = null;
         MediaEventHelper   objEventHelper = new MediaEventHelper();
         if (objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userdata, value.EventMessage))
         {
             if (objType != null && obj != null)
             {
                 if (userdata != null && userdata.ContainsKey("AppName"))
                 {
                     if (userdata.GetAsString("AppName").ToLower() == "cs")
                     {
                         if (_himmsConfiguration.AppLocation == "na")
                         {
                             DoNAPopup(userdata);
                         }
                         else if (_himmsConfiguration.AppLocation == "eu")
                         {
                             DoEUPopup(userdata);
                         }
                         else
                         {
                             _logger.Warn("Invalid application location in the HIMMS integration. Application location: " + _himmsConfiguration.AppLocation);
                         }
                     }
                     else
                     {
                         _logger.Trace("There is invalid value in the 'AppName'");
                     }
                 }
                 else
                 {
                     _logger.Trace("The 'AppName' key not found in the user data.");
                 }
             }
             else
             {
                 _logger.Warn("The event object is null.");
             }
         }
         else
         {
             _logger.Warn("Voice event conversion getting failed");
         }
     }
     catch (Exception generalException)
     {
         _logger.Error("Error occurred as " + generalException.Message);
         _logger.Trace("Error Trace : " + generalException.StackTrace);
     }
 }
        public void TestContainsKey_SingleKeyExists()
        {
            var key        = @"TestKey";
            var collection = new KeyValueCollection <string, JackpotLog>(@"TestCollection", _database);

            var transaction = JackpotLog.Randomize(new Random());

            collection.Add(key, transaction);

            Assert.IsTrue(collection.ContainsKey(key));
        }
        public void TestContainsKey_MultipleKeysExist()
        {
            var key1 = @"TestKey1";
            var key2 = @"TestKey2";
            var key3 = @"TestKey3";

            var collection = new KeyValueCollection <string, JackpotLog>(@"TestCollection", _database);

            var transaction1 = JackpotLog.Randomize(new Random());
            var transaction2 = JackpotLog.Randomize(new Random());
            var transaction3 = JackpotLog.Randomize(new Random());

            collection.Add(key1, transaction1);
            collection.Add(key2, transaction2);
            collection.Add(key3, transaction3);

            Assert.IsTrue(collection.ContainsKey(key1));
            Assert.IsTrue(collection.ContainsKey(key2));
            Assert.IsTrue(collection.ContainsKey(key3));
        }
        /// <summary>
        /// Gets the descriptions.
        /// </summary>
        public void GetDescriptions(string objecType)
        {
            try
            {
                logger.Debug("StatisticsSupport : GetDescriptions Method : Entry");

                foreach (string statistics in Settings.GetInstance().DictServerStatistics.Keys)
                {
                    KeyValueCollection kvpcollection = new KeyValueCollection();
                    kvpcollection = Settings.GetInstance().DictServerStatistics[statistics];

                    if (kvpcollection.ContainsKey("Objects"))
                    {
                        if (kvpcollection["Objects"].ToString().Contains(objecType))
                        {
                            if (kvpcollection.ContainsKey("Description"))
                            {
                                if (!Settings.GetInstance().DictStatisticsDesc.ContainsKey(statistics))
                                {
                                    Settings.GetInstance().DictStatisticsDesc.Add(statistics, kvpcollection["Description"].ToString());
                                }
                            }
                            else
                            {
                                if (!Settings.GetInstance().DictStatisticsDesc.ContainsKey(statistics))
                                {
                                    Settings.GetInstance().DictStatisticsDesc.Add(statistics, statistics);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception GeneralException)
            {
                logger.Error("StatisticsSupport : GetDescriptions Method : " + GeneralException.Message);
            }
            logger.Debug("StatisticsSupport : GetDescriptions Method : Exit");
        }
 /// <summary>
 /// Processes the configuration data.
 /// </summary>
 /// <param name="configurationData">The configuration data.</param>
 private void ProcessConfigurationData(KeyValueCollection configurationData)
 {
     try
     {
         if (configurationData.ContainsKey("speed-dial.contacts"))
         {
             if (configurationData["speed-dial.contacts"] != null)
             {
                 ReadSpeedDialContacts(configurationData["speed-dial.contacts"] as KeyValueCollection);
             }
         }
     }
     catch
     {
     }
 }
        private static string ProcessUserData(KeyValueCollection userData)
        {
            string queryString = string.Empty;
            int    paramIndex  = 0;

            if (userData != null)
            {
                foreach (string userDataName in Settings.GetInstance().PortSetting.SendUserDataName)
                {
                    if (userData.ContainsKey(userDataName))
                    {
                        queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + Settings.GetInstance().PortSetting.SendUserDataValue[paramIndex] + "=" + userData[userDataName].ToString();
                        paramIndex++;
                    }
                }
            }
            return(queryString);
        }
示例#16
0
        private void DoEUPopup(KeyValueCollection kvUserData)
        {
            try
            {
                _caseId = null;
                if (kvUserData == null)
                {
                    _logger.Warn("The userdata is null to process the HIMMS integration.");
                    return;
                }

                if (kvUserData.ContainsKey("ConnectionId"))
                {
                    DesktopMessenger.midHandler = this;
                    DesktopMessenger.communicateUI.NotifyMIDState(true, kvUserData.GetAsString("ConnectionId"));
                }

                bool   isShowPopupTab = kvUserData.ContainsKey("MIDPop") && kvUserData.GetAsString("MIDPop").ToLower() == "true";
                string mid            = string.Empty;
                //  string caseId = string.Empty;
                string caseIdPopupURL = _himmsConfiguration.CaseIdPopupUrl;
                string urlToPopup     = "";
                string title          = "";
                if (kvUserData.ContainsKey("MID"))
                {
                    mid = kvUserData.GetAsString("MID");
                }

                if (kvUserData.ContainsKey("CaseID"))
                {
                    _caseId = kvUserData.GetAsString("CaseID");
                }

                if (kvUserData.ContainsKey("CASD_URL") && kvUserData.GetAsString("CASD_URL").ToLower() != "undefined" &&
                    kvUserData.GetAsString("CASD_URL").ToLower() != "null")
                {
                    caseIdPopupURL = kvUserData.GetAsString("CASD_URL");
                    title          = "casd";
                    //  PopupCaseURL(caseIdPopupURL, "casd");
                    urlToPopup = caseIdPopupURL;
                    //  return;
                }

                if (isShowPopupTab)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(_caseId) && _caseId != "invalid" && _caseId != "unknown")
                {
                    //PopupCaseID(_himmsConfiguration.CaseIdPopupUrl + "?extcaseId=" + _caseId, "caseManagement");
                    urlToPopup = _himmsConfiguration.CaseIdPopupUrl + "?extcaseId=" + _caseId;
                    title      = "caseManagement";
                }
                else if (!string.IsNullOrEmpty(mid) && mid != "invalid" && mid != "unknown")
                {
                    title      = "MerchantPopup";
                    urlToPopup = _himmsConfiguration.MIDPopupUrl + "?mid=" + mid;
                    //PopupMID(_himmsConfiguration.MIDPopupUrl + "?mid=" + mid, "MerchantPopup");
                }

                else
                {
                    title      = "MerchantPopup";
                    urlToPopup = _himmsConfiguration.MIDPopupUrl + "?mid=" + mid;
                    //PopupMID(_himmsConfiguration.MIDPopupUrl + "?mid=" + mid, "MerchantPopup");
                }

                Navigate(urlToPopup, title);
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred as " + generalException.Message);
                _logger.Trace("Error Trace : " + generalException.StackTrace);
            }
        }
        /// <summary>
        /// Sends Update Log Data
        /// </summary>
        /// <param name="connId"></param>
        /// <param name="sfdcData"></param>
        public void SendUpdateLogData(string connId, SFDCData sfdcData)
        {
            try
            {
                logger.Info("SendUpdateLogData : Collects Update Log data");
                logger.Info("Connection ID : " + connId);

                if (Settings.UpdateSFDCLog.ContainsKey(connId))
                {
                    UpdateLogData updateData = Settings.UpdateSFDCLog[connId];
                    if (updateData != null)
                    {
                        if (sfdcData.LeadData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending Lead Update Log data");
                            sfdcData.LeadData.ActivityRecordID = updateData.LeadActivityId;
                            sfdcData.LeadData.RecordID         = updateData.LeadRecordId;
                        }
                        if (sfdcData.ContactData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending Contact Update Log data");
                            sfdcData.ContactData.ActivityRecordID = updateData.ContactActivityId;
                            sfdcData.ContactData.RecordID         = updateData.ContactRecordId;
                        }
                        if (sfdcData.AccountData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending Account Update Log data");
                            sfdcData.AccountData.ActivityRecordID = updateData.AccountActivityId;
                            sfdcData.AccountData.RecordID         = updateData.AccountRecordId;
                        }
                        if (sfdcData.CaseData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending Case Update Log data");
                            sfdcData.CaseData.ActivityRecordID = updateData.CaseActivityId;
                            sfdcData.CaseData.RecordID         = updateData.CaseRecordId;
                        }
                        if (sfdcData.OpportunityData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending Opportunity Update Log data");
                            sfdcData.OpportunityData.ActivityRecordID = updateData.OpportunityActivityId;
                            sfdcData.OpportunityData.RecordID         = updateData.OpportunityRecordId;
                        }
                        if (sfdcData.UserActivityData != null)
                        {
                            logger.Info("SendUpdateLogData : Sending UserActivity Update Log data");
                            sfdcData.UserActivityData.RecordID = updateData.UserActivityId;
                        }
                        if (sfdcData.CustomObjectData != null && updateData.CustomObject != null)
                        {
                            foreach (CustomObjectData custom in sfdcData.CustomObjectData)
                            {
                                if (updateData.CustomObject.ContainsKey(custom.ObjectName))
                                {
                                    KeyValueCollection collection = updateData.CustomObject[custom.ObjectName];
                                    if (collection != null)
                                    {
                                        logger.Info("SendUpdateLogData : Sending CustomObject Update Log data");
                                        if (collection.ContainsKey("newRecordId"))
                                        {
                                            custom.RecordID = collection["newRecordId"].ToString();
                                        }

                                        if (collection.ContainsKey("activityRecordId"))
                                        {
                                            custom.ActivityRecordID = collection["activityRecordId"].ToString();
                                        }
                                    }
                                }
                            }
                        }
                        SendPopupData(connId, sfdcData);
                    }
                }
                if (!Settings.UpdateSFDCLogFinishedEvent.ContainsKey(connId))
                {
                    Settings.UpdateSFDCLogFinishedEvent.Add(connId, sfdcData);
                }
                else
                {
                    Settings.UpdateSFDCLogFinishedEvent[connId] = sfdcData;
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("SendUpdateLogData : Error occurred while sending update Log :" + generalException.ToString());
            }
        }
示例#18
0
        /// <summary>
        /// Reads the file integration key collections.
        /// </summary>
        /// <param name="configProtocol">The configuration protocol.</param>
        /// <param name="applicationName">Name of the application.</param>
        /// <returns></returns>

        #region ReadFileIntegrationKeyCollections

        public iCallData ReadFileIntegrationKeyCollections(ConfService configProtocol, string applicationName)
        {
            iCallData result   = null;
            string    value    = string.Empty;
            int       paramKey = 0;

            try
            {
                result           = new CallData();
                result.FileData  = new FileIntegration();
                result.PortData  = new PortIntegration();
                result.PipeData  = new PipeIntegration();
                result.CrmDbData = new CrmDbIntegration();

                CfgApplication      application = new CfgApplication(configProtocol);
                CfgApplicationQuery queryApp    = new CfgApplicationQuery();
                //queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid;
                queryApp.Name = applicationName;
                application   = configProtocol.RetrieveObject <CfgApplication>(queryApp);
                if (application != null)
                {
                    string[] applicationKeys = application.Options.AllKeys;

                    string[] applicationUserPropertieskeys = application.UserProperties.AllKeys;

                    foreach (string section in applicationUserPropertieskeys)
                    {
                        if (string.Compare(section, "facet.user.data", true) == 0)
                        {
                            KeyValueCollection kvColl = new KeyValueCollection();
                            kvColl = (KeyValueCollection)application.UserProperties["facet.user.data"];
                            logger.Debug("Retrieving values from facet.user.data section");
                            setting.attachDataList.Clear();
                            if (kvColl != null)
                            {
                                for (int i = 1; i <= (kvColl.Count / 2); i++)
                                {
                                    if (kvColl.ContainsKey("facet.userdata.key" + i.ToString()))
                                    {
                                        if (kvColl["facet.userdata.key" + i.ToString()].ToString() != null &&
                                            kvColl["facet.userdata.key" + i.ToString()].ToString() != string.Empty)
                                        {
                                            if (kvColl.ContainsKey("facet.tag.name" + i.ToString()))
                                            {
                                                if (kvColl["facet.tag.name" + i.ToString()].ToString() != null &&
                                                    kvColl["facet.tag.name" + i.ToString()].ToString() != string.Empty)
                                                {
                                                    if (!setting.attachDataList.ContainsKey(kvColl["facet.tag.name" + i.ToString()].ToString()))
                                                    {
                                                        setting.attachDataList.Add(kvColl["facet.tag.name" + i.ToString()].ToString(),
                                                                                   kvColl["facet.userdata.key" + i.ToString()].ToString());
                                                        logger.Debug("Key : facet.tag.name" + i.ToString() + " Value : " + kvColl["facet.tag.name" + i.ToString()].ToString());
                                                        logger.Debug("Key : facet.userdata.key" + i.ToString() + " Value : " + kvColl["facet.userdata.key" + i.ToString()].ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    ConfigContainer.Instance().ReadSection("file-integration");
                    if (ConfigContainer.Instance().AllKeys.Contains("file-integration"))
                    {
                        KeyValueCollection _tempcoll = ConfigContainer.Instance().GetValue("file-integration");
                    }
                    foreach (string section in applicationKeys)
                    {
                        if (string.Compare(section, "file-integration", true) == 0 && Settings.GetInstance().EnableFileCommunication)
                        {
                            KeyValueCollection getFileIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //code added by vinoth for bcbs version to show calldata pop up
                            result.FileData.EnableView = true;
                            //End
                            foreach (string fileKey in getFileIntegrationCollection.AllKeys)
                            {
                                Regex re = new Regex(@"\d+");
                                Match m  = re.Match(fileKey);
                                if (m.Success)
                                {
                                    paramKey = Convert.ToInt16(m.Value);
                                }
                                if (string.Compare(fileKey, "directory", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.DirectoryPath = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file-name", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.FileName = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file-format", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.FileFormat = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file.string-delimiter", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.Delimiter = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file.event.data-type", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.CallDataEventFileType = getFileIntegrationCollection[fileKey].ToString().Split(new char[] { ',' });
                                }
                                else if (string.Compare(fileKey, "enable.view", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.EnableView = Convert.ToBoolean(getFileIntegrationCollection[fileKey].ToString());
                                }
                                else if (string.Compare(fileKey, "content-type", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.ContentType = getFileIntegrationCollection[fileKey].ToString();
                                }
                                //else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0)
                                //{
                                //    value += getFileIntegrationCollection[fileKey].ToString() + ",";

                                //}
                                else if (string.Compare(fileKey, "file" + paramKey + ".param", true) == 0)
                                {
                                    try
                                    {
                                        if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".user-data.key"))
                                        {
                                            result.FileData.ParameterName.Add(getFileIntegrationCollection[fileKey].ToString()
                                                                              , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".user-data.key"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                                else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0)
                                {
                                    try
                                    {
                                        if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".attribute.param"))
                                        {
                                            result.FileData.ParameterValue.Add(getFileIntegrationCollection[fileKey].ToString()
                                                                               , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".attribute.param"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                            }
                            //result.FileData.AttributeFilter= value.ToString().Split(new char[] { ',' }); ;
                            getFileIntegrationCollection.Clear();
                            value = string.Empty;
                        }
                        else if (string.Compare(section, "port-integration", true) == 0 && Settings.GetInstance().EnablePortCommunication)
                        {
                            KeyValueCollection getPortIntegrationCollection = (KeyValueCollection)application.Options[section];
                            // paramKey = 0;
                            foreach (string portKey in getPortIntegrationCollection.AllKeys)
                            {
                                switch (portKey)
                                {
                                case "ip-address":
                                    setting.PortSetting.HostName = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "receiving.data.port":
                                    setting.PortSetting.IncomingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString());
                                    break;

                                case "sending.data.port":
                                    setting.PortSetting.OutGoingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString());
                                    break;

                                case "port.send.delimiter":
                                    setting.PortSetting.SendDataDelimiter = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.receive.delimiter":
                                    setting.PortSetting.ReceiveDataDelimiter = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.call-media":
                                    setting.PortSetting.CallMedia = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.listen.event":
                                    //if (!string.IsNullOrEmpty(getPortIntegrationCollection[portKey].ToString()) && !string.IsNullOrWhiteSpace(getPortIntegrationCollection[portKey].ToString()))
                                    setting.PortSetting.CallDataEventType = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.receive.key-name":
                                    setting.PortSetting.ReceiveDatakey = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.receive.connid-key-name":
                                    setting.PortSetting.ReceiveConnectionIdName = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.webservicereference-url":
                                    setting.PortSetting.WebServiceURL = getPortIntegrationCollection[portKey].ToString();
                                    break;
                                }
                            }

                            //Code to get list of key names and param name
                            for (int i = 0; true; i++)
                            {
                                string keyName   = "port.attribute" + i + ".key-name";
                                string paramName = "port.attribute" + i + ".param-name";
                                if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName))
                                {
                                    setting.PortSetting.SendAttributeKeyName.Add(getPortIntegrationCollection[keyName].ToString());
                                    setting.PortSetting.SendAttributeValue.Add(getPortIntegrationCollection[paramName].ToString());
                                }
                                else
                                {
                                    break;
                                }
                            }

                            //Code to get list of user data's key names and param name
                            for (int j = 0; true; j++)
                            {
                                string keyName   = "port.user-data" + j + ".key-name";
                                string paramName = "port.user-data" + j + ".param-name";
                                if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName))
                                {
                                    setting.PortSetting.SendUserDataName.Add(getPortIntegrationCollection[keyName].ToString());
                                    setting.PortSetting.SendUserDataValue.Add(getPortIntegrationCollection[paramName].ToString());
                                }
                                else
                                {
                                    break;
                                }
                            }
                            getPortIntegrationCollection.Clear();
                        }
                        else if (string.Compare(section, "pipe-integration", true) == 0 && Settings.GetInstance().EnablePipeCommunication)
                        {
                            //KeyValueCollection getPipeIntegrationCollection = (KeyValueCollection)application.Options[section];
                            ////paramKey = 0;
                            //foreach (string pipeKey in getPipeIntegrationCollection.AllKeys)
                            //{
                            //    Regex re = new Regex(@"\d+");
                            //    Match m = re.Match(pipeKey);
                            //    if (m.Success)
                            //    {
                            //        paramKey = Convert.ToInt16(m.Value);
                            //    }
                            //    if (string.Compare(pipeKey, "pipe.server-first", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.PipeFist = Convert.ToBoolean(getPipeIntegrationCollection[pipeKey].ToString().ToLower());
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.name", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.PipeName = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }

                            //    else if (string.Compare(pipeKey, "pipe.string-delimiter", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.Delimiter = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.format", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.FileFormat = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.event.data-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.CallDataEventPipeType = getPipeIntegrationCollection[pipeKey].ToString().Split(new char[] { ',' });
                            //    }
                            //    //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    //{
                            //    //    value += getPipeIntegrationCollection[pipeKey].ToString() + ",";

                            //    //}
                            //    //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    //{
                            //    //    value += getPipeIntegrationCollection[pipeKey].ToString() + ",";

                            //    //}
                            //    else if (string.Compare(pipeKey, "pipe" + paramKey + ".param", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".user-data.key"))
                            //                result.PipeData.ParameterName.Add(getPipeIntegrationCollection[pipeKey].ToString()
                            //                    , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".user-data.key"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        result.PipeData.ParameterName.Add(pipeKey, getPipeIntegrationCollection[pipeKey].ToString());
                            //        // paramKey++;
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".attribute.param"))
                            //                result.PipeData.ParameterValue.Add(getPipeIntegrationCollection[pipeKey].ToString()
                            //                    , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".attribute.param"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        // paramKey++;
                            //    }
                            //}
                            //// result.PipeData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            //getPipeIntegrationCollection.Clear();
                            //value = string.Empty;
                        }
                        else if (string.Compare(section, "url-integration", true) == 0 && Settings.GetInstance().EnableURLCommunication)
                        {
                            //KeyValueCollection getUrlIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //// paramKey = 0;
                            //foreach (string urlKey in getUrlIntegrationCollection.AllKeys)
                            //{
                            //    Regex re = new Regex(@"\d+");
                            //    Match m = re.Match(urlKey);
                            //    if (m.Success)
                            //    {
                            //        paramKey = Convert.ToInt16(m.Value);
                            //    }

                            //    if (string.Compare(urlKey, "enable.validate.queue-login", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsValidateQueueLogin = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "browser-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.BrowserType = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "popup.url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //        result.URLData.PopUpUrl = popurl[0];
                            //    }
                            //    else if (string.Compare(urlKey, "login.url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //        result.URLData.LoginUrl = popurl[0];
                            //    }
                            //    else if (string.Compare(urlKey, "enable.login-popup-url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsLoginUrlEnable = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }

                            //    else if (string.Compare(urlKey, "enable.web-page-address-bar", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsBrowserAddress = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "enable.web-page-status-bar", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsBrowserStatusBar = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }

                            //    else if (string.Compare(urlKey, "url.qs.delimiter", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.Delimiter = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "url.event.data-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.CallDataEventUrlType = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //    }
                            //    else if (string.Compare(urlKey, "enable.web-page-inside-aid", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsWebPageEnabled = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "web-page.name-aid", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.WebPageName = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "control.popup-single-browser", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsSingleBrowser = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "url" + paramKey + ".param", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".user-data.key"))
                            //                result.URLData.ParameterName.Add(getUrlIntegrationCollection[urlKey].ToString()
                            //                    , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".user-data.key"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        //  paramKey++;
                            //    }
                            //    else if (string.Compare(urlKey, "url" + paramKey + ".attribute", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".attribute.param"))
                            //                result.URLData.ParameterValue.Add(getUrlIntegrationCollection[urlKey].ToString()
                            //                    , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".attribute.param"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        // paramKey++;
                            //    }
                            //}
                            ////result.URLData .AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            //getUrlIntegrationCollection.Clear();
                            //value = string.Empty;
                        }
                        else if (string.Compare(section, "db-integration", true) == 0 && Settings.GetInstance().EnableCrmDbCommunication)
                        {
                            KeyValueCollection getCrmIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //paramKey = 0;

                            foreach (string portKey in getCrmIntegrationCollection.AllKeys)
                            {
                                Regex re = new Regex(@"\d+");
                                Match m  = re.Match(portKey);
                                if (m.Success)
                                {
                                    paramKey = Convert.ToInt16(m.Value);
                                }
                                if (string.Compare(portKey, "db.sqlliteconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.DirectoryPath = getCrmIntegrationCollection[portKey].ToString();
                                }

                                else if (string.Compare(portKey, "db-type", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.CrmDbFormat = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.string-delimiter", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.Delimiter = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.sqlconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.ConnectionSqlPath = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.oracleconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.ConnectionOraclePath = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.event.data-type", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.CallDataEventDBType = getCrmIntegrationCollection[portKey].ToString().Split(new char[] { ',' });
                                }
                                //else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0)
                                //{
                                //    value += getCrmIntegrationCollection[portKey].ToString() + ",";

                                //}
                                else if (string.Compare(portKey, "db" + paramKey + ".param", true) == 0)
                                {
                                    try
                                    {
                                        if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".user-data.key"))
                                        {
                                            result.CrmDbData.ParameterName.Add(getCrmIntegrationCollection[portKey].ToString()
                                                                               , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".user-data.key"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                                else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0)
                                {
                                    try
                                    {
                                        if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".attribute.param"))
                                        {
                                            result.CrmDbData.ParameterValue.Add(getCrmIntegrationCollection[portKey].ToString()
                                                                                , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".attribute.param"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                            }
                            //result.CrmDbData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            getCrmIntegrationCollection.Clear();
                            value = string.Empty;
                        }
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while reading KVP's for File Popup " + generalException.ToString());
            }
            return(result);
        }
示例#19
0
        public KeyValueCollection ReadGeneralConfigurations(CfgApplication myApplication, List <CfgAgentGroup> agentGroups, CfgPerson personObject)
        {
            try
            {
                logger.Info("ReadGeneralConfigurations : Reading salesforce-integration Configuration");
                KeyValueCollection SFDCConfig = null;

                #region Reading General Configurations

                try
                {
                    if (myApplication != null)
                    {
                        //Reading Agent Level Configurations
                        if (myApplication.Options.ContainsKey("salesforce-integration"))
                        {
                            SFDCConfig = myApplication.Options.GetAsKeyValueCollection("salesforce-integration");
                            this.logger.Info("ReadGeneralConfigurations : " + (SFDCConfig != null ? "Read Configuration at Application Level" : " No configuration found at Application Level"));
                        }
                        else
                        {
                            this.logger.Info("ReadGeneralConfigurations : SFDC General Configuration is not found at Application Level.");
                        }
                    }
                }
                catch (Exception generalException)
                {
                    this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at application level :" + generalException.ToString());
                }

                //Reading AgentGroupLevel Configurartions

                try
                {
                    if (agentGroups != null)
                    {
                        foreach (CfgAgentGroup agentgroup in agentGroups)
                        {
                            if (agentgroup.GroupInfo.UserProperties.ContainsKey("salesforce-integration"))
                            {
                                KeyValueCollection agentGroupConfig = agentgroup.GroupInfo.UserProperties.GetAsKeyValueCollection("salesforce-integration");
                                if (agentGroupConfig != null)
                                {
                                    if (SFDCConfig != null)
                                    {
                                        foreach (string key in agentGroupConfig.AllKeys)
                                        {
                                            if (SFDCConfig.ContainsKey(key))
                                            {
                                                SFDCConfig.Set(key, agentGroupConfig.GetAsString(key));
                                            }
                                            else
                                            {
                                                SFDCConfig.Add(key, agentGroupConfig.GetAsString(key));
                                            }
                                        }
                                    }
                                    else
                                    {
                                        SFDCConfig = agentGroupConfig;
                                    }
                                    logger.Info("ReadGeneralConfigurations : SFDC configuration taken from Agent Group : " + agentgroup.GroupInfo.Name);
                                    break;
                                }
                            }
                            else
                            {
                                logger.Info("ReadGeneralConfigurations : No SFDC configuration found at Agent Group : " + agentgroup.GroupInfo.Name);
                            }
                        }
                    }
                }
                catch (Exception generalException)
                {
                    this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at AgentGroup level :" + generalException.ToString());
                }

                //Reading Agent Level Configurations

                try
                {
                    if (personObject.UserProperties.ContainsKey("salesforce-integration"))
                    {
                        KeyValueCollection agentConfig = personObject.UserProperties.GetAsKeyValueCollection("salesforce-integration");
                        if (agentConfig != null)
                        {
                            if (SFDCConfig != null)
                            {
                                foreach (string key in agentConfig.AllKeys)
                                {
                                    if (SFDCConfig.ContainsKey(key))
                                    {
                                        SFDCConfig.Set(key, agentConfig.GetAsString(key));
                                    }
                                    else
                                    {
                                        SFDCConfig.Add(key, agentConfig.GetAsString(key));
                                    }
                                }
                            }
                            else
                            {
                                SFDCConfig = agentConfig;
                            }
                        }
                    }
                    else
                    {
                        logger.Info("ReadGeneralConfigurations :  No SFDC configuration found at Agent Level");
                    }
                }
                catch (Exception generalException)
                {
                    this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at Agent level :" + generalException.ToString());
                }

                #endregion Reading General Configurations

                if (SFDCConfig != null)
                {
                    logger.Info("ReadGeneralConfigurations : General salesforce-integration Configuration Read : " + SFDCConfig.ToString());
                }

                return(SFDCConfig);
            }
            catch (Exception generalException)
            {
                logger.Error("ReadGeneralConfigurations : Error Occurred while reading SFDC General Configuration : " + generalException.ToString());
            }
            return(null);
        }
        /// <summary>
        /// Loads the dispostion codes.
        /// </summary>
        /// <param name="interactionID">The interaction identifier.</param>
        public void LoadDispostionCodes(string interactionID)
        {
            try
            {
                if (ConfigContainer.Instance().AllKeys.Contains("email.disposition.codes") && ConfigContainer.Instance().GetValue("email.disposition.codes") != null)
                //if (EmailDataContext.GetInstance().DispositonCodes != null && EmailDataContext.GetInstance().LoadSubDispositionCodes != null)
                {
                    Dictionary <string, object> dicCMEObjects   = new Dictionary <string, object>();
                    Dictionary <string, string> tempDisposition = new Dictionary <string, string>();
                    Dictionary <string, Dictionary <string, string> > subDisposition = new Dictionary <string, Dictionary <string, string> >();
                    dicCMEObjects.Clear();
                    if (ConfigContainer.Instance().AllKeys.Contains("email.subdisposition.codes") &&
                        ConfigContainer.Instance().GetValue("email.subdisposition.codes") != null)
                    {
                        subDisposition = (Dictionary <string, Dictionary <string, string> >)ConfigContainer.Instance().GetValue("email.subdisposition.codes");
                    }
                    tempDisposition = (Dictionary <string, string>)ConfigContainer.Instance().GetValue("email.disposition.codes");
                    dicCMEObjects.Add("email.disposition.codes", tempDisposition);
                    dicCMEObjects.Add("email.subdisposition.codes", subDisposition);
                    dicCMEObjects.Add("enable.multidisposition.enabled",
                                      (ConfigContainer.Instance().AllKeys.Contains("interaction.enable.multi-dispositioncode") &&
                                       ((string)ConfigContainer.Instance().GetValue("interaction.enable.multi-dispositioncode")).ToLower().Equals("true")) ? true : false);
                    dicCMEObjects.Add("DispositionCodeKey", (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty));
                    dicCMEObjects.Add("DispositionName", (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-object-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-object-name") : string.Empty));
                    stpDispCodelist.Children.Clear();
                    if (tempDisposition.Count <= 0)
                    {
                        tabitemDisposition.Visibility = Visibility.Collapsed;
                        return;
                    }

                    Pointel.Interactions.DispositionCodes.InteractionHandler.Listener _dispositionCodeListener = new Pointel.Interactions.DispositionCodes.InteractionHandler.Listener();
                    _dispositionCodeListener.NotifyCMEObjects(dicCMEObjects);
                    DispositionData disData = new DispositionData()
                    {
                        InteractionID = interactionID
                    };
                    _dispositionUC           = _dispositionCodeListener.CreateUserControl();
                    DispositionObjCollection = new KeyValuePair <string, object>("DispositionObj", _dispositionUC);
                    stpDispCodelist.Children.Clear();
                    _dispositionUC.NotifyDispositionCodeEvent += new Pointel.Interactions.DispositionCodes.UserControls.Disposition.NotifyDispositionCode(NotifyDispositionCodeEvent);

                    _dispositionUC.Dispositions(Pointel.Interactions.IPlugins.MediaTypes.Email, disData);

                    if (_dispositionUC != null)
                    {
                        if (!_dispositionUserControls.ContainsKey(interactionID))
                        {
                            _dispositionUserControls.Add(interactionID, _dispositionUC);
                        }
                        else
                        {
                            _dispositionUserControls[interactionID] = _dispositionUC;
                        }
                        stpDispCodelist.Children.Add(_dispositionUC);

                        //Reload  selected disposition code
                        if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)) || CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)))
                        {
                            Dictionary <string, string> dispositionTree = new Dictionary <string, string>();
                            //if (DispositionObjCollection.Value != null)
                            //{
                            //    var dispositionObject = (Pointel.Interactions.DispositionCodes.UserControls.Disposition)
                            //                    DispositionObjCollection.Value;
                            if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)))
                            {
                                if (!string.IsNullOrEmpty(CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)].ToString()))
                                {
                                    dispositionTree = CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)].ToString().Split(';').Select(s => s.Split(':')).ToDictionary(a => a[0].Trim().ToString(), a => a[1].Trim().ToString());
                                }
                            }
                            if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)))
                            {
                                if (!string.IsNullOrEmpty(CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)].ToString()))
                                {
                                    dispositionTree.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)].ToString());
                                }
                            }
                            if (dispositionTree.Count > 0)
                            {
                                _dispositionUC.ReLoadDispositionCodes(dispositionTree, interactionId);
                            }

                            //}
                        }
                    }
                }
                isFirstTimeCall = false;
            }
            catch (Exception ex)
            {
                logger.Error("LoadDispostionCodes(): " + ex.Message);
            }
        }
        /// <summary>
        /// Parses parameters from the specified reader.
        /// </summary>
        /// <param name="reader">MIME reader.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>reader</b> is null reference.</exception>
        public void Parse(MIME_Reader reader)
        {
            if(reader == null){
                throw new ArgumentNullException("reader");
            }

            /* RFC 2231.
                Asterisks ("*") are reused to provide the indicator that language and
                character set information is present and encoding is being used. A
                single quote ("'") is used to delimit the character set and language
                information at the beginning of the parameter value. Percent signs
                ("%") are used as the encoding flag, which agrees with RFC 2047.

                Character set and language information may be combined with the
                parameter continuation mechanism. For example:

                Content-Type: application/x-stuff
                    title*0*=us-ascii'en'This%20is%20even%20more%20
                    title*1*=%2A%2A%2Afun%2A%2A%2A%20
                    title*2="isn't it!"

                Note that:

                (1) Language and character set information only appear at
                    the beginning of a given parameter value.

                (2) Continuations do not provide a facility for using more
                    than one character set or language in the same
                    parameter value.

                (3) A value presented using multiple continuations may
                    contain a mixture of encoded and unencoded segments.

                (4) The first segment of a continuation MUST be encoded if
                    language and character set information are given.

                (5) If the first segment of a continued parameter value is
                    encoded the language and character set field delimiters
                    MUST be present even when the fields are left blank.
            */

            KeyValueCollection<string,_ParameterBuilder> parameters = new KeyValueCollection<string,_ParameterBuilder>();

            // Parse all parameter parts.
            string[] parameterParts = TextUtils.SplitQuotedString(reader.ToEnd(),';');
            foreach(string part in parameterParts){
                if(string.IsNullOrEmpty(part)){
                    continue;
                }

                string[] name_value = part.Trim().Split(new char[]{'='},2);
                string   paramName  = name_value[0].Trim();
                string   paramValue = null;
                if(name_value.Length == 2){
                    paramValue = TextUtils.UnQuoteString(name_value[1].Trim());
                }
                // Valueless parameter.
                //else{

                string[] nameParts = paramName.Split('*');
                int      index     = 0;
                bool     encoded   = nameParts.Length == 3;
                // Get multi value parameter index.
                if(nameParts.Length >= 2){
                    try{
                        index = Convert.ToInt32(nameParts[1]);
                    }
                    catch{
                    }
                }

                // Single value parameter and we already have parameter with such name, skip it.
                if(nameParts.Length < 2 && parameters.ContainsKey(nameParts[0])){
                    continue;
                }

                // Parameter builder doesn't exist for the specified parameter, create it.
                if(!parameters.ContainsKey(nameParts[0])){
                    parameters.Add(nameParts[0],new _ParameterBuilder(nameParts[0]));
                }

                parameters[nameParts[0]].AddPart(index,encoded,paramValue);
            }

            // Build parameters from parts.
            foreach(_ParameterBuilder b in parameters){
                m_pParameters.Add(b.Name,b.GetParamter());
            }

            m_IsModified = false;
        }
示例#22
0
        /// <summary>
        /// Parses parameters from the specified reader.
        /// </summary>
        /// <param name="reader">MIME reader.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>reader</b> is null reference.</exception>
        public void Parse(MIME_Reader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            /* RFC 2231.
             *  Asterisks ("*") are reused to provide the indicator that language and
             *  character set information is present and encoding is being used. A
             *  single quote ("'") is used to delimit the character set and language
             *  information at the beginning of the parameter value. Percent signs
             *  ("%") are used as the encoding flag, which agrees with RFC 2047.
             *
             *  Character set and language information may be combined with the
             *  parameter continuation mechanism. For example:
             *
             *  Content-Type: application/x-stuff
             *      title*0*=us-ascii'en'This%20is%20even%20more%20
             *      title*1*=%2A%2A%2Afun%2A%2A%2A%20
             *      title*2="isn't it!"
             *
             *  Note that:
             *
             *  (1) Language and character set information only appear at
             *      the beginning of a given parameter value.
             *
             *  (2) Continuations do not provide a facility for using more
             *      than one character set or language in the same
             *      parameter value.
             *
             *  (3) A value presented using multiple continuations may
             *      contain a mixture of encoded and unencoded segments.
             *
             *  (4) The first segment of a continuation MUST be encoded if
             *      language and character set information are given.
             *
             *  (5) If the first segment of a continued parameter value is
             *      encoded the language and character set field delimiters
             *      MUST be present even when the fields are left blank.
             */

            KeyValueCollection <string, _ParameterBuilder> parameters = new KeyValueCollection <string, _ParameterBuilder>();

            // Parse all parameter parts.
            string[] parameterParts = TextUtils.SplitQuotedString(reader.ToEnd(), ';');
            foreach (string part in parameterParts)
            {
                if (string.IsNullOrEmpty(part))
                {
                    continue;
                }

                string[] name_value = part.Trim().Split(new char[] { '=' }, 2);
                string   paramName  = name_value[0].Trim();
                string   paramValue = null;
                if (name_value.Length == 2)
                {
                    paramValue = TextUtils.UnQuoteString(MIME_Utils.UnfoldHeader(name_value[1].Trim()));
                }
                // Valueless parameter.
                //else{

                string[] nameParts = paramName.Split('*');
                int      index     = 0;
                bool     encoded   = nameParts.Length == 3;
                // Get multi value parameter index.
                if (nameParts.Length >= 2)
                {
                    try{
                        index = Convert.ToInt32(nameParts[1]);
                    }
                    catch {
                    }
                }

                // Single value parameter and we already have parameter with such name, skip it.
                if (nameParts.Length < 2 && parameters.ContainsKey(nameParts[0]))
                {
                    continue;
                }

                // Parameter builder doesn't exist for the specified parameter, create it.
                if (!parameters.ContainsKey(nameParts[0]))
                {
                    parameters.Add(nameParts[0], new _ParameterBuilder(nameParts[0]));
                }

                parameters[nameParts[0]].AddPart(index, encoded, paramValue);
            }

            // Build parameters from parts.
            foreach (_ParameterBuilder b in parameters)
            {
                m_pParameters.Add(b.Name, b.GetParamter());
            }

            m_IsModified = false;
        }
        /// <summary>
        /// Saves the data database.
        /// </summary>
        /// <param name="userData">The user data.</param>
        /// <param name="value">The value.</param>
        /// <summary>
        /// Saves the data database.
        /// </summary>
        /// <param name="userData">The user data.</param>
        /// <param name="value">The value.</param>
        /// <param name="parameter">The parameter.</param>

        #region SaveDataDB

        private void SaveDataDB(KeyValueCollection userData, iCallData value, [Optional] Dictionary <string, string> parameter)
        {
            try
            {
                if (value.CrmDbData.CrmDbFormat.Equals("SqlLite"))
                {
                    try
                    {
                        foreach (KeyValuePair <string, string> keys in parameter)
                        {
                            if (userData != null)
                            {
                                if (userData.ContainsKey(keys.Value))
                                {
                                    result += keys.Key + "=" + Convert.ToString(userData[keys.Value]) + value.CrmDbData.Delimiter;
                                }
                            }
                        }
                        AttributeFilter(value, userData);
                        string sqlStatement       = "INSERT INTO CustomerDetails (UserData,AgentId) VALUES(@UserData,@AgentId)";
                        string dbConnectionString = @"Data Source=" + value.CrmDbData.DirectoryPath.ToString();
                        logger.Info("Data Source : " + dbConnectionString);
                        SQLiteConnection sqliteCon = new SQLiteConnection(dbConnectionString);
                        sqliteCon.Open();
                        SQLiteCommand command = new SQLiteCommand(sqlStatement, sqliteCon);
                        command.Parameters.Add("@UserData", DbType.String).Value = result;
                        command.Parameters.Add("@AgentId", DbType.String).Value  = Settings.AgentId;
                        command.ExecuteNonQuery();
                        sqliteCon.Close();
                    }
                    catch (Exception exception)
                    {
                        logger.Error("Error occurred in" + exception.ToString());
                    }
                }
                else if (value.CrmDbData.CrmDbFormat.Equals("SqlServer"))
                {
                    try
                    {
                        foreach (KeyValuePair <string, string> keys in parameter)
                        {
                            if (userData != null)
                            {
                                if (userData.ContainsKey(keys.Value))
                                {
                                    result += keys.Key + "=" + Convert.ToString(userData[keys.Value]) + value.CrmDbData.Delimiter;
                                }
                            }
                        }
                        AttributeFilter(value, userData);
                        // define INSERT query with parameters
                        query = "INSERT INTO CustomerDetails (UserData,AgentId) VALUES (@UserData,@AgentId) ";
                        // create connection and command
                        using (SqlCommand cmd = new SqlCommand(query, Settings.GetInstance().cn))
                        {
                            // define parameters and their values
                            cmd.Parameters.Add("@UserData", SqlDbType.VarChar, 300).Value = result;
                            cmd.Parameters.Add("@AgentId", SqlDbType.VarChar, 100).Value  = Settings.AgentId;
                            // open connection, execute INSERT, close connection
                            //cn.Open();
                            cmd.ExecuteNonQuery();
                            Settings.GetInstance().cn.Close();
                        }
                    }
                    catch (Exception exception)
                    {
                        logger.Error("Error occurred in" + exception.ToString());
                    }
                }
                else if (value.CrmDbData.CrmDbFormat.Equals("Oracle"))
                {
                    foreach (KeyValuePair <string, string> keys in parameter)
                    {
                        if (userData != null)
                        {
                            if (userData.ContainsKey(keys.Value))
                            {
                                result += keys.Key + "=" + Convert.ToString(userData[keys.Value]) + value.CrmDbData.Delimiter;
                            }
                        }
                    }
                    AttributeFilter(value, userData);
                    // define INSERT query with parameters
                    string        queryString = "INSERT INTO customerdetails  values ('" + Settings.AgentId + "','" + result + "')";
                    OracleCommand command     = new OracleCommand(queryString);
                    command.Connection = Settings.GetInstance().connection;
                    try
                    {
                        //connection.Open();
                        command.ExecuteNonQuery();
                        Settings.GetInstance().connection.Close();
                    }
                    catch (Exception ex)
                    {
                        logger.Error("Error occurred while writing call data to a file " + ex.ToString());
                    }
                }
                result = string.Empty;
            }
            catch (Exception exception)
            {
                logger.Error("SendTextData:" + exception.ToString());
            }
        }
        public string ParseTextEclipse(Type objEventType, object obj, KeyValueCollection userdata, string section, string seperator = null, string nullValue = null)
        {
            string data = string.Empty;

            if (obj != null && objEventType != null)
            {
                if (!string.IsNullOrEmpty(section))
                {
                    if (!ConfigContainer.Instance().AllKeys.Contains(section))
                    {
                        ConfigContainer.Instance().ReadSection(section);
                    }
                    if (ConfigContainer.Instance().AllKeys.Contains(section) &&
                        ConfigContainer.Instance().GetValue(section) != null)
                    {
                        var cfgSection = (KeyValueCollection)ConfigContainer.Instance().GetValue(section);
                        foreach (var key in cfgSection.AllKeys)
                        {
                            string keyName       = string.Empty;
                            string parameterName = string.Empty;
                            string value         = string.Empty;
                            if (cfgSection[key] != null)
                            {
                                keyName = cfgSection[key].ToString();
                            }
                            if (key.EndsWith(".key-name"))
                            {
                                parameterName = key.Remove(key.Length - 9);
                                PropertyInfo property = objEventType.GetProperty(keyName, BindingFlags.Instance | BindingFlags.Public);
                                if (property != null && property.CanRead)
                                {
                                    object propertyValue = property.GetValue(obj, null);
                                    value = propertyValue as string;
                                }
                            }
                            else if (key.EndsWith(".user-data"))
                            {
                                parameterName = key.Remove(key.Length - 10);
                                if (userdata != null && userdata.ContainsKey(keyName))
                                {
                                    if (userdata[keyName] != null)
                                    {
                                        value = userdata[keyName] as string;
                                    }
                                }
                            }
                            if (seperator == null)
                            {
                                seperator = "=";
                            }
                            if (string.IsNullOrEmpty(value) && nullValue != null)
                            {
                                value = nullValue;
                            }
                            if (!string.IsNullOrEmpty(parameterName))
                            {
                                data += "<" + parameterName + seperator + value + ">";
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("The section is null");
                }
            }
            //data = "{" + data + "}";

            return(data);
        }
        public string ParseTextString(Type objEventType, object obj, KeyValueCollection userdata, KeyValueCollection dataToFilter, string delimiter, string seperator = null, string nullValue = null, string leftCoverSymbol = "", string rightCoverSymbol = "")
        {
            string dataString = string.Empty;

            if (dataToFilter != null)
            {
                foreach (string keyName in dataToFilter.AllKeys)
                {
                    string parametername = string.Empty;
                    string value         = string.Empty;

                    if (keyName.StartsWith("param.user-data.key-name."))
                    {
                        string userDataKey = dataToFilter.GetAsString(keyName);
                        if (userdata != null && userdata.ContainsKey(userDataKey))
                        {
                            value = userdata.GetAsString(userDataKey);
                        }
                    }
                    else if (keyName.StartsWith("param.attrib.key-name."))
                    {
                        string       attributeKey = dataToFilter.GetAsString(keyName);
                        PropertyInfo property     = objEventType.GetProperty(attributeKey, BindingFlags.Instance | BindingFlags.Public);
                        if (property != null && property.CanRead)
                        {
                            object propertyValue = property.GetValue(obj, null);
                            value = propertyValue as string;
                        }
                    }
                    else
                    {
                        continue;
                    }


                    if (string.IsNullOrEmpty(value))
                    {
                        string defaultKeyName = "param.default.value." + keyName.Replace("param.user-data.key-name.", "").Replace("param.attrib.key-name.", "");
                        if (dataToFilter.ContainsKey(defaultKeyName))
                        {
                            value = dataToFilter.GetAsString(defaultKeyName);
                        }
                    }
                    if (!string.IsNullOrEmpty(keyName))
                    {
                        string defaultKeyName = "param-name." + keyName.Replace("param.user-data.key-name.", "").Replace("param.attrib.key-name.", "");
                        if (dataToFilter.ContainsKey(defaultKeyName))
                        {
                            parametername = dataToFilter.GetAsString(defaultKeyName);
                        }
                    }
                    if (string.IsNullOrEmpty(value) && nullValue != null)
                    {
                        value = nullValue;
                    }

                    if (leftCoverSymbol == null || rightCoverSymbol == null)
                    {
                        leftCoverSymbol = rightCoverSymbol = "";
                    }

                    if (!string.IsNullOrEmpty(parametername))
                    {
                        if (string.IsNullOrEmpty(dataString))
                        {
                            dataString = leftCoverSymbol + parametername + seperator + value + rightCoverSymbol;
                        }
                        else
                        {
                            dataString += delimiter + leftCoverSymbol + parametername + seperator + value + rightCoverSymbol;
                        }
                    }
                }
            }
            return(dataString);
        }
        public string ParseXML(Type objEventType, object obj, KeyValueCollection userdata, string section)
        {
            string xml = string.Empty;

            try
            {
                if (!ConfigContainer.Instance().AllKeys.Contains(section))
                {
                    ConfigContainer.Instance().ReadSection(section);
                }

                keyValue = new List <KeyValue>();

                // Get Keys and Values from cfg
                if (ConfigContainer.Instance().AllKeys.Contains(section) &&
                    ConfigContainer.Instance().GetValue(section) != null)
                {
                    var readCFG = (KeyValueCollection)ConfigContainer.Instance().GetValue(section);
                    foreach (var key in readCFG.AllKeys)
                    {
                        var value = readCFG[key] != null ?
                                    (!string.IsNullOrEmpty(readCFG[key].ToString()) ?
                                     readCFG[key].ToString() :
                                     string.Empty) :
                                    string.Empty;
                        keyValue.Add(new KeyValue {
                            Key = key, Value = value
                        });
                    }
                }

                // Get Keys that need to update
                var keynames = from x in keyValue
                               where x.Key.EndsWith("key-name")
                               select x;

                listAddedKeyNames = new List <string>();
                //bool isUserDataPriority = (!ConfigContainer.Instance().AllKeys.Contains("cfgpriority")
                //    || (ConfigContainer.Instance().AllKeys.Contains("cfgpriority")
                //    && ConfigContainer.Instance().GetAsString("cfgpriority").StartsWith("userdata")));

                bool isUserDataPriority = true;
                if (ConfigContainer.Instance().AllKeys.Contains("cfgpriority") && !(ConfigContainer.Instance().GetAsBoolean("cfgpriority")))
                {
                    isUserDataPriority = false;
                }

                foreach (var keyname in keynames)
                {
                    // Get Exact key name for updating in xml
                    string key = keyname.Key;
                    key = key.Replace("param.child-", "");
                    key = key.Replace(".key-name", "");
                    //key = key.Replace(".attribute-name", "");
                    //key = key.Replace(".default.value", "");

                    string[] keyNames = keyname.Value.Split('|');
                    string[] values   = new string[keyNames.Length];

                    for (int i = 0; i < keyNames.Length; i++)//eg:ANI$1000|DNIS$0-5|ConnID
                    {
                        int    startIndex = 0;
                        int    endIndex   = -1;
                        string keyName    = string.Empty;
                        string value      = string.Empty;
                        if (keyNames[i].Contains("$"))
                        {
                            var _temp = keyNames[i].Split('$');
                            keyName = _temp[0].ToString().Trim();
                            if (_temp[1].Contains("-"))
                            {
                                if (_temp.Length > 1)
                                {
                                    _temp = _temp[1].Split('-');
                                }
                                int.TryParse(_temp[0].ToString(), out startIndex);
                                //                            startIndex = Convert.ToInt32(_temp[0].ToString().Trim());
                                if (_temp.Length > 1)
                                {
                                    int.TryParse(_temp[1].ToString(), out endIndex);
                                }
                                //endIndex = Convert.ToInt32(_temp[1].ToString().Trim());
                            }
                            else
                            {
                                int.TryParse(_temp[1].ToString(), out startIndex);
                            }
                        }
                        // Read value from userdata
                        if (isUserDataPriority && userdata != null && userdata.ContainsKey(keyName))
                        {
                            if (endIndex == -1)
                            {
                                value = userdata[keyName].ToString().Substring(startIndex);
                            }
                            else
                            {
                                value = userdata[keyName].ToString().Substring(startIndex, Convert.ToInt32(endIndex) - startIndex);
                            }

                            // Assign Value to array
                            if (!string.IsNullOrEmpty(value))
                            {
                                values[i] = value;
                            }
                        }
                        else
                        {
                            try
                            {
                                // Get Value
                                PropertyInfo property = objEventType.GetProperty(keyName, BindingFlags.Instance | BindingFlags.Public);
                                if (property != null)
                                {
                                    if (property.CanRead)
                                    {
                                        object propertyValue = property.GetValue(obj, null);
                                        value = propertyValue as string;
                                        if (endIndex > 0)
                                        {
                                            value = value.Substring(startIndex, Convert.ToInt32(endIndex) - startIndex);
                                        }
                                    }
                                }
                                // Assign Value to array
                                if (!string.IsNullOrEmpty(value))
                                {
                                    values[i] = value;
                                }
                            }
                            catch (Exception)
                            {
                                values[i] = string.Empty;
                            }
                        }
                    }
                    string finalValue = string.Empty;
                    foreach (var item in values)
                    {
                        if (!string.IsNullOrEmpty(item))
                        {
                            finalValue += item.Trim();
                        }
                    }

                    //Update Value to cfg
                    if (!string.IsNullOrEmpty(finalValue))
                    {
                        var getKeyValue = from x in keyValue
                                          where x.Key.Equals("param.child-" + key + ".default.value")
                                          select x;
                        getKeyValue.First().Value = finalValue;
                        listAddedKeyNames.Add(key);
                    }
                }

                var rootKeyValue = from x in keyValue
                                   where x.Key.Contains("param.root-")
                                   select x;

                xml = rootKeyValue.First().Key;
                // Frame Root Element
                xml = "<" + xml.Replace("param.root-", "") + ">" + GetChildElementsfromCFG(string.Empty, rootKeyValue.First().Value.Split(',')) + "</" + xml.Replace("param.root-", "") + ">";
            }
            catch (Exception exception)
            {
                logger.Error("Error While converting cfg to xml" + exception.Message);
                return(string.Empty);
            }
            return(xml);
        }
        public string ParseJson(Type objEventType, object obj, KeyValueCollection userdata, string section)
        {
            string data = string.Empty;

            if (obj != null && objEventType != null)
            {
                if (!string.IsNullOrEmpty(section))
                {
                    if (!ConfigContainer.Instance().AllKeys.Contains(section))
                    {
                        ConfigContainer.Instance().ReadSection(section);
                    }
                    if (ConfigContainer.Instance().AllKeys.Contains(section) &&
                        ConfigContainer.Instance().GetValue(section) != null)
                    {
                        var cfgSection = (KeyValueCollection)ConfigContainer.Instance().GetValue(section);
                        foreach (var key in cfgSection.AllKeys)
                        {
                            string keyName       = string.Empty;
                            string parameterName = string.Empty;
                            string value         = string.Empty;
                            if (cfgSection[key] != null)
                            {
                                keyName = cfgSection[key].ToString();
                            }
                            if (key.EndsWith(".key-name"))
                            {
                                parameterName = key.TrimEnd(".key-name".ToCharArray());
                                PropertyInfo property = objEventType.GetProperty(keyName, BindingFlags.Instance | BindingFlags.Public);
                                if (property != null && property.CanRead)
                                {
                                    object propertyValue = property.GetValue(obj, null);
                                    value = propertyValue as string;
                                }
                            }
                            else if (key.EndsWith(".user-data"))
                            {
                                parameterName = key.TrimEnd(".user-data".ToCharArray());
                                if (userdata != null && userdata.ContainsKey(keyName))
                                {
                                    if (userdata[keyName] != null)
                                    {
                                        value = userdata[keyName] as string;
                                    }
                                }
                            }

                            if (!string.IsNullOrEmpty(parameterName))
                            {
                                if (string.IsNullOrEmpty(data))
                                {
                                    data += "'" + parameterName + "':'" + value + "'";
                                }
                                else
                                {
                                    data += ",'" + parameterName + "':'" + value + "'";
                                }
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("The section is null");
                }
            }
            data = "{" + data + "}";
            return(data);
        }
        /// <summary>
        /// Its going to init the set of Web URL Integration.
        /// </summary>
        /// <param name="integrationMediaList">The integration media list.</param>
        private void InitWebUrlIntegration(System.Collections.Generic.Dictionary <string, bool> integrationMediaList = null)
        {
            System.Threading.Thread objThread = new System.Threading.Thread(() =>
            {
                try
                {
                    CfgApplication application = null;
                    if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication"))
                    {
                        application = ConfigContainer.Instance().GetValue("CfgApplication");
                    }
                    if (application != null)
                    {
                        var file = Path.Combine(Path.Combine(System.Windows.Forms.Application.StartupPath, "Plugins"), "Pointel.Salesforce.Adapter.dll");
                        if (ConfigContainer.Instance().AllKeys.Contains("salesforce.enable.plugin") && ConfigContainer.Instance().GetAsBoolean("salesforce.enable.plugin") &&
                            File.Exists(file))
                        {
                            if (application.Options.ContainsKey("salesforce-integration"))
                            {
                                KeyValueCollection salesforceSection = application.Options.GetAsKeyValueCollection("salesforce-integration");
                                if (salesforceSection.ContainsKey("sfdc.screen.popup") && salesforceSection.GetAsString("sfdc.screen.popup").ToLower() == "aid")
                                {
                                    DesktopMessenger.totalWebIntegration += 1;
                                }
                            }
                        }
                    }
                    List <WebIntegrationData> lstWebIntegration = GetConfiguredIntegration <WebIntegrationData>("web-integration.");
                    //null;
                    if (lstWebIntegration != null)
                    {
                        _logger.Trace("Number of web integration configured: " + lstWebIntegration.Count);
                        for (byte index = 0; index < lstWebIntegration.Count; index++)
                        {
                            if (lstWebIntegration[index].IsEnableIntegration)
                            {
                                if (lstWebIntegration[index].ApplicationName.ToLower().Equals("lawson"))
                                {
                                    if (integrationMediaList != null && integrationMediaList.ContainsKey("Lawson") && integrationMediaList["Lawson"])
                                    {
                                        Settings.GetInstance().IsLawsonEnabled = integrationMediaList["Lawson"];
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }

                                UrlSubscriber objUrlIntegration = new UrlSubscriber(lstWebIntegration[index]);
                                if (lstWebIntegration[index].BrowserType == BrowserType.AID)
                                {
                                    totalWebIntegration++;
                                }
                                objUrlIntegration.Subscribe(newCallDataProvider);
                            }
                            else
                            {
                                _logger.Warn("Integration disabled for the application '" + lstWebIntegration[index].ApplicationName + "'");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error("Error occurred while subcribe URL Popup as " + ex.Message);
                }
            });
            objThread.Start();
        }
        public static void ProcessInsertCallDetails(Type objType, object obj)
        {
            try
            {
                Dictionary <string, string> filterKey = new Dictionary <string, string>();
                InsertData calldata = new InsertData();
                calldata.CallDetails           = new CallDetails();
                calldata.UserData              = new UserData();
                calldata.KeyTable              = new KeyTable();
                calldata.CallDetails.FirstName = Settings.GetInstance().FirstName;
                calldata.CallDetails.LastName  = Settings.GetInstance().LastName;
                calldata.CallDetails.UserName  = Settings.GetInstance().UserName;

                object value = null;
                value = GetValueFromObject(objType, obj, "ConnID");
                if (value != null)
                {
                    calldata.UserData.ConnID = calldata.UserData.ConnID = calldata.CallDetails.ConnID = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "ANI");
                if (value != null)
                {
                    calldata.CallDetails.Ani = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "DNIS");
                if (value != null)
                {
                    calldata.CallDetails.Dnis = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "Name");
                if (value != null)
                {
                    calldata.CallDetails.EventName = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "ThisDN");
                if (value != null)
                {
                    calldata.CallDetails.ThisDN = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "Place");
                if (value != null)
                {
                    calldata.CallDetails.AgentPlace = value.ToString();
                }

                value = GetValueFromObject(objType, obj, "UserData");
                if (value != null)
                {
                    KeyValueCollection userData = value as KeyValueCollection;
                    //Add All Keys and values in user data table.
                    if (userData != null)
                    {
                        //Add Filter keys
                        foreach (string key in Settings.GetInstance().VoiceFilterKey)
                        {
                            if (userData.ContainsKey(key))
                            {
                                filterKey.Add(key, userData[key].ToString());
                            }
                        }

                        //the keys does not reach, then for add other keys
                        if (filterKey.Count < 10)
                        {
                            foreach (string key in userData.AllKeys)
                            {
                                if (!filterKey.ContainsKey(key) && filterKey.Count < 10)
                                {
                                    filterKey.Add(key, userData[key].ToString());
                                }
                                else if (filterKey.Count == 10)
                                {
                                    break;
                                }
                            }
                        }
                        if (userData.ContainsKey(Settings.GetInstance().VoiceDispositionCollectionName))
                        {
                            KeyValueCollection dispositionCollection = userData[Settings.GetInstance().VoiceDispositionCollectionName] as KeyValueCollection;
                            if (dispositionCollection != null)
                            {
                                foreach (string dispositionValue in dispositionCollection.AllValues)
                                {
                                    if (string.IsNullOrEmpty(calldata.CallDetails.Disposition1))
                                    {
                                        calldata.CallDetails.Disposition1 = dispositionValue;
                                    }
                                    else if (string.IsNullOrEmpty(calldata.CallDetails.Disposition2))
                                    {
                                        calldata.CallDetails.Disposition2 = dispositionValue;
                                    }
                                }
                            }
                        }
                        //For Read Dispotion Key
                        if (userData.ContainsKey(Settings.GetInstance().VoiceDispositionKeyName))
                        {
                            if (string.IsNullOrEmpty(calldata.CallDetails.Disposition1))
                            {
                                calldata.CallDetails.Disposition1 = userData[Settings.GetInstance().VoiceDispositionKeyName].ToString();
                            }
                            else if (string.IsNullOrEmpty(calldata.CallDetails.Disposition2))
                            {
                                calldata.CallDetails.Disposition2 = userData[Settings.GetInstance().VoiceDispositionKeyName].ToString();
                            }
                            else if (string.IsNullOrEmpty(calldata.CallDetails.Disposition3))
                            {
                                calldata.CallDetails.Disposition3 = userData[Settings.GetInstance().VoiceDispositionKeyName].ToString();
                            }
                        }

                        //For adding all keys in user data table
                        calldata.UserData.UserDatas = new ArrayOfKeyValueOfstringstringKeyValueOfstringstring[userData.Count];
                        int index = 0;
                        foreach (string key in userData.AllKeys)
                        {
                            //calldata.UserData.UserDatas[key] = userData[key].ToString();
                            calldata.UserData.UserDatas[index]       = new ArrayOfKeyValueOfstringstringKeyValueOfstringstring();
                            calldata.UserData.UserDatas[index].Key   = key;
                            calldata.UserData.UserDatas[index].Value = userData[key].ToString();
                            index++;
                        }
                        if (string.IsNullOrEmpty(calldata.CallDetails.AgentPlace))
                        {
                            if (userData.ContainsKey("RTargetPlaceSelected"))
                            {
                                calldata.CallDetails.AgentPlace = userData["RTargetPlaceSelected"].ToString();
                            }
                        }
                    }

                    int count = 1;
                    //For Store url key
                    Action <string, string> MapValue;
                    MapValue = delegate(string key, string Value)
                    {
                        //if (key.Equals("ReferenceId"))
                        //    return;
                        switch (count)
                        {
                        case 1:
                            calldata.CallDetails.Ad1 = Value;
                            calldata.KeyTable.Key1   = key;
                            break;

                        case 2:
                            calldata.CallDetails.Ad2 = Value;
                            calldata.KeyTable.Key2   = key;
                            break;

                        case 3:
                            calldata.CallDetails.Ad3 = Value;
                            calldata.KeyTable.Key3   = key;
                            break;

                        case 4:
                            calldata.CallDetails.Ad4 = Value;
                            calldata.KeyTable.Key4   = key;
                            break;

                        case 5:
                            calldata.CallDetails.Ad5 = Value;
                            calldata.KeyTable.Key5   = key;
                            break;

                        case 6:
                            calldata.CallDetails.Ad6 = Value;
                            calldata.KeyTable.Key6   = key;
                            break;

                        case 7:
                            calldata.CallDetails.Ad7 = Value;
                            calldata.KeyTable.Key7   = key;
                            break;

                        case 8:
                            calldata.CallDetails.Ad8 = Value;
                            calldata.KeyTable.Key8   = key;
                            break;

                        case 9:
                            calldata.CallDetails.Ad9 = Value;
                            calldata.KeyTable.Key9   = key;
                            break;

                        case 10:
                            calldata.CallDetails.Ad10 = Value;
                            calldata.KeyTable.Key10   = key;
                            break;
                        }
                        count++;
                    };

                    foreach (string key in Settings.GetInstance().PortSetting.ReceiveDatakey)
                    {
                        if (count > 10)
                        {
                            break;
                        }
                        MapValue(key, string.Empty);
                    }

                    foreach (string key in filterKey.Keys)
                    {
                        if (count > 10)
                        {
                            break;
                        }
                        if (!PortSettings.GetInstance().ReceiveDatakey.Contains(key))
                        {
                            MapValue(key, filterKey[key]);
                        }
                    }
                }

                BasicService  serviceClient = new BasicService(Settings.GetInstance().PortSetting.WebServiceURL);
                ServiceResult serviceResult = serviceClient.InsertCallDetailsAsyc(calldata);
                //logger.Info("Data received from web service while insert call details, Code: " + serviceResult.ResultCode + ", Description: " + serviceResult.ResultDescription);
            }
            catch //(Exception ex)
            {
                //logger.Error("Error occurred as " + ex.Message);
            }
        }
示例#30
0
        /// <summary>
        /// Prepares the user data.
        /// </summary>
        private void PrepareUserData()
        {
            string finalDateTime = string.Empty;

            try
            {
                _updateUserEventData.Clear();
                if (_datacontext.userAttachData.ContainsKey("GSW_RECORD_HANDLE"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_RECORD_HANDLE"))
                    {
                        _updateUserEventData.Add("GSW_RECORD_HANDLE", Convert.ToInt32(_datacontext.userAttachData["GSW_RECORD_HANDLE"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_RECORD_HANDLE is null");
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_APPLICATION_ID"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_APPLICATION_ID"))
                    {
                        _updateUserEventData.Add("GSW_APPLICATION_ID", Convert.ToInt32(_datacontext.userAttachData["GSW_APPLICATION_ID"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_APPLICATION_ID is null");
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_CAMPAIGN_NAME"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CAMPAIGN_NAME"))
                    {
                        _updateUserEventData.Add("GSW_CAMPAIGN_NAME", Convert.ToInt32(_datacontext.userAttachData["GSW_CAMPAIGN_NAME"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_CAMPAIGN_NAME is null");
                    }
                }

                if (chkbxPersonalCallback.IsChecked == true)
                {
                    if (!_updateUserEventData.ContainsKey("PHSPCB"))
                    {
                        _updateUserEventData.Add("PHSPCB", "1");
                    }
                }
                else
                {
                    if (!_updateUserEventData.ContainsKey("PHSPCB"))
                    {
                        _updateUserEventData.Add("PHSPCB", "0");
                    }
                }
                if (!_updateUserEventData.ContainsKey("GSW_CALLBACK_TYPE"))
                {
                    _updateUserEventData.Add("GSW_CALLBACK_TYPE", "Campaign");
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_CALLING_LIST"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CALLING_LIST"))
                    {
                        _updateUserEventData.Add("GSW_CALLING_LIST", Convert.ToInt32(_datacontext.userAttachData["GSW_CALLING_LIST"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_CALLING_LIST is null");
                    }
                }

                if (chkbxRescheduleCall.IsChecked == true)
                {
                    DateTime dt = new DateTime();
                    dt = Convert.ToDateTime(dpRescheduledate.Text);
                    DateTime dtTime = new DateTime();
                    dtTime = Convert.ToDateTime(dpRescheduletime.Text);

                    if (_configContainer.AllKeys.Contains("voice.ocs.time-format") && !string.IsNullOrEmpty(_configContainer.GetAsString("voice.ocs.time-format")))
                    {
                        try
                        {
                            finalDateTime = dt.Date.ToShortDateString() + " " + dtTime.ToString(_configContainer.GetAsString("voice.ocs.time-format"), CultureInfo.InstalledUICulture);
                        }
                        catch (Exception generalException)
                        {
                            _logger.Error("Error occurred while converting time in the given format : " + _configContainer.GetAsString("voice.ocs.time-format") + " : " + generalException.ToString());
                            finalDateTime = dt.Date.ToShortDateString() + " " + dtTime.ToString("HH:mm", CultureInfo.InstalledUICulture);
                        }
                    }

                    if (!_updateUserEventData.ContainsKey("GSW_DATE_TIME"))
                    {
                        _updateUserEventData.Add("GSW_DATE_TIME", finalDateTime);
                    }
                    if (!_updateUserEventData.ContainsKey("GSW_AGENT_REQ_TYPE"))
                    {
                        _updateUserEventData.Add("GSW_AGENT_REQ_TYPE", "RecordReschedule");
                    }
                }
                if (!string.IsNullOrEmpty(cmbCallResult.Text.Trim()) && cmbCallResult.SelectedIndex >= 0)
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CALL_RESULT"))
                    {
                        _updateUserEventData.Add("GSW_CALL_RESULT", Convert.ToInt32(cmbCallResult.SelectedValue.ToString()));
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_PHONE"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_PHONE"))
                    {
                        _updateUserEventData.Add("GSW_PHONE", _datacontext.userAttachData["GSW_PHONE"].ToString());
                    }
                }

                if (!_updateUserEventData.ContainsKey("GSW_AGENT_REQ_TYPE"))
                {
                    _updateUserEventData.Add("GSW_AGENT_REQ_TYPE", "UpdateCallCompletionStats");
                }

                var          soft   = new SoftPhone();
                OutputValues output = soft.UpdateOCSCallData(_updateUserEventData);
                if (output.MessageCode == "200")
                {
                    _logger.Info("OCS Call Data Updated Successfully....");
                }
                SendRecordProcessed(_updateUserEventData);
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred in PrepareUserData() : " + generalException.ToString());
            }
        }
示例#31
0
        private void HandleVoice(iCallData value)
        {
            try
            {
                Type               objType        = null;
                object             obj            = null;
                KeyValueCollection userdata       = null;
                MediaEventHelper   objEventHelper = new MediaEventHelper();
                if (objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userdata, value.EventMessage))
                {
                    if (objType != null && obj != null && objURLConfiguration.PostType != null)
                    {
                        if (objURLConfiguration.PostType.ToLower() == "querystring")
                        {
                            SendTextData(objType, obj, userdata, value);
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "json")
                        {
                            SendJsonData(objType, obj, userdata, value);
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "form")
                        {
                            SendFormData(objType, obj, userdata, value);
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "lawson")
                        {
                            PopupLawson(value);
                        }
                        //else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "gvas")
                        //    DesktopMessenger.communicateUI.PostDataInGVAS(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL);
                        else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "gvas")
                        {
                            // Implemented changes for popup multiple URL in GVAS -- 17-11-2015 by sakthikumar
                            // : Start

                            if (!string.IsNullOrEmpty(objURLConfiguration.PopupURL) && objURLConfiguration.PopupURL.Contains(","))
                            {
                                string[] urls = objURLConfiguration.PopupURL.Split(',');
                                if (userdata != null && userdata.ContainsKey("AppName") && urls.Where(x => x.StartsWith(userdata.GetAsString("AppName"))).ToList().Count > 0)
                                {
                                    url = urls.Where(x => x.StartsWith(userdata.GetAsString("AppName"))).SingleOrDefault().Replace(userdata.GetAsString("AppName") + "=", "");
                                }
                            }
                            else
                            {
                                url = objURLConfiguration.PopupURL;
                            }

                            // : End

                            if (!string.IsNullOrEmpty(url))
                            {
                                if (userdata != null && userdata.ContainsKey("AppName") &&
                                    (userdata.GetAsString("AppName").ToUpper() == "VA" || userdata.GetAsString("AppName").ToUpper() == "NVAS"))
                                {
                                    DesktopMessenger.midHandler = this;
                                    DesktopMessenger.communicateUI.PostDataInGVAS(userdata, objURLConfiguration.ApplicationName, url);
                                }
                            }

                            else
                            {
                                logger.Warn("Popup url is not configured.");
                            }
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "evas")
                        {
                            if (userdata != null && userdata.ContainsKey("AppName") && userdata.GetAsString("AppName").ToUpper() == "VA")
                            {
                                if (DesktopMessenger.communicateUI != null)
                                {
                                    DesktopMessenger.midHandler = this;
                                    DesktopMessenger.communicateUI.PostDataToEvas(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL);
                                }
                                else
                                {
                                    logger.Warn("The desktop communicator is null.");
                                }
                            }
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "nvas")
                        {
                            if (userdata != null && userdata.ContainsKey("AppName") && userdata.GetAsString("AppName").ToUpper() == "NVAS")
                            {
                                if (DesktopMessenger.communicateUI != null)
                                {
                                    DesktopMessenger.midHandler = this;
                                    DesktopMessenger.communicateUI.PostDataToNvas(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL);
                                }
                                else
                                {
                                    logger.Warn("The desktop communicator is null.");
                                }
                            }
                        }
                        else if (objURLConfiguration.PostType.ToLower() == "custom")
                        {
                            SendCustomData(objType, obj, userdata, value);
                        }
                    }
                }
                else
                {
                    logger.Warn("Voice event conversion getting failed");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred as " + generalException.Message);
            }
        }