/// <summary>
 /// Enables to set the StatusCode
 /// </summary>
 /// <param name="severity"></param>
 public DsoHttpResult(SeverityEnum severity)
 {
     StatusCode    = EnumSeverity.GetCode(severity);
     Notifications = new List <DsoHttpResultNotification>();
     MutationCode  = EnumMutation
                     .GetCode(MutationEnum.None);
 }
 /// <summary>
 /// Successful constructor
 /// </summary>
 public DsoHttpResult()
 {
     StatusCode    = EnumSeverity.GetCode(SeverityEnum.Ok);
     Notifications = new List <DsoHttpResultNotification>();
     MutationCode  = EnumDsoHttpResultMutation
                     .GetCode(DsoHttpResultMutationEnum.None);
 }
 public DsoHttpResultNotification(
     SeverityEnum severity,
     string message)
 {
     SeverityCode = EnumSeverity.GetCode(severity);
     Message      = message;
 }
        public ControlObjectException(EnumSeverity severity, EnumMessageCode messageCode)
        {
            UserMessage message = new UserMessage();

            message.MessageCode = messageCode;
            message.Severity = severity;

            this._errorList.Add(message);
        }
 protected DsoHttpResult(
     SeverityEnum severity,
     bool hasMoreResults,
     MutationEnum mutation = MutationEnum.None) :
     this()
 {
     StatusCode     = EnumSeverity.GetCode(severity);
     MutationCode   = EnumMutation.GetCode(mutation);
     HasMoreResults = hasMoreResults;
 }
 private async Task WriteLogAsync(
     string message,
     string topic,
     SeverityEnum severity = SeverityEnum.Debug,
     string memberName     = "",
     string filePath       = "",
     int lineNumber        = -1)
 {
     await _logWriter.WriteLogAsync(
         _userId, _companyId, topic,
         EnumSeverity.GetCode(severity),
         Environment.MachineName,
         memberName, filePath, lineNumber,
         message, DateTime.UtcNow);
 }
Exemple #7
0
 public static void Write(string logText, EnumLogType thisType, string userName, EnumSeverity thisSeverity,  string URL)
 {
     string thisUserName = userName == null ? "NotLogged" : userName;
     SqlConnection myConnection = new SqlConnection();
     myConnection.ConnectionString = Configuration.ConnectionStrings.ExternalData;
     SqlCommand myCommand = new SqlCommand("Logs_AddExtendedLog", myConnection);
     myCommand.Parameters.Add(new SqlParameter("@LogText", logText));
     myCommand.Parameters.Add(new SqlParameter("@LogType", thisType.ToString()));
     myCommand.Parameters.Add(new SqlParameter("@UserName", thisUserName));
     myCommand.Parameters.Add(new SqlParameter("@Severity", thisSeverity.ToString()));
     myCommand.Parameters.Add(new SqlParameter("@MachineName", System.Environment.MachineName));
     myCommand.Parameters.Add(new SqlParameter("@URL", URL));
     myCommand.CommandType = CommandType.StoredProcedure; ;
     myConnection.Open();
     myCommand.ExecuteNonQuery();
     myConnection.Close();
 }
        public void AddComment(string comment, bool isMessageCode, EnumSeverity severity)
        {
            ListItem item = new ListItem();

            if (!isMessageCode) item.Text = comment;
            else
            {
            #warning >> The messages are extracted from the RES at the root of the project. This should be changed.
                try
                {
                    ResourceManager LocRM = new ResourceManager("UltimateSniper_WebSite.mess", typeof(Comments).Assembly);
                    item.Text = LocRM.GetString(comment);
                }
                catch
                {
                    item.Text = comment;
                }
            }

            switch (severity)
            {
                case EnumSeverity.Information:
                    item.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "black");
                    break;
                case EnumSeverity.Bug:
                    item.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "brown");
                    break;
                case EnumSeverity.Error:
                    item.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "red");
                    break;
                case EnumSeverity.Warning:
                    item.Attributes.CssStyle.Add(HtmlTextWriterStyle.Color, "orange");
                    break;
            }

            this.BulletListComments.Items.Add(item);

            if (this.BulletListComments.Items.Count > 0) this.PanelComments.Visible = true;
            else this.PanelComments.Visible = false;
        }
Exemple #9
0
 ///
 ///	 <summary> * SetSeverity
 ///	 *  </summary>
 ///	 * <param name="EnumSeverity"> s </param>
 ///
 public virtual void setSeverity(EnumSeverity s)
 {
     setAttribute(JDFConstants.SEVERITY, s.getName(), null);
 }
 public void AddInformation(string information, bool isMessageCode, EnumSeverity severity)
 {
     this.lblComments.Text += information + "<br/>";
 }
Exemple #11
0
 static JDFAutoAction()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.SEVERITY, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumSeverity.getEnum(0), "Error");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.ID, 0x22222222, AttributeInfo.EnumAttributeType.ID, null, null);
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.TESTREF, 0x22222222, AttributeInfo.EnumAttributeType.IDREF, null, null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.LOC, 0x33333333);
     elemInfoTable[1] = new ElemInfoTable(ElementName.PREFLIGHTACTION, 0x33333333);
 }
Exemple #12
0
 ///
 ///	 <summary> * GetSeverity
 ///	 *  </summary>
 ///	 * <returns> EnumSeverity </returns>
 ///
 public virtual EnumSeverity getSeverity()
 {
     return(EnumSeverity.getEnum(getAttribute(JDFConstants.SEVERITY, null, null)));
 }
Exemple #13
0
        // ************************************************************************
        // * Attribute getter / setter
        // * ************************************************************************
        //

        //         ---------------------------------------------------------------------
        //        Methods for Attribute Severity
        //        ---------------------------------------------------------------------
        ///
        ///          <summary> * (5) set attribute Severity </summary>
        ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
        ///
        public virtual void setSeverity(EnumSeverity enumVar)
        {
            setAttribute(AttributeName.SEVERITY, enumVar == null ? null : enumVar.getName(), null);
        }
Exemple #14
0
 ///
 ///          <summary> * (9) get attribute Severity </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumSeverity getSeverity()
 {
     return(EnumSeverity.getEnum(getAttribute(AttributeName.SEVERITY, null, "Error")));
 }
 public void AddInformation(string information, bool isMessageCode, EnumSeverity severity)
 {
     ((Site)this.Page.Master).AddComment(information, isMessageCode, severity);
 }
        private void WriteLog(
            SeverityEnum severity, string topic, string context, string message)
        {
            using (var cn = new SqlConnection(_msSqlConnectionString))
            {
                cn.Open();

                context = context?.Replace("'", "''") ?? "na";
                if (context.Length > _contextLength)
                {
                    context = context.Substring(0, _contextLength);
                }

                // topic
                string pTopic;
                if (string.IsNullOrEmpty(topic))
                {
                    pTopic = "NULL";
                }
                else
                {
                    if (topic.Length > _topicLength)
                    {
                        topic = topic.Substring(0, _topicLength);
                    }
                    topic  = topic.Replace("'", "''");
                    pTopic = $"'{topic}'";
                }

                message = message?.Replace("'", "''") ?? "na";

                // userId
                string pUserId;
                if (string.IsNullOrEmpty(_userId))
                {
                    pUserId = "NULL";
                }
                else
                {
                    if (_userId.Length > _userIdLength)
                    {
                        _userId = _userId.Substring(0, _userIdLength);
                    }
                    _userId = _userId.Replace("'", "''");
                    pUserId = $"'{_userId}'";
                }

                // companyId
                string pCompanyId;
                if (string.IsNullOrEmpty(_companyId))
                {
                    pCompanyId = "NULL";
                }
                else
                {
                    if (_companyId.Length > _companyIdLength)
                    {
                        _companyId = _companyId.Substring(0, _companyIdLength);
                    }
                    _companyId = _companyId.Replace("'", "''");
                    pCompanyId = $"'{_companyId}'";
                }

                var machineName = Environment.MachineName;
                if (machineName.Length > _machineNameLength)
                {
                    machineName = machineName.Substring(0, _machineNameLength);
                }
                machineName = machineName.Replace("'", "''");

                var cmdText = $"INSERT INTO [{_tableSchema}].[{_tableName}] "
                              + "( "
                              + $" [{_userIdColumnName}], "
                              + $" [{_companyIdColumnName}], "
                              + $" [{_severityCodeColumnName}], "
                              + $" [{_machineNameColumnName}], "
                              + $" [{_topicColumnName}], "
                              + $" [{_contextColumnName}], "
                              + $" [{_messageColumnName}], "
                              + $" [{_createDateColumnName}] "
                              + ")"
                              + "VALUES "
                              + "( "
                              + $"{pUserId}, "
                              + $"{pCompanyId}, "
                              + $"'{EnumSeverity.GetCode(severity)}', "
                              + $"'{machineName}', "
                              + $"{pTopic}, "
                              + $"'{context}', "
                              + $"'{message}', "
                              + $"'{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss.sss}' "
                              + ")";

                var cmd = new SqlCommand(cmdText, cn)
                {
                    CommandType = CommandType.Text
                };

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Error : " + e.GetDeepMessage());
                }
                finally
                {
                    cn.Close();
                }
            }
        }
 public void AddComment(string comment, bool isMessageCode, EnumSeverity severity)
 {
     this.CommentsMain.AddComment(comment, isMessageCode, severity);
 }
        private void WriteLog(
            SeverityEnum severity, string context, string message)
        {
            using (var cn = new SqlConnection(_msSqlConnectionString))
            {
                cn.Open();

                context = context?.Replace("'", "''") ?? "na";
                if (context.Length > 256)
                {
                    context = context.Substring(0, 256);
                }

                message = message.Replace("'", "''");

                var uId = UserId.HasValue ? $"'{UserId.Value}'" : "NULL";

                var cId = CompanyId.HasValue ? $"'{CompanyId.Value}'" : "NULL";

                var machineName = Environment.MachineName.Replace("'", "''");
                if (machineName.Length > 50)
                {
                    machineName = machineName.Substring(0, 50);
                }

                var cmdText = "INSERT INTO ApplicationLog "
                              + "( "
                              + " [AspNetUserId], "
                              + " [CompanyId], "
                              + " [SeverityCode], "
                              + " [Machine], "
                              + " [Context], "
                              + " [Message], "
                              + " [CreateDateUtc] "
                              + ")"
                              + "VALUES "
                              + "( "
                              + $"{uId}, "
                              + $"{cId}, "
                              + $"'{EnumSeverity.GetCode(severity)}', "
                              + $"'{machineName}', "
                              + $"'{context}', "
                              + $"'{message}', "
                              + $"'{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss.sss}' "
                              + ")";

                var cmd = new SqlCommand(cmdText, cn)
                {
                    CommandType = CommandType.Text
                };

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Error : " + e.GetDeepMessage());
                }
                finally
                {
                    cn.Close();
                }
            }
        }
 public UserMessage(EnumSeverity severity, EnumMessageCode messageCode)
 {
     Severity = severity;
     MessageCode = messageCode;
 }