private void ShowDimentionResults(DimentionResult[] aDimentions) { dataGridView2.Rows.Clear(); if (aDimentions != null) { foreach (var dimentionResult in aDimentions) { var row = new[] { dimentionTitles[dimentionResult.DimentionId], dimentionResult.Value.ToString() }; var rowIndex = dataGridView2.Rows.Add(row); if (currentStandartSizeId != -1 && slabsList.Regulations != null) { var gridRow = dataGridView2.Rows[rowIndex]; foreach (var regulation in slabsList.Regulations) { if (regulation.StandartSizeId == currentStandartSizeId) { if (dimentionResult.DimentionId == regulation.DimentionId) { if (dimentionResult.Value < regulation.MinValue || dimentionResult.Value > regulation.MaxValue) { //gridRow.DefaultCellStyle.BackColor = Color.LightGray; gridRow.DefaultCellStyle.ForeColor = Color.Red; break; } } } } } } } }
private bool IsResultSatisfyRegulations(DimentionResult aResult) { if (aResult == null) { return true; } var regulation = regulations.FirstOrDefault( r => r.DimentionId == aResult.DimentionId && r.StandartSizeId == standartSizeId); if (regulation == null) { return true; } var value = aResult.Value; return value >= regulation.MinValue && value <= regulation.MaxValue; }
private Color SelectColorByDimentionResult(DimentionResult aResult) { if (aResult == null || IsResultSatisfyRegulations(aResult)) { return NextGreenColor(); } else { return NextRedColor(); } }
public void SetDimentionResults(DimentionResult[] aDimentionResults) { slabDimentionsResults = aDimentionResults; }