Пример #1
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();
        }
Пример #2
0
        private void RecarregarTabela()
        {
            dataGridView1.Rows.Clear();

            using (var servico = new ServicoDeChamadasParaExecutar())
            {
                var listaDeChamadas = servico.ConsulteTodasAsChamadasParaExecutar();

                foreach (var chamada in listaDeChamadas)
                {
                    dataGridView1.Rows.Add(chamada.Key.Id,
                                           chamada.Value.NomeDoCliente,
                                           chamada.Value.Descricao,
                                           chamada.Value.DataDoVencimento);
                }
            }

            dataGridView1.Refresh();
        }
Пример #3
0
        public void CrieNovaChamada(
            EnumTiposDeChamada tipoDeChamada,
            EnumTiposDeCanal tipoDoCanal,
            string canal,
            string identificacaoDoChamador,
            int maximoDeTentativas,
            int tempoEntreTentativas,
            int tempoParaAguardarChamando)
        {
            var idDaChamada = Guid.NewGuid();

            using (var servicoDeChamadasParaExecutar = new ServicoDeChamadasParaExecutar())
            {
                while (servicoDeChamadasParaExecutar.VerifiqueSeChamadaJaEstaNaFilaDeExecucao(idDaChamada))
                {
                    idDaChamada = Guid.NewGuid();
                }
            }

            string stringTipoDoCanal;

            switch (tipoDoCanal)
            {
            case EnumTiposDeCanal.SIP:
                stringTipoDoCanal = "SIP";
                break;

            default:
                stringTipoDoCanal = "";
                break;
            }

            string stringTipoDeChamada;

            switch (tipoDeChamada)
            {
            case EnumTiposDeChamada.COMUM:
                stringTipoDeChamada = "Comum";
                break;

            case EnumTiposDeChamada.AVISO_DE_BOLETO_A_VENCER:
                stringTipoDeChamada = "AvisoDeBoleto";
                break;

            case EnumTiposDeChamada.PESQUISA_DE_SATISFACAO:
                stringTipoDeChamada = "PesquisaDeSatisfacao";
                break;

            default:
                stringTipoDeChamada = "Comum";
                break;
            }

            var chamada =
                new Chamada()
            {
                Id                        = idDaChamada,
                Canal                     = $"{stringTipoDoCanal}/{canal}",
                IdDoChamador              = identificacaoDoChamador,
                MaximoDeTentativas        = maximoDeTentativas,
                TempoEntreTentativas      = tempoEntreTentativas,
                TempoParaAguardarChamando = tempoParaAguardarChamando,
                Contexto                  = stringTipoDeChamada,
                Extensao                  = "s"
            };

            //Gravar o id na tabela de chamadas pra executar
            //esse gravar do banco, tem que ter retorno com sucesso antes de colocar o arquivo no diretorio

            CrieArquivoDeChamadaNoDiretorio(chamada);
        }