private void gridView_RowCellStyle(object sender, RowCellStyleEventArgs e) { GridView currentView = sender as GridView; if (e.Column.FieldName == nameof(parentModel.InStockCategory)) { Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.InStockCategory)).ToString(), out RequestCategoriesEnum requestCategories); RenderCommonHelper.SetCategoryColor(requestCategories, e); } }
private void gridView_RowCellStyle(object sender, RowCellStyleEventArgs e) { GridView currentView = sender as GridView; if (e.Column.FieldName == nameof(parentModel.Status)) { Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.Status)).ToString(), out ProcessStatusEnum processStatus); RenderCommonHelper.SetStatusColor(processStatus, e); } if (e.Column.FieldName == nameof(parentModel.RequestCategory)) { Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.RequestCategory)).ToString(), out RequestCategoriesEnum requestCategories); RenderCommonHelper.SetCategoryColor(requestCategories, e); } if (e.Column.FieldName == nameof(parentModel.CompletePercentage)) { decimal CompletePercentage = (decimal)currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.CompletePercentage)); if (CompletePercentage == 1) { e.Appearance.BackColor = Color.LawnGreen; } else { e.Appearance.BackColor = Color.DarkOrange; } } if (e.Column.FieldName == nameof(parentModel.LockStatus)) { Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.LockStatus)).ToString(), out LockStatusEnum lockStatus); if (lockStatus == LockStatusEnum.已准备) { e.Appearance.BackColor = Color.LightGreen; } else { e.Appearance.BackColor = Color.LightYellow; } } }