示例#1
0
        /// <summary>
        /// To Record IVRNotification.
        /// </summary>
        private void RecordIVRNotification(AlarmObject _alarmObject)
        {
            NotificationStyle notificationStyle = null;

            try
            {
                notificationStyle = new NotificationStyle();
                TTIvrNotifications tTIVRNotifications = new TTIvrNotifications()
                {
                    Action             = "C",
                    AlarmID            = _alarmObject.AlarmID,
                    LastAttemptTime    = DateTime.UtcNow,
                    Notification_RecID = _alarmObject.NotificationID,
                    TransID            = _alarmObject.TransID,
                    PersonName         = _alarmObject.PersonName,
                    NumAttempts        = 0,
                    PhoneNumber        = _alarmObject.IVRPhoneNumber,
                    UserID             = _alarmObject.IVRUserID,
                    QueueTime          = DateTime.UtcNow,
                    isInProcess        = 1,
                    ThreadID           = _alarmObject.ThreadID
                };

                tTIVRNotifications.Execute();

                _recID = tTIVRNotifications.RecID;



                if (tTIVRNotifications.PhoneNumber.Trim() != string.Empty)
                {
                    //write to TTNotifcationLog table
                    notificationStyle.RecordNotification("Queued for Voice: " + tTIVRNotifications.PersonName + " @ " + tTIVRNotifications.PhoneNumber, _alarmObject.NotificationID, _alarmObject.TransID, NotifyStatus.PASS, NotifyTypes.VOICE);
                    // INotifyObject notifyObject = GetNotifyObject(_alarmObject, _genStore);
                }
                else
                {
                    //write to TTNotifcationLog table
                    notificationStyle.RecordNotification("Phone number does not exists. Queue failed ", _alarmObject.NotificationID, _alarmObject.TransID, NotifyStatus.FAIL, NotifyTypes.VOICE);
                }
                LogBook.Write("IVRNotification has been ADDED for AlarmID[" + tTIVRNotifications.AlarmID + "] To User [+" + tTIVRNotifications.UserID + "] at [" + tTIVRNotifications.PhoneNumber + "]");
            }
            catch (Exception ex)
            {
                //write to TTNotifcationLog table
                notificationStyle.RecordNotification("Queued for Voice: " + _alarmObject.IVRPhoneNumber.ToStr() + " Failed", _alarmObject.NotificationID, _alarmObject.TransID, NotifyStatus.FAIL, NotifyTypes.VOICE);
                LogBook.Write(ex, "CooperAtkins.IVRNotification");
            }
        }
        /// <summary>
        /// To Record IVRNotification.
        /// </summary>
        private static void UpdateIVRNotification(int ivrID, bool answered, bool inProcess, int numAttempts, long transactionId, int threadID)
        {
            short callSucceeded = 0;
            short ivrInProcess  = 0;
            long  transID       = transactionId;

            if (answered == false)
            {
                callSucceeded = 0;
            }
            else
            {
                callSucceeded = 1;
            }

            if (inProcess == false)
            {
                ivrInProcess = 0;
            }
            else
            {
                ivrInProcess = 1;
            }
            try
            {
                /* assigning the values to object.*/
                TTIvrNotifications tTIVRNotifications = new TTIvrNotifications()
                {
                    Action          = "U",
                    LastAttemptTime = DateTime.UtcNow.ToDateTime(),
                    RecID           = ivrID,
                    NumAttempts     = numAttempts,
                    isSuccess       = callSucceeded,
                    isInProcess     = ivrInProcess,
                    TransID         = transID.ToInt(),
                    ThreadID        = threadID
                };

                tTIVRNotifications.Execute();
            }
            catch (Exception ex)
            {
                LogBook.Write(ex, "CooperAtkins.NotificationClient.NotificationComposer.IvrClientHelper");
            }
        }
        /// <summary>
        /// To Record IVRNotification.
        /// </summary>
        private void RecordIVRNotification()
        {
            NotificationStyle notificationStyle = null;

            try
            {
                notificationStyle = new NotificationStyle();
                TTIvrNotifications tTIVRNotifications = new TTIvrNotifications()
                {
                    Action             = "C",
                    AlarmID            = _alarmObject.AlarmID,
                    LastAttemptTime    = DateTime.UtcNow,
                    Notification_RecID = _alarmObject.NotificationID,
                    NumAttempts        = 1,
                    PhoneNumber        = _alarmObject.IVRPhoneNumber,
                    TransID            = _alarmObject.TransID,
                    PersonName         = _alarmObject.PersonName,
                    UserID             = _alarmObject.IVRUserID,
                    QueueTime          = DateTime.UtcNow
                };

                tTIVRNotifications.Execute();

                if (tTIVRNotifications.PhoneNumber.Trim() != string.Empty)
                {
                    notificationStyle.RecordNotification("Queued for Voice: " + tTIVRNotifications.PersonName + " @ " + tTIVRNotifications.PhoneNumber, _alarmObject.TransID, _alarmObject.NotificationID, NotifyStatus.PASS, NotifyTypes.VOICE);
                }
                else
                {
                    notificationStyle.RecordNotification("Phone number does not exists. Queue failed ", _alarmObject.TransID, _alarmObject.NotificationID, NotifyStatus.FAIL, NotifyTypes.VOICE);
                }
                LogBook.Write("IVRNotification has been inserted.");
            }
            catch (Exception ex)
            {
                notificationStyle.RecordNotification("Queued for Voice: " + _alarmObject.IVRPhoneNumber.ToStr() + " Failed", _alarmObject.TransID, _alarmObject.NotificationID, NotifyStatus.FAIL, NotifyTypes.VOICE);
                LogBook.Write(ex, "CooperAtkins.IVRNotification");
            }
        }