Esempio n. 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());
     }
 }
 protected override Output DeserializeOutput(OutputValues OutputValues)
 {
     return(new Output(OutputValues["Name", this.Name],
                       OutputValues["FileName", "Screenshot"],
                       new Guid(OutputValues["FileFormatID", ""]),
                       Convert.ToBoolean(OutputValues["EditFileName", false.ToString()])));
 }
        public static OutputValues GetSearchResult(string query, int maxCount, string searchType)
        {
            OutputValues  output = OutputValues.GetInstance();
            RequestSearch requestContactSearch = new RequestSearch();

            requestContactSearch.Query      = query;
            requestContactSearch.MaxResults = maxCount;
            requestContactSearch.IndexName  = searchType;
            if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
            {
                output.IContactMessage = Settings.UCSProtocol.Request(requestContactSearch);
                if (output.IContactMessage.Id == EventSearch.MessageId)
                {
                    output.MessageCode = "200";
                    output.Message     = "Request processed successfully.";
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = "Got Error during perform contact search.";
                }
            }
            else
            {
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = "Universal Contact Server protocol is Null or Closed.";
            }
            return(output);
        }
        public static OutputValues UNMergeContact(string contactId)
        {
            OutputValues result = new OutputValues();

            if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
            {
                RequestUnMergeContacts requestUnMergeContacts = new RequestUnMergeContacts();
                //Attribute to Mere contact.
                requestUnMergeContacts.ContactId = contactId;
                result.IContactMessage           = Settings.UCSProtocol.Request(requestUnMergeContacts);
                if (result.IContactMessage != null && result.IContactMessage.Id == EventUnMergeContacts.MessageId)
                {
                    result.MessageCode = "200";
                    result.Message     = "MergeContact Successful.";
                }
                else
                {
                    result.MessageCode = "2001";
                    result.Message     = "Error Occurred while MergeContact.";
                }
            }
            else
            {
                result.IContactMessage = null;
                result.MessageCode     = "2001";
                result.Message         = "Universal Contact Server protocol is Null or Closed";
            }
            return(result);
        }
        public OutputValues RegisterClient(string clientName)
        {
            RequestRegisterAgent requestRegisterAgent = new RequestRegisterAgent();
            OutputValues         output = requestRegisterAgent.AgentRegister(clientName);

            return(output);
        }
        /// <summary>
        /// Gets the plugin values.
        /// </summary>
        /// <param name="AppName">Name of the app.</param>
        /// <param name="ConfObject">The conf object.</param>
        /// <returns></returns>
        public OutputValues GetPluginValues(string AppName, ConfService ConfObject)
        {
            ReadApplication read   = new ReadApplication();
            OutputValues    output = OutputValues.GetInstance();

            try
            {
                logger.Debug("ConfigConnectionManager : GetPluginValues Method: Entry");
                StatisticsSetting.GetInstance().confObject = ConfObject;

                read.ReadLoggerDetails(AppName);
                output.MessageCode = "200";
                output.Message     = "Config Server Protocol Opened";
            }
            catch (Exception connectionException)
            {
                logger.Error("ConfigConnectionManager :GetPluginValues Method: " + connectionException.Message.ToString());
            }
            finally
            {
                logger.Debug("ConfigConnectionManager : GetPluginValues Method: Exit");
                GC.Collect();
            }

            return(output);
        }
        /// <summary>
        /// Connects the ucs.
        /// </summary>
        /// <param name="configObject">The configuration object.</param>
        /// <param name="contactAppName">Name of the application.</param>
        /// <returns></returns>
        public OutputValues ConnectUCS(ConfService configObject, NullableInt tenantDBID, string contactAppName, Func <bool, bool> contactServerNotification)
        {
            OutputValues      output            = null;
            ReadConfigObjects readConfigObjects = new ReadConfigObjects();

            try
            {
                Settings.comObject  = configObject;
                Settings.tenantDBID = tenantDBID;
                readConfigObjects.ReadApplicationObject(contactAppName);
                ContactConnectionManager createProtocol = new ContactConnectionManager();
                createProtocol.ContactServerNotificationHandler += new NotifyContactServerState(contactServerNotification);
                output = createProtocol.ConnectContactServer(Settings.PrimaryApplication, Settings.SecondaryApplication);
                if (output.MessageCode == "200")
                {
                    messageToClient.NotifyContactProtocol(Settings.UCSProtocol);
                }
                else
                {
                    messageToClient.NotifyContactProtocol(Settings.UCSProtocol);
                }
            }
            catch (Exception commonException)
            {
                logger.Error("ContactLibrary:ConnectUCS:" + commonException.ToString());
            }
            return(output);
        }
Esempio n. 8
0
        /// <summary>
        /// Logins the validation.
        /// </summary>
        /// <param name="IP">The IP.</param>
        /// <param name="Port">The port.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Please Enter Valid IP address</exception>
        public OutputValues LoginValidation(string Port, string place)
        {
            OutputValues result = new OutputValues();

            try
            {
                portValidation = Settings.portValidation;

                Regex regexPort = new Regex(portValidation);

                Match matchPort = regexPort.Match(Port.Trim());

                if (!matchPort.Success)
                {
                    throw new Exception("Please Enter Valid Port address");
                }
                result.MessageCode = "2001";
                result.Message     = "Success";
            }
            catch (Exception ex)
            {
                logger.Error("ValidationClass Class : LoginValidation Method : Exception Caught " + ex.Message);
                result.Message     = ex.Message;
                result.MessageCode = "2000";
            }
            finally
            {
                GC.Collect();
            }
            return(result);
        }
Esempio n. 9
0
        public static OutputValues GetResult()
        {
            OutputValues result = new OutputValues();

            if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
            {
                RequestGetIndexProperties requestGetIndexProperties = new RequestGetIndexProperties();
                IMessage response = Settings.UCSProtocol.Request(requestGetIndexProperties);
                if (response != null && response.Id == EventGetIndexProperties.MessageId)
                {
                    result.IContactMessage = response;
                    result.MessageCode     = "200";
                    result.Message         = "Get Index properties Successful.";
                }
                else
                {
                    result.IContactMessage = null;
                    result.MessageCode     = "2001";
                    result.Message         = "Error Occurred while GetIndexProperties.";
                }
            }
            else
            {
                result.IContactMessage = null;
                result.MessageCode     = "2001";
                result.Message         = "Universal Contact Server protocol is Null or Closed";
            }
            return(result);
        }
Esempio n. 10
0
        /// <summary>
        /// Changes the properties.
        /// </summary>
        /// <param name="interactionId">The interaction identifier.</param>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <param name="dispositionNotes">The disposition notes.</param>
        /// <returns></returns>
        public OutputValues ChangeProperties(string interactionId, int proxyId, KeyValueCollection addedProperties, KeyValueCollection changedProperties)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            RequestChangeProperties requestChangeProperties = RequestChangeProperties.Create();

            try
            {
                requestChangeProperties.InteractionId = interactionId;
                requestChangeProperties.ProxyClientId = proxyId;
                if (changedProperties != null)
                {
                    requestChangeProperties.ChangedProperties = changedProperties;
                }
                if (addedProperties != null)
                {
                    requestChangeProperties.AddedProperties = addedProperties;
                }
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.InteractionProtocol.Request(requestChangeProperties);
                    if (response.Id == EventPropertiesChanged.MessageId || response.Id == EventAck.MessageId)
                    {
                        logger.Info("------------RequestChangeProperties-------------");
                        logger.Info("InteractionId  :" + interactionId);
                        logger.Info("ProxyClientId    :" + proxyId);
                        logger.Info(" RequestChangeProperties : response :" + response.ToString());
                        logger.Info("-------------------------------------------------");
                        logger.Trace(response.ToString());
                        output.MessageCode = "200";
                        output.Message     = "Change Properties Successful";
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Don't Change Properties Successful";
                    }
                }
                else
                {
                    logger.Warn("ChangeProperties() : Interaction Server Protocol is Null..");
                }
            }
            catch (ProtocolException protocolException)
            {
                logger.Error("Error occurred while change properties request " + protocolException.ToString());
                output.MessageCode = "2001";
                output.Message     = protocolException.Message;
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while change properties request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
        /// <summary>
        /// Agents the logout.
        /// </summary>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <returns></returns>
        public OutputValues AgentLogout(int proxyId)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestAgentLogout requestAgentlogout = RequestAgentLogout.Create();
                requestAgentlogout.ProxyClientId = proxyId;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestAgentlogout);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAgentLogout = (EventAck)message;
                            logger.Info("-------------AgentLogout----------------");
                            logger.Info("ProxyClientId    :" + proxyId);
                            logger.Info("Name    :" + eventAgentLogout.Name.ToString());
                            logger.Info("----------------------------------------");
                            logger.Trace(eventAgentLogout.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Agent Logout Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.ErrorCode   = eventError.ErrorCode;
                            output.MessageCode = "2002";
                            output.Message     = "AgentLogout() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Logout UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AgentLogout() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while Agent Logout request " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
        public IMessage GetContactList(int tenantDbId, StringList attributeList, SearchCriteriaCollection SearchCriteria, int maxCount = 0)
        {
            IMessage response = null;

            try
            {
                OutputValues output = Pointel.Interactions.Contact.Core.Request.RequestContactLists.GetContactList(tenantDbId, SearchCriteria, attributeList, maxCount);
                if (output.IContactMessage != null)
                {
                    logger.Info("RequestContactListGet result:" + output.IContactMessage.ToString());
                    if ("200".Equals(output.MessageCode))
                    {
                        response = output.IContactMessage;
                    }
                }
                else
                {
                    logger.Error("Error occurred while RequestContactListGet : " + output.Message);
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred as : " + generalException.ToString());
            }
            return(response);
        }
        public IMessage GetIndexProperties()
        {
            IMessage response = null;

            try
            {
                OutputValues output = Pointel.Interactions.Contact.Core.Request.GetIndexProperties.GetResult();
                if (output.IContactMessage != null)
                {
                    logger.Info("RequestGetIndexProperties result:" + output.IContactMessage.ToString());
                    if ("200".Equals(output.MessageCode))
                    {
                        response = output.IContactMessage;
                    }
                }
                else
                {
                    logger.Error("Error occurred while RequestGetIndexProperties : " + output.Message);
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred as : " + generalException.ToString());
            }
            return(response);
        }
Esempio n. 14
0
        public OutputValues DtmfSend(string number)
        {
            OutputValues output = new OutputValues()
            {
                MessageCode = "201"
            };

            try
            {
                output = RequestDtmfSend.DtmfSend(number);
            }
            catch (Exception commonException)
            {
                logger.Error("Softphone_DtmfSend:" + commonException.ToString());
            }
            if (output.MessageCode == "200")
            {
                output.Message = "Dtmf Send Successfully...";
            }
            else
            {
                output.Message = "Error occurred while sending Dtmf...";
            }
            return(output);
        }
Esempio n. 15
0
        /// <summary>
        /// Refines the place.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="placeName">Name of the place.</param>
        /// <param name="agentLoginID">The agent login identifier.</param>
        /// <param name="queueName">Name of the queue.</param>
        /// <param name="agentPassword">The agent password.</param>
        /// <param name="workMode">The work mode.</param>
        /// <returns></returns>
        public OutputValues RefinePlace(string userName, string placeName, string agentLoginID, string queueName, string agentPassword, string workMode)
        {
            var output = OutputValues.GetInstance();
            var read   = new ReadConfigObjects();

            try
            {
                Settings.GetInstance().PlaceName = placeName;
                output = read.ReadPlaceObject();
                if (output.MessageCode == "200")
                {
                    if (Settings.GetInstance().VoiceProtocol != null && Settings.GetInstance().VoiceProtocol.State == ChannelState.Opened)
                    {
                        output = Login(placeName, userName, workMode, queueName, agentLoginID, agentPassword);
                    }
                }
                return(output);
            }
            catch (Exception generalException)
            {
                output.MessageCode = "2001";
                output.Message     = "Error occurred in Softphone RefinePlace() : " + generalException.ToString();
                logger.Error("Softphone_RefinePlace:" + generalException.ToString());
                return(output);
            }
        }
Esempio n. 16
0
        public OutputValues CreateChatProtocol()
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                ChatConnectionManager chatConnectionManager = new ChatConnectionManager();
                output = chatConnectionManager.OpenChatProtocol(Settings.NickName, Settings.PersonID, Settings.PrimaryApplication, Settings.SecondaryApplication);
                if (output.MessageCode == "200")
                {
                    Settings.MessageToClient.NotifyChatProtocol(Settings.ChatProtocol, Settings.NickName);
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = "Error occurred while Create Chat Protocol : " + output.Message;
                    logger.Error("Error occurred while Create Chat Protocol");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Create Chat Protocol " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = "Error occurred while Create Chat Protocol";
            }
            return(output);
        }
Esempio n. 17
0
        public OutputValues CheckChatServerStatus()
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                try
                {
                    var temp = ProtocolManagers.Instance().ProtocolManager[ServerType.Chatserver.ToString()];
                    if (Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Closed)
                    {
                        Settings.ChatProtocol = null;
                        output.MessageCode    = "2002";
                        output.Message        = "Chat Server protocol is closed Need to Open it.";
                    }
                    else if (Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened)
                    {
                        output.MessageCode = "200";
                        output.Message     = "Chat Server protocol is opened.";
                    }
                }
                catch
                {
                    output.MessageCode = "2001";
                    output.Message     = "Chat Server protocol is null. Need to create a chat protocol";
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Check Chat Server Status " + generalException.ToString());
                output.MessageCode = "2003";
                output.Message     = "Error occurred while Check Chat Server Status";
            }
            return(output);
        }
 protected override Output DeserializeOutput(OutputValues OutputValues)
 {
     return(new Output(OutputValues["Name", this.Name],
                       OutputValues["Application", ""],
                       OutputValues["Arguments", ""],
                       OutputValues["FileName", "Screenshot"],
                       new Guid(OutputValues["FileFormatID", ""])));
 }
        /// <summary>
        /// Gets the contact list.
        /// </summary>
        /// <param name="tenantId">The tenant identifier.</param>
        /// <returns></returns>
        public static OutputValues GetContactList(int tenantId, List <string> attributeNames, int startIndex)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestGetContacts requestGetContacts = new RequestGetContacts();
                requestGetContacts.IndexOfFirst = startIndex;
                StringList stringList = new StringList();
                for (int count = 0; count < attributeNames.Count; count++)
                {
                    stringList.Add(attributeNames[count].ToString());
                }
                //stringList.Add("EmailAddress");
                //stringList.Add("FirstName");
                //stringList.Add("LastName");
                requestGetContacts.AttributeList = stringList;
                requestGetContacts.TenantId      = tenantId;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------GetContacts-------------");
                    logger.Info("TenantId    :" + tenantId);
                    logger.Info("AttributeList: " + stringList);
                    logger.Info("-------------------------------------");
                    IMessage message = Settings.UCSProtocol.Request(requestGetContacts);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Get Contacts Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get Contacts Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetContactList() : Universal Contact Server Protocol is Null");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Get Contacts request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
Esempio n. 20
0
        public int GetFourDigitDisplay()
        {
            List <string> signalPatterns = SignalPatterns;

            Dictionary <string, int>?numbers = signalPatterns.ToDictionary(sp => sp, _ => - 1);

            string[] patterns = new string[10];

            SetPatternNumber(signalPatterns.Where(sp => sp.Length == 2).Single(), 1);
            SetPatternNumber(signalPatterns.Where(sp => sp.Length == 3).Single(), 7);
            SetPatternNumber(signalPatterns.Where(sp => sp.Length == 4).Single(), 4);
            SetPatternNumber(signalPatterns.Where(sp => sp.Length == 7).Single(), 8);
            signalPatterns.RemoveAll(s => patterns.Contains(s));

            foreach (string signalPattern in signalPatterns.Where(sp => sp.Length == 6))
            {
                if (signalPattern.ContainsAllWires(patterns[4]))
                {
                    SetPatternNumber(signalPattern, 9);
                }
                else if (signalPattern.ContainsAllWires(patterns[7]))
                {
                    SetPatternNumber(signalPattern, 0);
                }
                else
                {
                    SetPatternNumber(signalPattern, 6);
                }
            }
            signalPatterns.RemoveAll(s => patterns.Contains(s));

            foreach (string signalPattern in signalPatterns)
            {
                if (signalPattern.ContainsAllWires(patterns[1]))
                {
                    SetPatternNumber(signalPattern, 3);
                }
                else if (patterns[6].ContainsAllWires(signalPattern))
                {
                    SetPatternNumber(signalPattern, 5);
                }
                else
                {
                    SetPatternNumber(signalPattern, 2);
                }
            }

            return(int.Parse(String.Join("", OutputValues.Select(o => numbers[o]))));



            void SetPatternNumber(string signalPattern, int number)
            {
                patterns[number]       = signalPattern;
                numbers[signalPattern] = number;
            }
        }
        public OutputValues ReadPlaceObject()
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                Settings.GetInstance().ACDPosition = string.Empty;
                Settings.GetInstance().ExtensionDN = string.Empty;
                CfgPlace      application          = new CfgPlace(_configContainer.ConfServiceObject);
                CfgPlaceQuery queryApp             = new CfgPlaceQuery();
                queryApp.TenantDbid = _configContainer.TenantDbId;
                queryApp.Name       = Settings.GetInstance().PlaceName;
                application         = _configContainer.ConfServiceObject.RetrieveObject <CfgPlace>(queryApp);

                IList <CfgDN> DNCollection = (IList <CfgDN>)application.DNs;

                if (DNCollection != null && DNCollection.Count > 0)
                {
                    foreach (CfgDN DN in DNCollection)
                    {
                        if (!String.IsNullOrEmpty(DN.Number))
                        {
                            //Code changed to get both DN's by checking its string empty value
                            if (DN.Type == CfgDNType.CFGACDPosition && Settings.GetInstance().SwitchTypeName == "nortel")
                            {
                                Settings.GetInstance().ACDPosition = DN.Number;
                            }
                            if (DN.Type == CfgDNType.CFGExtension)
                            {
                                Settings.GetInstance().ExtensionDN = DN.Number;
                                if (Settings.GetInstance().ACDPosition.Equals(string.Empty))
                                {
                                    Settings.GetInstance().ACDPosition = DN.Number;
                                }
                            }
                            //End
                        }
                    }
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = Settings.GetInstance().ErrorMessages["place.config"];
                }

                output.MessageCode = "200";
                output.Message     = "Login Successful";
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while reading " + Settings.GetInstance().PlaceName + "  =  " + commonException.ToString());

                output.MessageCode = "2001";
                output.Message     = Settings.GetInstance().ErrorMessages["place.config"];
            }
            return(output);
        }
        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <returns></returns>

        #region Single Instance

        public static OutputValues GetInstance()
        {
            if (_outPutValues == null)
            {
                _outPutValues = new OutputValues();
                return(_outPutValues);
            }
            return(_outPutValues);
        }
 protected override Output DeserializeOutput(OutputValues OutputValues)
 {
     return(new Output(OutputValues["Name", this.Name],
                       OutputValues["UserName", ""],
                       OutputValues["Password", ""],
                       OutputValues["FileName", "Screenshot"],
                       new Guid(OutputValues["FileFormatID", ""]),
                       Convert.ToBoolean(OutputValues["OpenItemInBrowser", Convert.ToString(true)]),
                       Convert.ToBoolean(OutputValues["CopyItemUrl", Convert.ToString(true)])));
 }
Esempio n. 24
0
        public void OnPost()
        {
            var list = _calculator.ListEvenFibonacciValues(Input.Value);

            Output = new OutputValues
            {
                Sum  = list.Sum(),
                List = list,
            };
        }
        protected override OutputValues SerializeOutput(Output Output)
        {
            OutputValues outputValues = new OutputValues();

            outputValues.Add("Name", Output.Name);
            outputValues.Add("FileName", Output.FileName);
            outputValues.Add("FileFormatID", Output.FileFormatID.ToString());
            outputValues.Add("EditFileName", Output.EditFileName.ToString());

            return(outputValues);
        }
Esempio n. 26
0
        /// <summary>
        /// Authenticates the user.
        /// </summary>
        internal OutputValues AuthenticateUser(string userName, string password)
        {
            OutputValues output = new OutputValues();

            try
            {
                RequestAuthenticate requestAuthenticate = RequestAuthenticate.Create(userName, password);
                IMessage            response            = ProtocolManagers.Instance().ProtocolManager[ServerType.Configserver.ToString()].Request(requestAuthenticate);
                if (response != null)
                {
                    switch (response.Id)
                    {
                    case EventAuthenticated.MessageId:
                    {
                        output.MessageCode = "200";
                        output.Message     = "User " + userName + "  Authenticated ";
                        _logger.Info("User " + userName + "  Authenticated ");

                        CfgPersonQuery qPerson = new CfgPersonQuery();
                        qPerson.UserName = userName;

                        CfgPerson person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(qPerson);
                        if (person != null)
                        {
                            CfgTenant tenant = person.Tenant;
                            if (tenant != null)
                            {
                                _configContainer.TenantDbId = tenant.DBID;
                            }
                        }
                        break;
                    }

                    case EventError.MessageId:
                    {
                        EventError eventError = (EventError)response;
                        if (eventError.Description != null)
                        {
                            _logger.Warn("User " + userName + "  is not Authenticated   " + eventError.Description);
                        }
                        output.MessageCode = "2001";
                        output.Message     = "User " + userName + "  not Authenticated ";
                        _logger.Warn("User " + userName + "  is not Authenticated   ");
                        break;
                    }
                    }
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("Error occurred while authenticating user " + userName + "  " + commonException.ToString());
            }
            return(output);
        }
Esempio n. 27
0
        protected override OutputValues SerializeOutput(Output Output)
        {
            OutputValues outputValues = new OutputValues();

            outputValues.Add("Name", Output.Name);
            outputValues.Add("Directory", Output.Directory);
            outputValues.Add("FileName", Output.FileName);
            outputValues.Add("FileFormatID", Output.FileFormatID.ToString());
            outputValues.Add("SaveAutomatically", Output.SaveAutomatically.ToString());

            return(outputValues);
        }
        /// <summary>
        /// Adds the agent favorite response.
        /// </summary>
        /// <param name="stdResponse">The standard response.</param>
        /// <param name="agentId">The agent identifier.</param>
        /// <returns></returns>
        public static OutputValues AddAgentFavoriteResponse(string stdResponse, string agentId)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); 
            OutputValues output = OutputValues.GetInstance();
            try
            {
                RequestAddAgentStdRespFavorite requestAddAgentStdRespFavorite = new RequestAddAgentStdRespFavorite();
                requestAddAgentStdRespFavorite.StandardResponse = stdResponse;
                // requestAddFavouriteResponse.Name = stdName;
                // string strAgentID = "1001";
                int? agentid = int.Parse(agentId.ToString());
                requestAddAgentStdRespFavorite.AgentId = agentid;
                // requestAddFavouriteResponse.Name = stdResponse;
                // requestAddFavouriteResponse.Name = name;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------AddAgentFavoriteResponse-------------");
                    logger.Info("StandardResponse  :" + stdResponse);
                    logger.Info("AgentId    :" + agentId);
                    logger.Info("-------------------------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(requestAddAgentStdRespFavorite);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode = "200";
                        output.Message = "Add Agent Standard Response Favorite Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode = "2001";
                        output.Message = "Don't Add Agent Standard Response Favorite.";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode = "2001";
                    output.Message = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("AddAgentFavoriteResponse() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Add Agent Standard Response Favorite request " + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode = "2001";
                output.Message = generalException.Message;
            }
            return output;

        }
Esempio n. 29
0
        internal static OutputValues DeleteSkillFromAgent(string userName, string skillName)
        {
            OutputValues output = new OutputValues();

            try
            {
                CfgPersonQuery queryPerson = new CfgPersonQuery();
                queryPerson.UserName   = userName;
                queryPerson.TenantDbid = _configContainer.TenantDbId;

                CfgPerson person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson);
                if (person != null)
                {
                    ICollection <CfgSkillLevel> agentSkills = person.AgentInfo.SkillLevels;
                    foreach (CfgSkillLevel skillToRemove in person.AgentInfo.SkillLevels)
                    {
                        if (skillToRemove.Skill.Name == skillName)
                        {
                            person.AgentInfo.SkillLevels.Remove(skillToRemove);
                            person.Save();
                            break;
                        }
                    }
                }
                output.MessageCode = "200";
                output.Message     = "Skill deleted Successfully.";

                person = _configContainer.ConfServiceObject.RetrieveObject <CfgPerson>(queryPerson);

                if (person != null)
                {
                    //Update the skill level to MySkills
                    if (person.AgentInfo.SkillLevels != null && person.AgentInfo.SkillLevels.Count > 0)
                    {
                        Datacontext.GetInstance().MySkills.Clear();
                        foreach (CfgSkillLevel skillLevel in person.AgentInfo.SkillLevels)
                        {
                            Datacontext.GetInstance().MySkills.Add(new Agent.Interaction.Desktop.Helpers.MySkills(skillLevel.Skill.Name.ToString(), skillLevel.Level));
                        }
                    }
                    else
                    {
                        Datacontext.GetInstance().MySkills.Clear();
                    }
                }
            }
            catch (Exception commonException)
            {
                output.MessageCode = "2001";
                output.Message     = (commonException.InnerException == null ? commonException.Message : commonException.InnerException.Message);
            }
            return(output);
        }
        protected override OutputValues SerializeOutput(Output Output)
        {
            OutputValues outputValues = new OutputValues();

            outputValues.Add("Name", Output.Name);
            outputValues.Add("Application", Output.Application);
            outputValues.Add("Arguments", Output.Arguments);
            outputValues.Add("FileName", Output.FileName);
            outputValues.Add("FileFormatID", Output.FileFormatID.ToString());

            return(outputValues);
        }