Beispiel #1
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());
     }
 }
Beispiel #2
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());
            }
        }