示例#1
0
文件: Audit.cs 项目: mchnry/flow
 public Audit(AuditCode code, AuditSeverity severity, string itemId, string message)
 {
     this.Code     = code;
     this.Severity = severity;
     this.ItemId   = itemId;
     this.Message  = message;
 }
 private void OnAudit(string message, AuditSeverity severity)
 {
     if (Audit != null)
     {
         Audit(message, severity);
     }
 }
示例#3
0
        private Color GetColorBySeverity(AuditSeverity severity)
        {
            Color color = Color.White;

            switch (severity)
            {
            case AuditSeverity.Information:
                color = Color.Aquamarine;
                break;

            case AuditSeverity.Important:
                color = Color.LawnGreen;
                break;

            case AuditSeverity.Warning:
                color = Color.Plum;
                break;

            case AuditSeverity.Critical:
                color = Color.Tomato;
                break;

            case AuditSeverity.Error:
                color = Color.Red;
                break;

            default:
                color = Color.Yellow;
                break;
            }

            return(color);
        }
示例#4
0
        private void Audit(string message, AuditSeverity severity)
        {
            try
            {
                string nowDateTime = DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy");

                dgvAudit.Rows.Insert(0, new string[] { nowDateTime, message, Utils.GetEnumDescription(severity) });
                dgvAudit.Rows[0].DefaultCellStyle.BackColor = GetColorBySeverity(severity);

                dgvAudit.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
                dgvAudit.ClearSelection();

                if (configurationInformation != null)
                {
                    if (configurationInformation.LogToFile)
                    {
                        AuditFile.WriteLine($"{nowDateTime} <{Utils.GetEnumDescription(severity)}>: {message}");
                        AuditFile.Flush();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "שגיאת כתיבה", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
 private void Search_Audit(string message, AuditSeverity severity)
 {
     try
     {
         Audit(message, severity);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message,
                         "תקלת בקרה",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
        private void Audit(string message, string method, int line, AuditSeverity auditSeverity)
        {
            string module = "BLL";

            Audit(message, method, module, line, auditSeverity);
        }
 private void Audit(string message, string method, string module, int line, AuditSeverity auditSeverity)
 {
     OnMessage(message, method, module, line, auditSeverity);
 }
 public void OnMessage(string message, string method, string module, int line, AuditSeverity auditSeverity)
 {
     Message?.Invoke(message, method, module, line, auditSeverity);
 }
示例#9
0
        private void Audit(string message, string method, int line, AuditSeverity auditSeverity)
        {
            string module = "Person User Control";

            Audit(message, method, module, line, auditSeverity);
        }