Beispiel #1
0
        public OutputValues getWorkbinContent(string agentId, string placeId, string workbinName, int proxyId)
        {
            OutputValues output = new OutputValues();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestGetWorkbinContent getWorkbinContent1 = null;
                WorkbinInfo winfo = null;
                getWorkbinContent1 = RequestGetWorkbinContent.Create();
                getWorkbinContent1.ProxyClientId = proxyId;
                winfo = WorkbinInfo.Create();
                winfo.WorkbinAgentId = agentId;
                if (!string.IsNullOrEmpty(placeId))
                {
                    winfo.WorkbinPlaceId = placeId;
                }
                winfo.WorkbinTypeId        = workbinName;
                getWorkbinContent1.Workbin = winfo;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.InteractionProtocol.Request(getWorkbinContent1);
                    if (response.Id.Equals(EventWorkbinContent.MessageId))
                    {
                        output.MessageCode = "200";
                        output.IMessage    = response;
                        output.Message     = "Workbin Content retrieved successfully";
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.IMessage    = response;
                        output.Message     = "Eorror occurred while retrieve workbin content";
                    }
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = "Interaction server is not active";
                }
            }
            catch (Exception ex)
            {
                OutputValues.GetInstance().Message     = "GetWorkbinContent " + ex.Message;
                OutputValues.GetInstance().MessageCode = "2001";
            }
            return(output);
        }
        public OutputValues RequestPlaceWorkbin(string interactionId, string agentId,
                                                //string placeId,
                                                string workbin, int proxyId)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                WorkbinInfo workbinInfo = WorkbinInfo.Create();
                workbinInfo.WorkbinAgentId = agentId;
                //  workbinInfo.WorkbinPlaceId = placeId;
                workbinInfo.WorkbinTypeId = workbin;

                RequestPlaceInWorkbin requestPlaceInWorkbin = RequestPlaceInWorkbin.Create();
                requestPlaceInWorkbin.InteractionId = interactionId;
                requestPlaceInWorkbin.ProxyClientId = proxyId;

                requestPlaceInWorkbin.Workbin = workbinInfo;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestPlaceInWorkbin);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------PlaceInWorkbin-------------");
                            logger.Info("AgentID  :" + agentId);
                            logger.Info("InteractionID  :" + interactionId);
                            // logger.Info("PlaceID  :" + placeId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Workbin        :" + workbin);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Place in Workbin Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Email Interaction-------------");
                            logger.Info("AgentID  :" + agentId);
                            logger.Info("InteractionID  :" + interactionId);
                            // logger.Info("PlaceID  :" + placeId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Workbin        :" + workbin);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while placeinworkbin : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Place in Workbin UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("PlaceInWorkbin() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Accept the request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
        public OutputValues NotifyWorbin(int proxyClientId, string workbinType, string worbinEmpId, string workbinGroupId = null, string WorkbinPlaceId = null, string workbinPlaceGroupId = null)
        {
            OutputValues outPutValues = new OutputValues();

            outPutValues.Message     = string.Empty;
            outPutValues.MessageCode = string.Empty;
            outPutValues.ErrorCode   = 0;
            KeyValueCollection keyVC = new KeyValueCollection();

            keyVC.Add("event_processing_stopped", 1);
            try
            {
                RequestWorkbinNotifications reqWorkbinNotifications = RequestWorkbinNotifications.Create();
                reqWorkbinNotifications.Workbin = WorkbinInfo.Create(workbinType);
                reqWorkbinNotifications.Workbin.WorkbinAgentId = worbinEmpId;
                if (!string.IsNullOrEmpty(workbinGroupId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinGroupId = workbinGroupId;
                }
                if (!string.IsNullOrEmpty(workbinPlaceGroupId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinPlaceGroupId = workbinPlaceGroupId;
                }
                if (!string.IsNullOrEmpty(WorkbinPlaceId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinPlaceId = WorkbinPlaceId;
                }
                reqWorkbinNotifications.Reason                = ReasonInfo.Create();
                reqWorkbinNotifications.ProxyClientId         = proxyClientId;
                reqWorkbinNotifications.NotifyPropertyChanges = 1;
                reqWorkbinNotifications.Extension             = keyVC;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(reqWorkbinNotifications);

                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck _requestWorkbinNotifications = (EventAck)message;
                            logger.Info("------------Request Workbin Notifications-------------");
                            logger.Trace(_requestWorkbinNotifications.ToString());
                            outPutValues.MessageCode = "200";
                            logger.Trace(_requestWorkbinNotifications.ProxyClientId);
                            outPutValues.Message = "Request Workbin Notifications Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Trace(eventError.ToString());
                            outPutValues.MessageCode = "2001";
                            outPutValues.Message     = "NotifyWorbin() : " + Convert.ToString(eventError.ErrorDescription);
                            break;
                        }
                    }
                }
            }
            catch (Exception error)
            {
                logger.Error(error.Message.ToString());
                outPutValues.MessageCode = "2001";
                outPutValues.Message     = "NotifyWorbin() : " + error.Message.ToString();
            }

            return(outPutValues);
        }