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); } }
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); }
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); } }
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); }
private void Audit(string message, string method, int line, AuditSeverity auditSeverity) { string module = "Person User Control"; Audit(message, method, module, line, auditSeverity); }