private void btnSaveNote_Click(object sender, RoutedEventArgs e)
        {
            KeyValueCollection caseData = new KeyValueCollection();
            var chatMedia = new ChatMedia();

            try
            {
                string value = _chatUtil.InteractionNoteContent;
                if (Pointel.Interactions.IPlugins.PluginCollection.GetInstance().PluginCollections.ContainsKey(Plugins.Contact))
                {
                    ((IContactPlugin)Pointel.Interactions.IPlugins.PluginCollection.GetInstance().PluginCollections[Pointel.Interactions.IPlugins.Plugins.Contact])
                    .UpdateInteraction(_interactionID, _chatDataContext.OwnerIDorPersonDBID, _chatUtil.InteractionNoteContent,
                                       _chatUtil.UserData, 2);
                }
                if (_chatUtil.UserData.ContainsKey("TheComment"))
                {
                    string originalValue = _chatUtil.UserData["TheComment"].ToString();
                    if (value != originalValue)
                    {
                        caseData.Add("TheComment", value);
                        OutputValues output = chatMedia.DoUpdateCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                        if (output.MessageCode == "200")
                        {
                            _chatUtil.UserData.Remove("TheComment");
                            _chatUtil.UserData.Add("TheComment", value);
                        }
                        caseData.Clear();
                    }
                }
                else
                {
                    caseData.Add("TheComment", value);
                    OutputValues output = chatMedia.DoAddCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                    if (output.MessageCode == "200")
                    {
                        _chatUtil.UserData.Add("TheComment", value);
                    }
                    caseData.Clear();
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("Error occurred as : " + commonException.Message.ToString());
            }
            finally
            {
                chatMedia = null;
                caseData  = null;
            }
        }
        public void TestClear_NonEmptyCollection()
        {
            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);

            collection.Clear();

            Assert.IsFalse(collection.TryGetValue(key1, out var result1));
            Assert.IsNull(result1);

            Assert.IsFalse(collection.TryGetValue(key2, out var result2));
            Assert.IsNull(result2);

            Assert.IsFalse(collection.TryGetValue(key3, out var result3));
            Assert.IsNull(result3);
        }
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            var chatMedia = new ChatMedia();
            KeyValueCollection caseData = new KeyValueCollection();

            try
            {
                var    selectedCallData = DGCaseDataInfo.SelectedItem as ChatCaseData;
                string key   = selectedCallData.Key.ToString().Trim();
                string value = selectedCallData.Value.ToString().Trim();
                if (_chatUtil.UserData.ContainsKey(key))
                {
                    string originalValue = _chatUtil.UserData[key].ToString();
                    if (value != originalValue)
                    {
                        caseData.Add(key, value);
                        OutputValues output = chatMedia.DoUpdateCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                        if (output.MessageCode == "200")
                        {
                            _chatUtil.UserData.Remove(key);
                            _chatUtil.UserData.Add(key, value);
                        }
                        caseData.Clear();
                    }
                }
                else
                {
                    caseData.Add(key, value);
                    OutputValues output = chatMedia.DoAddCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                    if (output.MessageCode == "200")
                    {
                        _chatUtil.UserData.Add(key, value);
                    }
                    caseData.Clear();
                }
                BindGrid();
            }
            catch (Exception commonException)
            {
                _logger.Error("Error occurred while btnUpdate_Click(): " + commonException.ToString());
            }
            finally
            {
                chatMedia = null;
                caseData  = null;
            }
        }
Exemple #4
0
        private void TestParameters()
        {
            var collection = new KeyValueCollection();

            UriParser.ParseParameters(collection, new StringReader(";welcome;lr=true"));
            Assert.Equal(string.Empty, collection["welcome"]);
            Assert.Equal("true", collection["lr"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome;"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes;"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);
        }
Exemple #5
0
        private void TestParameters()
        {
            var collection = new KeyValueCollection();

            UriParser.ParseParameters(collection, new StringReader(";welcome;lr=true"));
            Assert.Equal(string.Empty, collection["welcome"]);
            Assert.Equal("true", collection["lr"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome;"));
            Assert.Equal(string.Empty, collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;"));
            Assert.Equal("world", collection["welcome"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);

            collection.Clear();
            UriParser.ParseParameters(collection, new StringReader(";welcome=world;yes;"));
            Assert.Equal("world", collection["welcome"]);
            Assert.Equal(string.Empty, collection["yes"]);
        }
        private void DGCaseDataInfo_RowEditEnding(object sender, Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs e)
        {
            var chatMedia = new ChatMedia();

            try
            {
                Microsoft.Windows.Controls.DataGridRow dgRow = e.Row;
                if (dgRow != null)
                {
                    var    selectedCallData = dgRow.Item as ChatCaseData;
                    string key   = selectedCallData.Key.ToString().Trim();
                    string value = selectedCallData.Value.ToString().Trim();
                    if (_chatUtil.UserData.ContainsKey(key))
                    {
                        string originalValue = _chatUtil.UserData[key].ToString();
                        if (value != originalValue)
                        {
                            KeyValueCollection caseData = new KeyValueCollection();
                            caseData.Add(key, value);
                            OutputValues output = chatMedia.DoUpdateCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                            if (output.MessageCode == "200")
                            {
                                _chatUtil.UserData.Remove(key);
                                _chatUtil.UserData.Add(key, value);
                            }
                            caseData.Clear();
                        }
                    }
                    else
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        caseData.Add(key, value);
                        OutputValues output = chatMedia.DoAddCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                        if (output.MessageCode == "200")
                        {
                            _chatUtil.UserData.Add(key, value);
                        }
                        caseData.Clear();
                    }
                    BindGrid();
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("Error occurred while DGCaseDataInfo_RowEditEnding(): " + commonException.ToString());
            }
            finally
            {
                chatMedia = null;
            }
        }
        /// <summary>
        /// Handles the Click event of the btnUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                isEditDone = true;
                DGCaseDataInfo.CancelEdit();
                var    selectedCallData = DGCaseDataInfo.SelectedItem as EmailCaseData;
                string key   = selectedCallData.Key;
                string value = selectedCallData.Value;
                if (CurrentData.ContainsKey(key))
                {
                    string originalValue = CurrentData[key].ToString();
                    if (value != originalValue)
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        caseData.Add(key, value);
                        InteractionService interactionService = new InteractionService();
                        Pointel.Interactions.Core.Common.OutputValues result = interactionService.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                        if (result.MessageCode == "200")
                        {
                            CurrentData[key] = value;
                        }
                        caseData.Clear();
                    }
                }
                else
                {
                    KeyValueCollection caseData = new KeyValueCollection();
                    caseData.Add(key, value);
                    InteractionService interactionService = new InteractionService();
                    Pointel.Interactions.Core.Common.OutputValues result = interactionService.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                    if (result.MessageCode == "200")
                    {
                        CurrentData.Add(key, value);
                    }
                    caseData.Clear();
                }
                editingValue = editingKey = null;

                //  BindGrid();
            }
            catch (Exception commonException)
            {
                logger.Error("Error ocurred as " + commonException.Message);
            }
        }
 /// <summary>
 /// This method parses the 'adminCatagories' section of the BASE.config file.
 /// You can add/remove/modify catagories to change and/or expand BASE's admin catagories for the backend site admin
 /// </summary>
 /// <param name="xmlnode"></param>
 internal void ParseAdminCatagories(XmlNode xmlnode)
 {
     foreach (XmlNode ch in xmlnode.ChildNodes)
     {
         if (ch.Name == "add")
         {
             _admincatagories.Add(ch.Attributes["id"].Value, ch.Attributes["displayName"].Value);
         }
         else if (ch.Name == "remove")
         {
             _admincatagories.Remove(ch.Attributes["id"].Value);
         }
         else if (ch.Name == "clear")
         {
             _admincatagories.Clear();
         }
         else
         {
             Logging.Logger.Log(String.Format("Unkown node in BASE.config/adminCatagories: {0}", ch.Name), BASE.Logging.LogPriority.Warning, "CONFIGURATION");
         }
     }
 }
Exemple #9
0
 /// <summary>
 /// This method parses the 'urlParserPlugins' section of the BASE.config file.
 /// You can add/remove/modify plugins to change and/or expand BASE's UrlParsing system
 /// </summary>
 /// <param name="xmlnode"></param>
 internal void ParseBaseSettings(XmlNode xmlnode)
 {
     foreach (XmlNode ch in xmlnode.ChildNodes)
     {
         if (ch.Name == "add")
         {
             _baseSettings.Add(ch.Attributes["key"].Value, ch.Attributes["value"].Value);
         }
         else if (ch.Name == "remove")
         {
             _baseSettings.Remove(ch.Attributes["key"].Value);
         }
         else if (ch.Name == "clear")
         {
             _baseSettings.Clear();
         }
         else
         {
             Logging.Logger.Log(String.Format("Unkown node in BASE.config/basesettings: {0}", ch.Name), BASE.Logging.LogPriority.Warning, "CONFIGURATION");
         }
     }
 }
Exemple #10
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);
        }
Exemple #11
0
 public void Clear()
 {
     iniSection.Clear();
 }
 /// <summary>
 /// Handles the RowEditEnding event of the DGCaseDataInfo control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs"/> instance containing the event data.</param>
 private void DGCaseDataInfo_RowEditEnding(object sender, Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs e)
 {
     try
     {
         Microsoft.Windows.Controls.DataGridRow dgRow = e.Row;
         if (dgRow != null)
         {
             var    selectedCallData = dgRow.Item as EmailCaseData;
             string key   = selectedCallData.Key.ToString().Trim();
             string value = selectedCallData.Value.ToString().Trim();
             if (!isEditDone)
             {
                 isEditDone = true;
                 if (CurrentData.ContainsKey(key))
                 {
                     string originalValue = CurrentData[key].ToString();
                     if (value != originalValue)
                     {
                         KeyValueCollection caseData = new KeyValueCollection();
                         caseData.Add(key, value);
                         InteractionService interactionService = new InteractionService();
                         Pointel.Interactions.Core.Common.OutputValues result = interactionService.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                         if (result.MessageCode == "200")
                         {
                             CurrentData[key] = value;
                         }
                         caseData.Clear();
                     }
                 }
                 else
                 {
                     KeyValueCollection caseData = new KeyValueCollection();
                     caseData.Add(key, value);
                     InteractionService interactionService = new InteractionService();
                     Pointel.Interactions.Core.Common.OutputValues result = interactionService.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                     if (result.MessageCode == "200")
                     {
                         CurrentData.Add(key, value);
                     }
                     caseData.Clear();
                 }
                 return;
             }
             else
             {
                 if (CurrentData.ContainsKey(key))
                 {
                     string originalValue = CurrentData[key].ToString();
                     if (value != originalValue)
                     {
                         CurrentData.Remove(key);
                         CurrentData.Add(key, value);
                     }
                 }
                 else
                 {
                     CurrentData.Add(key, value);
                 }
             }
             ConvertUserData();
         }
     }
     catch (Exception ex)
     {
         logger.Error("dgCaseInfo_RowEditEnding: " + ex.Message);
     }
 }
        /// <summary>
        /// Notifies the disposition code event.
        /// </summary>
        /// <param name="mediaType">Type of the media.</param>
        /// <param name="data">The data.</param>
        public void NotifyDispositionCodeEvent(MediaTypes mediaType, DispositionData data)
        {
            try
            {
                if (mediaType == MediaTypes.Email)
                {
                    if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)))
                    {
                        if (isFirstTimeCall)
                        {
                            isFirstTimeCall = false;
                            Dictionary <string, string> dispositionCode = new Dictionary <string, string>();
                            dispositionCode.Add(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"),
                                                CurrentData[(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"))]);
                            _dispositionUC.ReLoadDispositionCodes(dispositionCode, interactionId);
                        }
                        else
                        {
                            string originalValue = CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)].ToString();
                            if (data.DispostionCode != originalValue)
                            {
                                KeyValueCollection caseData = new KeyValueCollection();
                                caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode);
                                InteractionService service = new InteractionService();
                                Pointel.Interactions.Core.Common.OutputValues result = service.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                                if (result.MessageCode == "200")
                                {
                                    CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)] = data.DispostionCode;
                                }
                                caseData.Clear();
                            }
                        }
                    }
                    else
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode);
                        InteractionService service = new InteractionService();
                        Pointel.Interactions.Core.Common.OutputValues result = service.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                        if (result.MessageCode == "200")
                        {
                            CurrentData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode);
                        }
                        caseData.Clear();
                    }

                    if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)))
                    {
                        string originalValue = CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)].ToString();
                        if (data.DispostionCode != originalValue)
                        {
                            string             result   = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray());
                            KeyValueCollection caseData = new KeyValueCollection();
                            caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result);
                            InteractionService service = new InteractionService();
                            Pointel.Interactions.Core.Common.OutputValues output = service.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                            if (output.MessageCode == "200")
                            {
                                CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)] = result;
                            }
                            caseData.Clear();
                        }
                    }
                    else
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        string             result   = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray());
                        caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result);
                        InteractionService service = new InteractionService();
                        Pointel.Interactions.Core.Common.OutputValues output = service.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData);
                        if (output.MessageCode == "200")
                        {
                            CurrentData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result);
                        }
                        caseData.Clear();
                    }
                    ConvertUserData();
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred as " + generalException.ToString());
            }
        }
Exemple #14
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());
            }
        }
        /// <summary>
        /// Notifies the disposition code event.
        /// </summary>
        /// <param name="mediaType">Type of the media.</param>
        /// <param name="data">The data.</param>
        public void NotifyDispositionCodeEvent(MediaTypes mediaType, DispositionData data)
        {
            var chatMedia = new ChatMedia();

            try
            {
                if (mediaType == MediaTypes.Chat)
                {
                    if (_chatUtil.UserData.ContainsKey(_chatDataContext.DisPositionKeyName))
                    {
                        if (isFirstTimeCall)
                        {
                            isFirstTimeCall = false;
                            Dictionary <string, string> dispositionCode = new Dictionary <string, string>();
                            dispositionCode.Add(_chatDataContext.DisPositionKeyName,
                                                _chatUtil.UserData[_chatDataContext.DisPositionKeyName].ToString());
                            _dispositionUC.ReLoadDispositionCodes(dispositionCode, _interactionID);
                        }
                        else
                        {
                            string originalValue = string.Empty;
                            if (_chatUtil.UserData.ContainsKey(_chatDataContext.DisPositionKeyName))
                            {
                                originalValue = _chatUtil.UserData[_chatDataContext.DisPositionKeyName].ToString();
                            }
                            if (data.DispostionCode != originalValue)
                            {
                                KeyValueCollection caseData = new KeyValueCollection();
                                caseData.Add(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                                OutputValues output = chatMedia.DoUpdateCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                                if (output.MessageCode == "200")
                                {
                                    _chatUtil.UserData.Remove(_chatDataContext.DisPositionKeyName);
                                    _chatUtil.UserData.Add(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                                    ObservableCollection <Pointel.Interactions.Chat.Helpers.IChatCaseData> tempCaseData = _chatUtil.NotifyCaseData;
                                    int position1 = tempCaseData.IndexOf(tempCaseData.Where(p => p.Key == _chatDataContext.DisPositionKeyName).FirstOrDefault());
                                    _chatUtil.NotifyCaseData.RemoveAt(position1);
                                    _chatUtil.NotifyCaseData.Insert(position1, new ChatCaseData(_chatDataContext.DisPositionKeyName, data.DispostionCode));
                                    NotifyDispositionToSFDC(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                                }
                                caseData.Clear();
                                caseData = null;
                            }
                        }
                    }
                    else
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        caseData.Add(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                        OutputValues output = chatMedia.DoAddCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                        if (output.MessageCode == "200")
                        {
                            _chatUtil.UserData.Add(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                            _chatUtil.NotifyCaseData.Add(new ChatCaseData(_chatDataContext.DisPositionKeyName, data.DispostionCode));
                            NotifyDispositionToSFDC(_chatDataContext.DisPositionKeyName, data.DispostionCode);
                        }
                        caseData.Clear();
                        caseData = null;
                    }
                    if (_chatUtil.UserData.ContainsKey(_chatDataContext.DispositionCollectionKeyName))
                    {
                        string originalValue = _chatUtil.UserData[_chatDataContext.DispositionCollectionKeyName].ToString();
                        if (data.DispostionCode != originalValue)
                        {
                            string result = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray());
                            if (!string.IsNullOrEmpty(result))
                            {
                                KeyValueCollection caseData = new KeyValueCollection();
                                caseData.Add(_chatDataContext.DispositionCollectionKeyName, result);
                                OutputValues output = chatMedia.DoUpdateCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                                if (output.MessageCode == "200")
                                {
                                    _chatUtil.UserData.Remove(_chatDataContext.DispositionCollectionKeyName);
                                    _chatUtil.UserData.Add(_chatDataContext.DispositionCollectionKeyName, result);
                                    ObservableCollection <Pointel.Interactions.Chat.Helpers.IChatCaseData> tempCaseData = _chatUtil.NotifyCaseData;
                                    int position1 = tempCaseData.IndexOf(tempCaseData.Where(p => p.Key == _chatDataContext.DispositionCollectionKeyName).FirstOrDefault());
                                    _chatUtil.NotifyCaseData.RemoveAt(position1);
                                    _chatUtil.NotifyCaseData.Insert(position1, new ChatCaseData(_chatDataContext.DispositionCollectionKeyName, result));
                                }
                                caseData.Clear();
                                caseData = null;
                            }
                        }
                    }
                    else
                    {
                        KeyValueCollection caseData = new KeyValueCollection();
                        string             result   = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray());
                        if (!string.IsNullOrEmpty(result))
                        {
                            caseData.Add(_chatDataContext.DispositionCollectionKeyName, result);
                            OutputValues output = chatMedia.DoAddCaseDataProperties(_interactionID, _chatUtil.ProxyId, caseData);
                            if (output.MessageCode == "200")
                            {
                                _chatUtil.UserData.Add(_chatDataContext.DispositionCollectionKeyName, result);
                                _chatUtil.NotifyCaseData.Add(new ChatCaseData(_chatDataContext.DispositionCollectionKeyName, result));
                            }
                            caseData.Clear();
                            caseData = null;
                        }
                    }
                    if (data.DispostionCode == "None")
                    {
                        _chatUtil.IsDispositionSelected = false;
                    }
                    else
                    {
                        _chatUtil.IsDispositionSelected = true;
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred while NotifyDispositionCodeEvent(): " + generalException.ToString());
                _chatUtil.IsDispositionSelected = false;
            }
            finally
            {
                chatMedia = null;
            }
        }
        public void TestClear_EmptyCollection()
        {
            var collection = new KeyValueCollection <string, JackpotLog>(@"TestCollection", _database);

            collection.Clear();
        }