private void UpdateRegulationAccepted(int aRowIndex, SlabInfo aSlabInfo) { var row = dataGridView1.Rows[aRowIndex]; if (CheckRegulationsAccepted(aSlabInfo)) { row.Cells["Accepted"].Value = "Соответствует"; row.DefaultCellStyle.BackColor = Color.White; } else { row.Cells["Accepted"].Value = "Не соответствует"; row.DefaultCellStyle.BackColor = Color.LightGray; } }
private bool CheckRegulationsAccepted(SlabInfo aSlabInfo) { if (slabsList.Regulations != null && aSlabInfo != null && client != null) { var dimentionResults = client.GetDimentionResultsBySlabId(aSlabInfo.Id); if (dimentionResults != null) { for (var i = 0; i < slabsList.Regulations.Length; ++i) { var regulation = slabsList.Regulations[i]; if (regulation.StandartSizeId == aSlabInfo.StandartSizeId) { for (var j = 0; j < dimentionResults.Length; ++j) { var dimentionResult = dimentionResults[j]; if (dimentionResult.DimentionId == regulation.DimentionId) { if (dimentionResult.Value < regulation.MinValue || dimentionResult.Value > regulation.MaxValue) { return false; } } // if } // for } } // for } // if } // if return true; }
private void CheckStandartSizeUpdated(int aRowIndex, SlabInfo aSlabInfo) { if (aRowIndex < 0 || aSlabInfo == null) { return; } var row = dataGridView1.Rows[aRowIndex]; var standartSizeText = GetStandartSizeById(aSlabInfo.StandartSizeId); if (!Equals(row.Cells["StandartSize"].Value, standartSizeText)) { row.Cells["StandartSize"].Value = standartSizeText; row.Cells["standartSizeId"].Value = aSlabInfo.StandartSizeId; UpdateRegulationAccepted(aRowIndex, aSlabInfo); } }