コード例 #1
0
        private void btnGetCSQsRealtimeData_Click(object sender, EventArgs e)
        {
            Trace.TraceInformation("Enter.");

            Trace.TraceInformation("Enter.");

            if (ucWebServerSettings.txtWebServerIPAddress.Text == String.Empty)
            {
                MessageBox.Show("No valid IP Address provided for the Web Server.", Application.ProductName, MessageBoxButtons.OK);

                return;
            }

            if (ucWebServerSettings.txtContactDataCollectionPort.Text == String.Empty)
            {
                MessageBox.Show("No valid Contact Data Collection Port provided for the Web Server.", Application.ProductName, MessageBoxButtons.OK);

                return;
            }

            if (ucUCCXInformation.txtUCCXAdminUser.Text == String.Empty)
            {
                MessageBox.Show("No valid UCCX Admin User provided in UCCX Information.", Application.ProductName, MessageBoxButtons.OK);

                return;
            }

            if (ucUCCXInformation.txtUCCXAdminPassword.Text == String.Empty)
            {
                MessageBox.Show("No valid UCCX Admin Password provided in UCCX Information.", Application.ProductName, MessageBoxButtons.OK);

                return;
            }

            try
            {
                String sURL = "http://" + ucWebServerSettings.txtWebServerIPAddress.Text + ":" + ucWebServerSettings.txtContactDataCollectionPort.Text;

                com.workflowconcepts.utilities.AESSymmetricEncryption endDec = new com.workflowconcepts.utilities.AESSymmetricEncryption(Constants.ENCRYPTION_PASSWORD, Constants.ENCRYPTION_SALT);

                String sToken = System.Text.RegularExpressions.Regex.Replace(endDec.Encrypt(ucUCCXInformation.txtUCCXAdminUser.Text) + endDec.Encrypt(ucUCCXInformation.txtUCCXAdminPassword.Text), "[^A-Za-z0-9]", "");

                endDec = null;

                sURL = sURL + "/uccxrealtimedata?operation=getcsqdata&token=" + sToken;

                Trace.TraceInformation("sURL = " + sURL);

                System.Diagnostics.Process.Start(sURL);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
            }
        }
コード例 #2
0
        public ApplicationTypes.ApplicationSettingsReturn Save()
        {
            Trace.TraceInformation("Enter.");

            try
            {
                _encDec = new com.workflowconcepts.utilities.AESSymmetricEncryption(Constants.ENCRYPTION_PASSWORD, Constants.ENCRYPTION_SALT);

                System.Xml.XmlWriterSettings _XMLSettings = new System.Xml.XmlWriterSettings();

                _XMLSettings.Indent = true;

                System.Xml.XmlWriter _XMLWriter = System.Xml.XmlWriter.Create(APPLICATIONSETTINGSFILEPATH + "\\" + Constants.APPLICATIONSETTINGSFILENAME, _XMLSettings);

                _XMLWriter.WriteStartDocument();

                _XMLWriter.WriteStartElement("ApplicationSettings");

                _XMLWriter.WriteStartElement("WebServer");
                _XMLWriter.WriteAttributeString("IP", WebServerIP);
                _XMLWriter.WriteAttributeString("Port", WebServerPort);
                _XMLWriter.WriteAttributeString("Prefix", WebServerPrefix);
                _XMLWriter.WriteAttributeString("DataCollectionPort", WebServerDataCollectionPort);
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("EmailNotifications");
                _XMLWriter.WriteAttributeString("EmailFrom", _EmailFrom);
                _XMLWriter.WriteAttributeString("EmailTo", _EmailTo);
                _XMLWriter.WriteAttributeString("SMTPServer", _EmailSMTPServer);
                _XMLWriter.WriteAttributeString("SMTPPort", _EmailSMTPPort);
                _XMLWriter.WriteAttributeString("SMTPUser", _encDec.Encrypt(_EmailSMTPUserName));
                _XMLWriter.WriteAttributeString("SMTPPassword", _encDec.Encrypt(_EmailSMTPPassword));
                _XMLWriter.WriteAttributeString("OnFailure", _EmailOnFailure.ToString());
                _XMLWriter.WriteAttributeString("OnSuccess", _EmailOnSuccess.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("UCCX");
                _XMLWriter.WriteAttributeString("Node1IPAddress", _UCCXNode1IPAddress);
                _XMLWriter.WriteAttributeString("Node2IPAddress", _UCCXNode2IPAddress);
                _XMLWriter.WriteAttributeString("ApplicationPort", _UCCXApplicationPort);
                _XMLWriter.WriteAttributeString("RealtimeDataPort", _UCCXRealtimeDataPort);
                _XMLWriter.WriteAttributeString("AuthorizationPrefix", _UCCXAuthorizationPrefix);
                _XMLWriter.WriteAttributeString("CallbackPrefix", _UCCXCallbackPrefix);
                _XMLWriter.WriteAttributeString("AdminUser", _encDec.Encrypt(_UCCXAdminUser));
                _XMLWriter.WriteAttributeString("AdminPassword", _encDec.Encrypt(_UCCXAdminPassword));
                _XMLWriter.WriteAttributeString("NumberOfIVRPorts", _UCCXNumberOfIVRPorts);
                _XMLWriter.WriteAttributeString("MaxIVRPortUsagePercent", _UCCXMaxIVRPortUsagePercent);
                _XMLWriter.WriteFullEndElement();

                _EncryptedUCCXAdminUser     = _encDec.Encrypt(_UCCXAdminUser);
                _EncryptedUCCXAdminPassword = _encDec.Encrypt(_UCCXAdminPassword);

                _XMLWriter.WriteStartElement("CallbackRecords");
                _XMLWriter.WriteAttributeString("MaximumNumberOfDays", _MaximumNumberOfDays.ToString());
                _XMLWriter.WriteAttributeString("MaximumNumberOfAttempts", _MaximumNumberOfAttempts.ToString());
                _XMLWriter.WriteAttributeString("MinimumIntervalBetweenRetries", _MinimumIntervalBetweenRetries.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("BasicInsertionThrottling");
                _XMLWriter.WriteAttributeString("Enabled", _BasicInsertionThrottling_Enabled.ToString());
                _XMLWriter.WriteAttributeString("MaximumAtATime", _BasicInsertionThrottling_MaximumRecordsAtATime.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("API");
                _XMLWriter.WriteAttributeString("NumberOfHandlerThreads", _NumberOfAPIThreads.ToString());
                _XMLWriter.WriteAttributeString("HandlerThreadsSleep", _APIHandlerThreadsSleep.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("Debug");
                _XMLWriter.WriteAttributeString("Enabled", _DebugEnabled.ToString());
                _XMLWriter.WriteAttributeString("Level", _DebugLevel);
                _XMLWriter.WriteAttributeString("RetainUnit", _DebugRetainUnit);
                _XMLWriter.WriteAttributeString("RetainValue", _DebugRetainValue);
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteEndDocument();

                _XMLWriter.Flush();
                _XMLWriter.Close();
                _XMLWriter = null;

                _XMLSettings = null;

                _encDec = null;

                return(ApplicationTypes.ApplicationSettingsReturn.SUCCESS);
            }
            catch (Exception ex)
            {
                _encDec = null;

                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);

                return(ApplicationTypes.ApplicationSettingsReturn.ERROR);
            }
        }
コード例 #3
0
        public ApplicationTypes.ApplicationSettingsReturn CreateDefaultSettings()
        {
            Trace.TraceInformation("Enter.");

            try
            {
                _encDec = new com.workflowconcepts.utilities.AESSymmetricEncryption(Constants.ENCRYPTION_PASSWORD, Constants.ENCRYPTION_SALT);

                System.Xml.XmlWriterSettings _XMLSettings = new System.Xml.XmlWriterSettings();

                _XMLSettings.Indent = true;

                System.Xml.XmlWriter _XMLWriter = System.Xml.XmlWriter.Create(APPLICATIONSETTINGSFILEPATH + "\\" + Constants.APPLICATIONSETTINGSFILENAME, _XMLSettings);

                _XMLWriter.WriteStartDocument();

                _XMLWriter.WriteStartElement("ApplicationSettings");

                _XMLWriter.WriteStartElement("WebServer");
                _XMLWriter.WriteAttributeString("IP", Constants.IPAddress);
                _XMLWriter.WriteAttributeString("Port", Constants.WEBSERVER_PORT);
                _XMLWriter.WriteAttributeString("Prefix", Constants.WEBSERVER_PREFIX);
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("EmailNotifications");
                _XMLWriter.WriteAttributeString("EmailFrom", _EmailFrom);
                _XMLWriter.WriteAttributeString("EmailTo", _EmailTo);
                _XMLWriter.WriteAttributeString("SMTPServer", _EmailSMTPServer);
                _XMLWriter.WriteAttributeString("SMTPPort", _EmailSMTPPort);
                _XMLWriter.WriteAttributeString("SMTPUser", _encDec.Encrypt(_EmailSMTPUserName));
                _XMLWriter.WriteAttributeString("SMTPPassword", _encDec.Encrypt(_EmailSMTPPassword));
                _XMLWriter.WriteAttributeString("OnFailure", _EmailOnFailure.ToString());
                _XMLWriter.WriteAttributeString("OnSuccess", _EmailOnSuccess.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("CallbackRecords");
                _XMLWriter.WriteAttributeString("MaximumNumberOfDays", Constants.MAXIMUM_NUMBER_OF_DAYS.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("BasicInsertionThrottling");
                _XMLWriter.WriteAttributeString("Enabled", _BasicInsertionThrottling_Enabled.ToString());
                _XMLWriter.WriteAttributeString("MaximumAtATime", _BasicInsertionThrottling_MaximumRecordsAtATime.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("API");
                _XMLWriter.WriteAttributeString("NumberOfHandlerThreads", Constants.NUMBER_OF_HANDLER_THREADS.ToString());
                _XMLWriter.WriteAttributeString("HandlerThreadsSleep", Constants.API_HANDLER_THREADS_SLEEP.ToString());
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteStartElement("Debug");
                _XMLWriter.WriteAttributeString("Enabled", "true");
                _XMLWriter.WriteAttributeString("Level", "verbose");
                _XMLWriter.WriteAttributeString("RetainUnit", "Files");
                _XMLWriter.WriteAttributeString("RetainValue", "100");
                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteFullEndElement();

                _XMLWriter.WriteEndDocument();

                _XMLWriter.Flush();
                _XMLWriter.Close();
                _XMLWriter = null;

                _XMLSettings = null;

                _encDec = null;

                return(ApplicationTypes.ApplicationSettingsReturn.SUCCESS);
            }
            catch (Exception ex)
            {
                _encDec = null;

                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);

                return(ApplicationTypes.ApplicationSettingsReturn.ERROR);
            }
        }
コード例 #4
0
        public bool GetInformation()
        {
            try
            {
                String sURL = String.Empty;

                com.workflowconcepts.utilities.AESSymmetricEncryption endDec = new com.workflowconcepts.utilities.AESSymmetricEncryption(Constants.ENCRYPTION_PASSWORD, Constants.ENCRYPTION_SALT);

                String sToken = System.Text.RegularExpressions.Regex.Replace(endDec.Encrypt(_ApplicationSettings.UCCXAdminUser) + endDec.Encrypt(_ApplicationSettings.UCCXAdminPassword), "[^A-Za-z0-9]", "");

                endDec = null;

                sURL = "http://" + _ApplicationSettings.WebServerIP + ":" + _ApplicationSettings.WebServerDataCollectionPort + "/" + "uccxrealtimedata" + "?operation=getagentdata&token=" + sToken;

                //Trace.TraceInformation("sURL = " + sURL);

                System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(sURL);

                System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();

                //Trace.TraceInformation("Content type is {0} and length is {1}", response.ContentType, response.ContentLength);

                System.IO.Stream stream = response.GetResponseStream();

                // Pipes the stream to a higher level stream reader with the required encoding format.
                System.IO.StreamReader streamReader = new System.IO.StreamReader(stream, Encoding.UTF8);

                String sResponse = streamReader.ReadToEnd();

                streamReader.Close();
                streamReader.Dispose();
                streamReader = null;

                stream.Close();
                stream.Dispose();
                stream = null;

                response.Close();
                response = null;
                request  = null;

                xmlDoc = new XmlDocument();

                xmlDoc.LoadXml(sResponse);

                System.Security.Cryptography.HashAlgorithm algorithm = System.Security.Cryptography.MD5.Create();  //or use SHA256.Create();
                byte[] bHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(sResponse));

                StringBuilder sb = new StringBuilder();

                foreach (byte b in bHash)
                {
                    sb.Append(b.ToString("X2"));
                }

                _Hash = sb.ToString();

                sb = null;

                return(true);
            }
            catch (Exception ex)
            {
                Trace.TraceError("Exception:" + ex.Message + Environment.NewLine + "StackTrace:" + ex.StackTrace);
                _Hash = String.Empty;
                return(false);
            }
        }