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; } }
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; } }
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; } }
/// <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; } }