コード例 #1
0
ファイル: ClientRequest.cs プロジェクト: idavehuwei/CTPS
        private string jsonErrorMessage(string webSocket, string errorCode, string message, ErrorSeverity severity, string label = "", bool sendMessage = true)
        {
            try
            {
                #region Create Errorobject

                ErrorObject error = new ErrorObject
                {
                    Id            = SemafoneConnection.GetNextResponseId(),
                    Datetime      = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff"),
                    ErrorSeverity = severity.ToString(),
                    ErrorLabel    = label,
                    ErrorCode     = Convert.ToInt32(errorCode),
                    ErrorMessage  = message
                };
                ErrorResponse errorResponseMessage = new ErrorResponse(error);
                #endregion
                string errorJson = JsonConvert.SerializeObject(errorResponseMessage);
                TpsLogManager <Semafone> .Error(message + " error message sent to " + webSocket);

                return(errorJson);
            }
            catch (Exception e)
            {
                TpsLogManager <Semafone> .Error("Error jsonErrorMessage : " + e.Message + e.StackTrace);

                return(e.Message);
            }
        }
コード例 #2
0
ファイル: SemafoneConnection.cs プロジェクト: idavehuwei/CTPS
 SemafoneConnection() : base(System.Reflection.Assembly.GetExecutingAssembly().Location)
 {
     if (ApplicationSettings.ContainsKey("ApplicationIdentifier"))
     {
         ApplicationIdentifier = ApplicationSettings["ApplicationIdentifier"];
     }
     if (ApplicationSettings.ContainsKey("GenesysConfigURIPri"))
     {
         ConfigServerPrimaryUri = ApplicationSettings["GenesysConfigURIPri"];
     }
     if (ApplicationSettings.ContainsKey("GenesysConfigURIBack"))
     {
         ConfigServerBackupUri = ApplicationSettings["GenesysConfigURIBack"];
     }
     if (ApplicationSettings.ContainsKey("SemafoneCMEAppName"))
     {
         ClientConnectedToCMEApp = ApplicationSettings["SemafoneCMEAppName"];
     }
     SemafoneConnectionInstance = this;
 }