Exemple #1
0
        public Dictionary <ChamadaParaExecutar, TextoParaBoleto> ConsulteTodasAsChamadasParaExecutar()
        {
            var consultaSQLChamada = $"SELECT {COLUNAS} FROM {TABELA}";

            var dicionarioRetorno = new Dictionary <ChamadaParaExecutar, TextoParaBoleto>();

            using (var bancoDeDados = new GSBancoDeDados())
            {
                var resultado = bancoDeDados.ExecuteConsulta(consultaSQLChamada);
                foreach (DataRow linha in resultado.Rows)
                {
                    var chamada =
                        new ChamadaParaExecutar()
                    {
                        Id = new Guid(linha["ID"].ToString()),
                        NumeroParaLigar = linha["NUMERO"].ToString(),
                        Horario         = (DateTime)linha["HORARIO"]
                    };

                    var consultaSQLTexto = $"SELECT {COLUNAS_TEXTOS} FROM {TABELA_TEXTOS} WHERE ID = '{chamada.Id}';";
                    var resultadoTexto   = bancoDeDados.ExecuteConsulta(consultaSQLTexto);
                    var texto            =
                        new TextoParaBoleto()
                    {
                        NomeDoCliente    = resultadoTexto.Rows[0]["NOME_CLIENTE"].ToString(),
                        Descricao        = resultadoTexto.Rows[0]["DESCRICAO"].ToString(),
                        DataDoVencimento = (DateTime)resultadoTexto.Rows[0]["DATA_VENCIMENTO"]
                    };
                    dicionarioRetorno.Add(chamada, texto);
                }
            }

            return(dicionarioRetorno);
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var textoParaChamadaDeBoleto =
                new TextoParaBoleto()
            {
                NomeDoCliente    = txtNomeDoCliente.Text.Trim(),
                Descricao        = txtDescricao.Text.Trim(),
                DataDoVencimento = dateTimePicker1.Value
            };

            using (var servico = new ServicoDeChamadasParaExecutar())
            {
                servico.InserirNovaChamada(txtNumero.Text.Trim(), textoParaChamadaDeBoleto);
            }

            RecarregarTabela();
        }
Exemple #3
0
        public void InserirNovaChamada(string numeroParaLigar, TextoParaBoleto texto)
        {
            var idDaChamada = Guid.NewGuid();

            var comandoSQLChamada = $"INSERT INTO {TABELA_TEXTOS}({COLUNAS}) " +
                                    $"VALUES ('{idDaChamada}', " +
                                    $"{numeroParaLigar}, " +
                                    $"CAST ('{DateTime.Now}' AS DATETIME);";

            var comandoSQLTexto = $"INSERT INTO {TABELA_TEXTOS}({COLUNAS_TEXTOS}) " +
                                  $"VALUES ('{idDaChamada}', " +
                                  $"'{texto.NomeDoCliente}', " +
                                  $" '{texto.Descricao}', " +
                                  $" '{ConvertaDataParaMesFalado(texto.DataDoVencimento)}');";

            using (var bancoDeDados = new GSBancoDeDados())
            {
                bancoDeDados.ExecuteComando(comandoSQLChamada);
                bancoDeDados.ExecuteComando(comandoSQLTexto);
            }
        }