Exemple #1
0
        private void btnLogout_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "Loggin out...";
            DisableAllActions();
            string message = "<Message></Message>";
            string action  = Constants.Actions.LogOut;
            MultiChannelMessageType messageType = MultiChannelMessageType.REQUESTFROMAGENT;
            string applicationID = this.ApplicationID.ToString();
            MultichannelMessageInformation logoutRequest = Utility.CreateRequest(applicationID, clientID, message, action, messageType);
            MultichannelMessageInformation result        = MultichannelApplicationHelper.SendRequest(logoutRequest);

            // If there is any problem in the response
            if ((result == null) || (result.MessageType == MultiChannelMessageType.ERRORONADAPTER) || (result.Status.Equals(false)))
            {
                lblStatus.Text    = defaultErrorMessage;
                btnLogin.Enabled  = false;
                btnLogout.Enabled = true;
            }
            else
            {
                DisableAllRelatedApplications();
                lblStatus.Text    = "You have successfully logged out.";
                btnLogin.Enabled  = true;
                btnLogout.Enabled = false;
                isAgentLoggedIn   = false;
                string statusAtProvider = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.StatusNode);
                ProcessStatusAtProvider(statusAtProvider);
            }
        }
        private void btnMakeACall_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "";
            string customerNumber = txtCustomerNumber.Text;

            if (customerNumber.Trim().Equals(string.Empty))
            {
                lblStatus.Text = "Please enter a valid number.";
                return;
            }
            DisableAllActions();
            // setting the callID as empty string to make sure that we dont use previous call's id
            currentCallID = String.Empty;

            string message = string.Format("<Message>" +
                                           "<DestNumber>{0}</DestNumber>" +
                                           "<Location></Location>" +
                                           "<Reasons></Reasons>" +
                                           "<Textensions></Textensions>" +
                                           "</Message>", customerNumber);
            string action = Constants.Actions.MakeCall;
            MultiChannelMessageType messageType = MultiChannelMessageType.REQUESTFROMAGENT;
            string applicationID = this.ApplicationID.ToString();
            MultichannelMessageInformation makeCallRequest = Utility.CreateRequest(applicationID, clientID, message, action, messageType);
            MultichannelMessageInformation result          = MultichannelApplicationHelper.SendRequest(makeCallRequest);

            // If there is any problem in the response
            if ((result == null) || (result.MessageType == MultiChannelMessageType.ERRORONADAPTER))
            {
                lblStatus.Text = defaultErrorMessage;
                EnableActionsToDefaultStates();
                return;
            }

            string possibleActions = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.PossibleActionsNodes);

            EnablePossibleActions(possibleActions);
            string statusAtProvider = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.StatusNode);

            ProcessStatusAtProvider(statusAtProvider);

            if (result.Status.Equals(false))
            {
                lblStatus.Text = defaultErrorMessage;
            }
            else
            {
                currentCallID  = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.CallID);
                lblStatus.Text = "Making call...";
            }
        }
Exemple #3
0
        /// <summary>
        /// Sets the agent status at provider
        /// </summary>
        /// <param name="action"></param>
        public void SetStatusAtProvider(string status)
        {
            Logging.Trace("Setting status at provider to " + status);
            string message = "<Message><Status>" + status + "</Status></Message>";
            MultiChannelMessageType messageType = MultiChannelMessageType.REQUESTFROMAGENT;
            string applicationID = this.ApplicationID.ToString();
            string action        = Constants.Actions.SetAgentStatus;
            MultichannelMessageInformation changeStatusRequest = Utility.CreateRequest(applicationID, clientID, message, action, messageType);
            MultichannelMessageInformation result = MultichannelApplicationHelper.SendRequest(changeStatusRequest);

            // If there is any problem in the intermediate response
            if ((result == null) || (result.MessageType == MultiChannelMessageType.ERRORONADAPTER) || (result.Status.Equals(false)))
            {
                Logging.Warn(this.ToString(), "Status change at provider failed");
            }
            else
            {
                Logging.Trace("status changed at provider to " + status);
            }
        }
        private void btnTerminate_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "";
            DisableAllActions();
            string message = string.Format("<Message>" +
                                           "<CallID>{0}</CallID>" +
                                           "<Reasons></Reasons>" +
                                           "<Textensions></Textensions>" +
                                           "</Message>", currentCallID);
            string action = Constants.Actions.ReleaseCall;
            MultiChannelMessageType messageType = MultiChannelMessageType.REQUESTFROMAGENT;
            string applicationID = this.ApplicationID.ToString();
            MultichannelMessageInformation terminateRequest = Utility.CreateRequest(applicationID, clientID, message, action, messageType);
            MultichannelMessageInformation result           = MultichannelApplicationHelper.SendRequest(terminateRequest);

            // If there is any problem in the response
            if ((result == null) || (result.MessageType == MultiChannelMessageType.ERRORONADAPTER))
            {
                lblStatus.Text = defaultErrorMessage;
                EnableActionsToDefaultStates();
                return;
            }
            if (result.Status.Equals(false))
            {
                lblStatus.Text = defaultErrorMessage;
            }
            else
            {
                lblStatus.Text = "Call successfully terminated.";
                currentCallID  = string.Empty;
            }
            string possibleActions = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.PossibleActionsNodes);

            EnablePossibleActions(possibleActions);
            string statusAtProvider = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.StatusNode);

            ProcessStatusAtProvider(statusAtProvider);
        }
Exemple #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "Logging in...";
            DisableAllActions();
            string username = txtAgentID.Text;
            string password = txtPassword.Text;
            string place    = txtPlace.Text;

            if ((username.Trim() == string.Empty) || (place.Trim() == string.Empty))
            {
                lblStatus.Text = "Please enter valid Agent ID and Place";
                EnableActionsToDefaultStates();
                return;
            }
            string loginDetails     = string.Format("LoginID:{0},Password:{1},Place:{2}", username, password, place);
            string loginDetailsHash = Utility.CalculateMD5Hash(loginDetails);
            string message          = string.Format("<Message>" +
                                                    "<AGENT>{0}</AGENT>" +
                                                    "<PASSWORD>{1}</PASSWORD>" +
                                                    "<PLACE>{2}</PLACE>" +
                                                    "<QUEUE></QUEUE>" +
                                                    "</Message>", username, password, place);
            string action = Constants.Actions.Login;

            MultiChannelMessageType messageType = MultiChannelMessageType.REQUESTFROMAGENT;
            string applicationID = this.ApplicationID.ToString();
            MultichannelMessageInformation loginRequest = Utility.CreateRequest(applicationID, clientID, message, action, messageType);

            // this hash is used by the lazy logout mechanism of AdapterManager
            loginRequest.ChannelTypeKey = loginDetailsHash;
            MultichannelMessageInformation result = MultichannelApplicationHelper.SendRequest(loginRequest);

            // If there is any problem in the intermediate response
            if ((result == null) || (result.MessageType == MultiChannelMessageType.ERRORONADAPTER))
            {
                lblStatus.Text    = defaultErrorMessage;
                btnLogin.Enabled  = true;
                btnLogout.Enabled = false;
                return;
            }

            string statusAtProvider = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.StatusNode);

            ProcessStatusAtProvider(statusAtProvider);

            if (result.Status.Equals(false))
            {
                // We try to extract if there is a reason for failure in message. If yes, we show it to agent
                // else we show the standard error message. This is just to make sure that we show errors which
                // are relevant to agent(invalid password, username etc)on IAD
                string reasonForFailure = string.Empty;
                try
                {
                    reasonForFailure = GeneralFunctions.GetXmlNodeText(result.Message, Constants.NodeNames.UserVisibleError);
                }
                catch (Exception ex)
                {
                    Logging.Warn(this.ToString(), "Encountered error while reading UserVisibleError from response " + ex.Message);
                    reasonForFailure = null;
                }
                if ((reasonForFailure == null) || (reasonForFailure.Equals(string.Empty)))
                {
                    reasonForFailure = defaultErrorMessage;
                }
                lblStatus.Text    = reasonForFailure;
                btnLogin.Enabled  = true;
                btnLogout.Enabled = false;
            }
            else
            {
                EnableRelatedApplicationToDefaultState();
                lblStatus.Text    = "You have successfully logged in.";
                btnLogin.Enabled  = false;
                btnLogout.Enabled = true;
                isAgentLoggedIn   = true;
            }
        }