コード例 #1
0
ファイル: MainForm.cs プロジェクト: desla/SlabGeometryControl
 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;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
        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;
        }
コード例 #3
0
 private Color SelectColorByDimentionResult(DimentionResult aResult)
 {
     if (aResult == null || IsResultSatisfyRegulations(aResult)) {
         return NextGreenColor();
     }
     else {
         return NextRedColor();
     }
 }
コード例 #4
0
 public void SetDimentionResults(DimentionResult[] aDimentionResults)
 {
     slabDimentionsResults = aDimentionResults;
 }