private ModelShow.Tile generateDefaultInfo(Tile tile, ModelShow.Tile tileshow) { tileshow.tileId = tile.tileId; tileshow.show = tile.show; tileshow.tileHeight = tile.tileHeight; tileshow.tileWidth = tile.tileWidth; tileshow.color = tile.fixedColor; tileshow.detailsLink = tile.detailsLink; tileshow.detailsLinkStyle = tile.detailsLinkStyle; tileshow.dynamicTable = tile.dynamicTable; tileshow.textProperties = new ModelShow.TextProperties(); tileshow.border = new ModelShow.Border(); tileshow.area = tile.area; if (tile.textProperties != null) { tileshow.textProperties.bold = tile.textProperties.bold; tileshow.textProperties.italic = tile.textProperties.italic; tileshow.textProperties.rotate = tile.textProperties.rotate; tileshow.textProperties.fontSize = tile.textProperties.fontSize; tileshow.textProperties.fontColor = tile.textProperties.fontColor; } else { } if (tile.border != null) { tileshow.border.color = tile.border.color; tileshow.border.style = tile.border.style; tileshow.border.witdh = tile.border.witdh; } return(tileshow); }
public async Task <ModelShow.Tile> process(Tile tile, string dashboardID, bool PararellProcessTiles, bool PararellProcessGrid) { ModelShow.Tile tileshow = new ModelShow.Tile(); tileshow = generateDefaultInfo(tile, tileshow); try { tileshow.tileType = tile.tileType; if (tile.tileType == "tile") { tileshow = await processTile(tile, tileshow, dashboardID, PararellProcessTiles); } else if (tile.tileType == "image") { tileshow.value = null; tileshow.image = tile.imageSource; } else if (tile.tileType == "grid") { ProcessGrid procGrid = new ProcessGrid(server, errorColor); tileshow = await procGrid.generateGrid(tile, tileshow, dashboardID, PararellProcessTiles, PararellProcessGrid); } else { tileshow.color = tile.fixedColor; tileshow.value = tile.fixedValueCommon + " " + tile.fixedValueUnique; } return(tileshow); } catch (Exception ex) { tileshow.show = tile.show; tileshow.tileHeight = tile.tileHeight; tileshow.tileWidth = tile.tileWidth; tileshow.color = errorColor; tileshow.value = ex.ToString(); Logger.Error(ex.ToString()); return(tileshow); } }
private async Task <ModelShow.Tile> processTile(Tile tile, ModelShow.Tile tileshow, string dashboardid, bool PararellProcessTiles) { tileshow.color = tile.fixedColor; if (tile.fixedValueCommon != null) { tileshow.value = tile.fixedValueCommon + " "; } if (tile.fixedValueUnique != null) { tileshow.value = tile.fixedValueUnique; } if (tile.colorSource != null) { GetTileColor processColor = new GetTileColor(server, errorColor); tileshow.color = await processColor.getTileColor(tile, PararellProcessTiles); if (tile.colorSource.fontColorPath != null) { GetTileFontColor processFontColor = new GetTileFontColor(server, errorColor); var resultColor = await processFontColor.getTileFontColor(tile, PararellProcessTiles); if (resultColor == null) { tileshow.textProperties.fontColor = errorColor; } else { tileshow.textProperties.fontColor = resultColor; } } } else { tileshow.color = tile.fixedColor; } if (tile.dataSource != null) { GetTileValue processValue = new GetTileValue(server); tileshow.value = await processValue.getTileValue(tile, dashboardid, PararellProcessTiles); } else { tileshow.value = ""; if (tile.fixedValueCommon != null) { tileshow.value = tile.fixedValueCommon + " "; } if (tile.fixedValueUnique != null) { tileshow.value += tile.fixedValueUnique; } } if (tile.emphasysSource != null) { GetTileEmphasys processEmp = new GetTileEmphasys(server); var resultEmp = await processEmp.getTileEmphasys(tile, PararellProcessTiles); if (resultEmp == null) { tileshow.value = "ErroEmp"; } else { tileshow.emphasys = (bool)resultEmp; } } else { tileshow.emphasys = false; } if (tile.rail != null) { tileshow.rail = tile.rail; } return(tileshow); }
public async Task <ModelShow.Tile> generateGrid(Tile tile, ModelShow.Tile tileshow, string dashboardID, bool PararellProcessTiles, bool PararellProcessGrid) { try { if (dashboardID == "285") { Console.Write(""); } ModelShow.gridValue gValue = new ModelShow.gridValue(); gValue.headers = new List <ModelShow.Header>(); tileshow.rowQuantity = tile.rowQuantity; if (tile.gridHeaders != null) { foreach (var item in tile.gridHeaders) { ModelShow.Header header = new ModelShow.Header(); header.backgroundColor = item.backgroundColor; header.headerContent = item.headerContent; if (item.textProperties != null) { header.textProperties = new ModelShow.TextProperties(); header.textProperties.bold = item.textProperties.bold; header.textProperties.fontColor = item.textProperties.fontColor; header.textProperties.fontSize = item.textProperties.fontSize; header.textProperties.italic = item.textProperties.italic; header.textProperties.rotate = item.textProperties.rotate; } //----------------------------------CICERO------------------------------------------- header.width = item.width; //------------------------------------------------------------------------------------- gValue.headers.Add(header); } } GetTileGrid proceesGrid = new GetTileGrid(server); var gridValues = await proceesGrid.getGridValues(tile, dashboardID, PararellProcessGrid); if (gridValues == null) { gValue.gridCount = 0; } else { gValue.gridCount = gridValues.Count(); } gValue.rows = new List <ModelShow.Row>(); if (gridValues == null) { for (int i = 0; i < tile.rowQuantity + 1; i++) { ModelShow.Row error = new ModelShow.Row(); error.backgroundColor = errorColor; error.rowContent = new List <string>(); error.rowContent.Add("Error"); error.textProperties = new ModelShow.TextProperties(); if (tile.gridRow.textProperties != null) { error.textProperties.bold = tile.gridRow.textProperties.bold; error.textProperties.fontColor = tile.gridRow.textProperties.fontColor; error.textProperties.fontSize = tile.gridRow.textProperties.fontSize; error.textProperties.italic = tile.gridRow.textProperties.italic; error.textProperties.rotate = tile.gridRow.textProperties.rotate; } gValue.rows.Add(error); } } else { int?remainder = 0; int size = 0; if (tile.dynamicTable == null) { tile.dynamicTable = false; } if (tile.dynamicTable == true) { size = gridValues.Count; if (size > tileshow.rowQuantity) { remainder = size % tileshow.rowQuantity; if (remainder != null && remainder != 0) { size = size + ((int)tileshow.rowQuantity - (int)remainder); } } else { size = (int)tileshow.rowQuantity; } } else { size = (int)tile.rowQuantity; } if (dashboardID == "270") { Console.Write(""); } for (int i = 0; i < size; i++) { ModelShow.Row row = new ModelShow.Row(); if (i >= gridValues.Count) { row.rowContent = new List <string>(); } //----------------------------------CICERO------------------------------------------- else { row.rowContent = gridValues[i].Select(x => x == "" ? "-" : x).ToList(); } //------------------------------------------------------------------------------------- row.textProperties = new ModelShow.TextProperties(); if (tile.gridRow != null && tile.gridRow.textProperties != null) { row.textProperties.bold = tile.gridRow.textProperties.bold; row.textProperties.fontColor = tile.gridRow.textProperties.fontColor; row.textProperties.fontSize = tile.gridRow.textProperties.fontSize; row.textProperties.italic = tile.gridRow.textProperties.italic; row.textProperties.rotate = tile.gridRow.textProperties.rotate; } gValue.rows.Add(row); } } string color = "#ffffff"; string fontColor = "#000000"; if (tile.gridRow != null) { if (tile.gridRow.backgroundColor == null) { tile.gridRow.backgroundColor = "#ffffff"; } if (tile.gridRow.textProperties.fontColor == null) { tile.gridRow.textProperties.fontColor = "#000000"; } color = tile.gridRow.backgroundColor; fontColor = tile.gridRow.textProperties.fontColor; } if (tile.colorSource != null) { GetTileColor processColor = new GetTileColor(server, errorColor); color = await processColor.getTileColor(tile, PararellProcessTiles); if (tile.colorSource.fontColorPath != null) { GetTileFontColor processFontColor = new GetTileFontColor(server, errorColor); var resultColor = await processFontColor.getTileFontColor(tile, PararellProcessTiles); if (resultColor == null) { fontColor = errorColor; } else { fontColor = resultColor; } } } foreach (var row in gValue.rows) { row.backgroundColor = color; row.textProperties.fontColor = fontColor; } tileshow.value = gValue; return(tileshow); } catch (Exception ex) { Logger.Error(dashboardID); Logger.Error(ex.ToString()); return(null); } }