DataSet dataSetMachine = new DataSet();
dataSetMachine = new MachineSystem().GetDataMachineStatusperCompanyPlantSectionLine(3100,3110,"A","");
DataTable tabelMachine= new DataTable();
tabelMachine = dataSetMachine.Tables[0];
foreach (DataRow drMachine in tabelMachine.Rows)
{
string machineId = drMachine["MachineId"].ToString();
string status = drMachine["Status"].ToString();
int sts = Convert.ToInt32(status);
DataGridViewCell cell = repeaterMachineDasboard.Rows[e.RowIndex].Cells[e.ColumnIndex];
if ((string)cell.Value == machineId && sts == 4) // mesin bagus
{
//e.CellStyle.BackColor = Color.Red;
repeaterMachineDasboard.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.LightGreen;
}
else if ((string)cell.Value == machineId && sts == 3) // mesin sedang diperbaiki
{
//e.CellStyle.BackColor = Color.Red;
repeaterMachineDasboard.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Orange;
}
else if ((string)cell.Value == machineId && sts == 2) // mesin baru diketahui rusak
{
//e.CellStyle.BackColor = Color.Red;
repeaterMachineDasboard.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Yellow;
}
else if ((string)cell.Value == machineId && sts == 1) // mesin bermasalah atau rusak
{
//e.CellStyle.BackColor = Color.Red;
repeaterMachineDasboard.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Red;
}
}
No comments:
Post a Comment