private BotMessageResults AddResultsTable(DataTable dtClientes)
        {
            BotMessageResults results = new BotMessageResults();

            results.AddDataTableToResultSet(dtClientes);

            results.ViewConfig.Add(new Entities.Results.TableView()
            {
                Order   = 0,
                Columns = new System.Collections.ObjectModel.Collection <Entities.Results.Column>()
                {
                    new Entities.Results.Column()
                    {
                        Name    = "Cliente",
                        Visible = true
                    },
                    new Entities.Results.Column()
                    {
                        Name    = "Nome",
                        Visible = true
                    },
                },
                ResultSet = 0,
                ShowTitle = true,
                Title     = "Clientes"
            });

            return(results);
        }
        private BotMessageResults AddResultsGraphDatatable(DataTable dtResumoVendas)
        {
            BotMessageResults results = new BotMessageResults();

            results.AddDataTableToResultSet(dtResumoVendas);

            results.ViewConfig.Add(new Entities.Results.GraphView()
            {
                Columns = new Collection <Column>()
                {
                    new Column()
                    {
                        Name = "Mês", Visible = true, Axis = "x"
                    },
                    new Column()
                    {
                        Name = "Vendas", Visible = true
                    }
                },

                Order     = 0,
                GraphType = GraphType.Bar,
                ResultSet = 0,
                ShowTitle = true,
                Title     = "Vendas"
            });

            return(results);
        }
        private BotMessageResults AddDebitMessageResults(DataTable dtCustomersWithDebit)
        {
            BotMessageResults results = new BotMessageResults();

            results.AddDataTableToResultSet(dtCustomersWithDebit);

            results.ViewConfig.Add(new Entities.Results.TableView()
            {
                Order   = 0,
                Columns = new System.Collections.ObjectModel.Collection <Entities.Results.Column>()
                {
                    new Entities.Results.Column()
                    {
                        Name    = "Cliente",
                        Visible = true
                    },
                    new Entities.Results.Column()
                    {
                        Name    = "Crédito total",
                        Visible = true
                    },
                },
                ResultSet = 0,
                ShowTitle = true,
                Title     = "Clientes com créditos pendentes."
            });


            foreach (List <Cell> linha in results.ResultSets.First())
            {
                // Add action for the first column (entity, ex: "Sofrio")
                linha[0].Action = new BotMessageAction()
                {
                    ActionIndex      = 0,
                    ActionType       = BotMessageActionType.Drilldown,
                    ActionParameters = string.Concat("GCP|1|GCP_MOSTRAMANUTENCAO|Manutencao=mnuTabClientes|Entidade=", linha[0].Value),
                    Text             = linha[0].Value
                };

                linha[1].Action = new BotMessageAction()
                {
                    ActionIndex      = 1,
                    ActionType       = BotMessageActionType.Drilldown,
                    ActionParameters = "GCP|1|GCP_MOSTRAEXPLORACAO|Exploracao=mnuExpCCPendentesGrelha|TipoEntidade=C|Entidade=" + linha[0].Value,
                    Text             = linha[1].Value
                };
            }

            return(results);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds the results.
        /// </summary>
        /// <param name="companyMessage">The company message.</param>
        /// <param name="resultsDiff">The results difference.</param>
        private void AddResults(BotMessage companyMessage, DataTable resultsDiff)
        {
            var results = new BotMessageResults();

            results.AddDataTableToResultSet(resultsDiff);

            // for each result we'll add the correspondent action
            foreach (List <Cell> line in results.ResultSets[0])
            {
                // Add action for the first column
                line[1].Action = new BotMessageAction()
                {
                    ActionIndex      = 0,
                    ActionType       = BotMessageActionType.Drilldown,
                    ActionParameters = "Parameters.",
                    Text             = line[1].Value
                };
            }

            // Now we need to define how the table is displayed (view config)
            this.AddViewConfig(results);
            companyMessage.Results = results;
        }