void CaseDataAddMenuitem_Click(object sender, RoutedEventArgs e) { try { MenuItem menuitem = sender as MenuItem; if (!_chatUtil.UserData.ContainsKey(menuitem.Header.ToString())) { _chatUtil.UserData.Add(menuitem.Header.ToString(), string.Empty); } if (_chatUtil.NotifyCaseData.Count(p => p.Key == menuitem.Header.ToString()) == 0) { _chatUtil.NotifyCaseData.Add(new ChatCaseData(menuitem.Header.ToString(), string.Empty)); } BindGrid(); _caseDataAdd.Items.Remove(menuitem); DGCaseDataInfo.UpdateLayout(); if (DGCaseDataInfo.Items.Count > 2) { DGCaseDataInfo.ScrollIntoView(DGCaseDataInfo.Items[DGCaseDataInfo.Items.Count - 2]); } int rowIndex = _chatUtil.NotifyCaseData.IndexOf(_chatUtil.NotifyCaseData.Where(p => p.Key == menuitem.Header.ToString()).FirstOrDefault()); var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGCaseDataInfo.Items[rowIndex], DGCaseDataInfo.Columns[1]); var cell = TryToFindGridCell(DGCaseDataInfo, dataGridCellInfo); if (cell == null) { return; } cell.Focus(); DGCaseDataInfo.BeginEdit(); } catch (Exception commonException) { _logger.Error("Error occurred as : " + commonException.Message.ToString()); } }
/// <summary> /// Handles the Click event of the btnClear 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 btnClear_Click(object sender, RoutedEventArgs e) { try { DGCaseDataInfo.CancelEdit(); BindGrid(); } catch (Exception commonException) { _logger.Error("Error occurred while btnClear_Click(): " + commonException.ToString()); } }
/// <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> /// Handles the Click event of the CaseDataAddMenuitem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> void CaseDataAddMenuitem_Click(object sender, RoutedEventArgs e) { try { MenuItem menuitem = sender as MenuItem; //DGCaseDataInfo.UpdateLayout(); emailDetails.EmailCaseData.Add(new EmailCaseData() { Key = menuitem.Header.ToString(), Value = string.Empty }); if (!CurrentData.ContainsKey(menuitem.Header.ToString())) { CurrentData.Add(menuitem.Header.ToString(), ""); } DGCaseDataInfo.UpdateLayout(); //BindGrid(); if (DGCaseDataInfo.Items.Count > 2) { DGCaseDataInfo.ScrollIntoView(DGCaseDataInfo.Items[DGCaseDataInfo.Items.Count - 2]); } int rowIndex = emailDetails.EmailCaseData.IndexOf(emailDetails.EmailCaseData.Where(x => x.Key.Equals(menuitem.Header.ToString())).SingleOrDefault()); var dataGridCellInfo = new Microsoft.Windows.Controls.DataGridCellInfo(DGCaseDataInfo.Items[rowIndex], DGCaseDataInfo.Columns[1]); var cell = TryToFindGridCell(DGCaseDataInfo, dataGridCellInfo); if (cell == null) { return; } cell.Focus(); DGCaseDataInfo.BeginEdit(); _caseDataAdd.Items.Remove(menuitem); editingKey = menuitem.Header.ToString(); editingValue = string.Empty; if (_caseDataAdd.Items.Count == 0) { // Addded by sakthi to hide, if there is no item available to add after added all item. // Date : 20-02-2016 btnAddCaseData.Visibility = Visibility.Collapsed; } } catch (Exception commonException) { logger.Error("Error occurred as : " + commonException.Message.ToString()); } }
/// <summary> /// Handles the Click event of the btnCancel 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 btnCancel_Click(object sender, RoutedEventArgs e) { try { isEditDone = true; DGCaseDataInfo.CancelEdit(); var selectedCallData = DGCaseDataInfo.SelectedItem as EmailCaseData; if (CurrentData.ContainsKey(editingKey)) { CurrentData[editingKey] = editingValue; selectedCallData.Value = editingValue; editingValue = editingKey = null; DGCaseDataInfo.UpdateLayout(); } } catch (Exception ex) { logger.Error("Error occurred as " + ex.Message); } }