Reorganização de código e ajustes em exibição de dados

- Adicionada diretiva `#if DEBUG` para definir `_windowsID` como
  `"gestao1.3"` no modo de depuração; produção mantém `Environment.UserName`.
- Reorganizada a classe `Record` para uma nova posição no arquivo.
- Ajustada exibição do cabeçalho no método `ExibirCabecalho` com
  espaçamento adicional no título.
- Reorganizada lógica no método `AtualizarDados` para exibir painéis
  após limpar a tela e exibir o cabeçalho.
- Adicionada mensagem ao final de `AtualizarDados` para instruções
  ao usuário sobre atualização ou saída.
This commit is contained in:
Giuliano Paschoalino 2025-07-21 17:55:39 -03:00
parent 5e5618dd6d
commit 1832989012

View File

@ -9,8 +9,11 @@ class Program
static bool _stop = false;
static bool _isAuthenticated = false;
static readonly string _connectionString = "Server=192.168.10.248;Port=5432;Database=pipefy_move_cards;User Id=postgres;Password=gds21;";
#if DEBUG
static readonly string _windowsID = "gestao1.3";
#else
static readonly string _windowsID = Environment.UserName;
//static readonly string _windowsID = "comercial6";
#endif
static readonly List<(string actionId, string actionName)> _actionIds = // Tuplas de IDs e nomes das fases que queremos monitorar
[
new ("318642783-318906957", "Agendou reunião 1"),
@ -71,28 +74,9 @@ class Program
AnsiConsole.MarkupLine("[bold yellow]Aplicação encerrada.[/]");
}
public class Record
{
public int? Id { get; set; }
public string? Action { get; set; }
public string? User { get; set; }
public string? FieldID { get; set; }
public int? From { get; set; }
public int? To { get; set; }
public int? CardID { get; set; }
public string? PipeSUID { get; set; }
public DateTime MovedAt { get; set; }
public required string Title { get; set; }
public string? AcaoID { get; set; }
public required string Acao { get; set; }
}
static void AtualizarDados()
{
var records = new List<Record>();
AnsiConsole.Clear();
ExibirCabecalho();
var tableContLigacoes = CriarTabelaLigacoes();
var tableContReunioes = CriarTabelaReunioes();
@ -110,9 +94,6 @@ class Program
records.AddRange(userRecords);
}
ExibirPainel(tableContLigacoes, "[blue bold] Ligações [/]");
ExibirPainel(tableContReunioes, "[blue bold] Reuniões Agendadas e Realizadas [/]");
var tableReunioes = CriarTabelaDetalhesReunioes();
foreach (var record in records.OrderBy(x => x.User).ThenBy(x => x.Acao).ThenBy(x => x.MovedAt.Date))
{
@ -128,6 +109,12 @@ class Program
}
}
AnsiConsole.Clear();
AnsiConsole.MarkupLine("\n[gray]Pressione [green]ENTER[/] para atualizar agora ou qualquer outra tecla para sair.[/]");
ExibirCabecalho();
ExibirPainel(tableContLigacoes, "[blue bold] Ligações [/]");
ExibirPainel(tableContReunioes, "[blue bold] Reuniões Agendadas e Realizadas [/]");
ExibirPainel(tableReunioes, "[blue bold] Reuniões no Mês [/]");
AnsiConsole.MarkupLine("\n[gray]Pressione [green]ENTER[/] para atualizar agora ou qualquer outra tecla para sair.[/]");
@ -138,7 +125,7 @@ class Program
var status = new Align(new Panel($"[bold]WindowsID[/]: {_windowsID} | [bold]Usuários encontrados[/]: {_pipeUsers.Count}"), HorizontalAlignment.Center, VerticalAlignment.Top);
var header = new Panel(status)
.Header("[yellow]Resumo Diário por Usuário[/]", Justify.Center)
.Header("[yellow] Resumo Diário por Usuário [/]", Justify.Center)
.Expand();
AnsiConsole.Write(new Align(header, HorizontalAlignment.Center, VerticalAlignment.Top));
@ -339,6 +326,21 @@ class Program
}
});
}
public class Record
{
public int? Id { get; set; }
public string? Action { get; set; }
public string? User { get; set; }
public string? FieldID { get; set; }
public int? From { get; set; }
public int? To { get; set; }
public int? CardID { get; set; }
public string? PipeSUID { get; set; }
public DateTime MovedAt { get; set; }
public required string Title { get; set; }
public string? AcaoID { get; set; }
public required string Acao { get; set; }
}
#region Helpers