private void dgvLogDetail_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == ProcessDetailStatus.Index && e.Value != null) { LogTableDetail.ProcessStatusDetailEnum processStatus = (LogTableDetail.ProcessStatusDetailEnum)e.Value; e.Value = LogTableDetailsProcess.StatusDesc(processStatus); switch (processStatus) { case LogTableDetail.ProcessStatusDetailEnum.Warning: e.CellStyle.ForeColor = Color.Black; e.CellStyle.BackColor = Color.Yellow; break; case LogTableDetail.ProcessStatusDetailEnum.Error: e.CellStyle.ForeColor = Color.White; e.CellStyle.BackColor = Color.Red; break; case LogTableDetail.ProcessStatusDetailEnum.Fail: e.CellStyle.ForeColor = Color.White; e.CellStyle.BackColor = Color.DarkRed; break; default: e.CellStyle.ForeColor = Color.Black; e.CellStyle.BackColor = Color.White; break; } } }
private void RefreshLogDetail() { Guid processLogRowID = new Guid(); if (dgvLog.SelectedCells.Count > 0) { processLogRowID = (Guid)dgvLog.SelectedCells[0].OwningRow.Cells["RowID"].Value; } else { processLogRowID = Guid.NewGuid(); } dgvLogDetail.DataSource = LogTableDetailsProcess.GetLogDetails(processLogRowID); }