void ChangeProcessingRecordBackColor() { if (objNewConnection == null) { objNewConnection = new Connection(); } if (objEESDba == null) { objEESDba = new EESDba(); } if (objGeneralDba == null) { objGeneralDba = new GeneralDba(); } int queueId = 0; try { if (wgrid.dataGridView1.DataSource != null) { //for (int i = 0; i <= wgrid.dataGridView1.Rows.Count - 1; i++) //{ // if (Convert.ToString(wgrid.dataGridView1.Rows[i].Cells["PROCESS"].Value) == "REHNDLING") // { // wgrid.dataGridView1.Rows[i].Cells["PROCESS"].Style.ForeColor = System.Drawing.Color.White; // wgrid.dataGridView1.Rows[i].Cells["PROCESS"].Style.BackColor = System.Drawing.Color.DarkRed; // } //} int pathLockId = objGeneralDba.GetPathlockId(); for (int i = 0; i <= wgrid.dataGridView1.Rows.Count - 1; i++) { var grid = wgrid.dataGridView1; var processCell = grid.Rows[i].Cells["PROCESS"]; if (!Convert.ToString(grid.Rows[i].Cells["PROCESS"].Value).Equals("PROCESSING")) { processCell.Style.ForeColor = System.Drawing.Color.White; processCell.Style.SelectionForeColor = System.Drawing.Color.White; processCell.Style.BackColor = System.Drawing.Color.DarkCyan; processCell.Style.SelectionBackColor = System.Drawing.Color.DarkCyan; } var modeCell = grid.Rows[i].Cells["MODE"]; if (Convert.ToString(modeCell.Value) == "ENTRY") { modeCell.Style.ForeColor = System.Drawing.Color.DarkGreen; } else if (Convert.ToString(modeCell.Value) == "EXIT") { modeCell.Style.ForeColor = System.Drawing.Color.DarkRed; } var qCell = grid.Rows[i].Cells["TRANS ID"]; var snoCell = grid.Rows[i].Cells["S_NO"]; queueId = int.Parse(Convert.ToString(qCell.Value)); if (objNewConnection.IsTriggerEnabledUsingQueueId(queueId)) { snoCell.Style.BackColor = System.Drawing.Color.Red; snoCell.Style.SelectionBackColor = System.Drawing.Color.Red; } if (Convert.ToString(grid.Rows[i].Cells["HOLD_FLAG"].Value).Equals("1")) { snoCell.Style.BackColor = System.Drawing.Color.Yellow; snoCell.Style.SelectionBackColor = System.Drawing.Color.Yellow; } var washCell = grid.Rows[i].Cells["CAR WASH"]; if (Convert.ToString(washCell.Value) == "YES") { washCell.Style.BackColor = System.Drawing.Color.BlueViolet; } var timerCell = grid.Rows[i].Cells["TIMER"]; Int32 tempVal = 0; Int32.TryParse(timerCell.Value.ToString().Split(':')[0], out tempVal); if (tempVal >= 9) { timerCell.Style.ForeColor = System.Drawing.Color.Red; timerCell.Style.SelectionForeColor = System.Drawing.Color.Red; } var cmdCell = grid.Rows[i].Cells["L2 CMD"]; if (Convert.ToString(cmdCell.Value).Equals("Payment")) { gateForGrid = Convert.ToString(grid.Rows[i].Cells["GATE"].Value); char c = gateForGrid[gateForGrid.Length - 1]; wgrid.BeginInvoke(new InvokeDelegate(new Action(() => { objEESDba.getEESParameters(c - '0', out eesChannelForGrid, out eesCodeForGrid); if (GetInnerDoorBlockedStatus(eesChannelForGrid, eesCodeForGrid)) { cmdCell.Style.BackColor = System.Drawing.Color.Red; cmdCell.Style.SelectionBackColor = System.Drawing.Color.Red; } //else //{ // cmdCell.Style.BackColor = System.Drawing.Color.Green; // cmdCell.Style.SelectionBackColor = System.Drawing.Color.Green; //} }))); } var transIdCell = grid.Rows[i].Cells["TRANS ID"]; if (pathLockId != 0 && Convert.ToString(transIdCell.Value).Equals(pathLockId.ToString())) { transIdCell.Style.BackColor = System.Drawing.Color.LightCyan; transIdCell.Style.SelectionBackColor = System.Drawing.Color.LightCyan; } } } } catch (Exception errMsg) { Console.WriteLine(); } finally { } }