コード例 #1
0
        public Alertas.Lib.Mensagens.CadastrarAlertaResponse CadastrarAlerta(Alertas.Lib.Mensagens.CadastrarAlertaRequest request)
        {
            logger.Debug("Executando Cadastrar Alerta - IdCliente=[" + request.Alerta.IdCliente + "] " +
                         "Instrumento=[" + request.Alerta.Instrumento + "] " +
                         "TipoOperador=[" + (int)request.Alerta.TipoOperador + "] " +
                         "TipoOperando=[" + (int)request.Alerta.TipoOperando + "] " +
                         "Valor=[" + request.Alerta.Valor + "] "
                         );

            CadastrarAlertaResponse resp = new CadastrarAlertaResponse();

            try
            {
                IServicoAlertas servico = Ativador.GetByAddr <IServicoAlertas>(urlalertas);

                resp = servico.CadastrarAlerta(request);

                logger.Debug("Executando Cadastrar Alerta - IdCliente=[" + request.Alerta.IdCliente + "] alerta cadastrado");
            }
            catch (Exception ex)
            {
                logger.Error("Erro CadastrarAlerta(): " + ex.Message, ex);

                resp.StatusResposta = Library.MensagemResponseStatusEnum.ErroPrograma;
                resp.DescricaoErro  = ex.Message;
            }

            return(resp);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: radtek/Gradual
        private void btnMarcarExibida_Click(object sender, EventArgs e)
        {
            if (txtIdAlertaMarcar.Text.Length == 0)
            {
                return;
            }

            if (txtIdClienteMarcar.Text.Length == 0)
            {
                return;
            }

            MarcarComoExibidoRequest request = new MarcarComoExibidoRequest();

            request.IdCliente = txtIdClienteMarcar.Text;
            List <String> listaAlertas = new List <String>();

            listaAlertas.Add(txtIdAlertaMarcar.Text);
            request.listaIdAlerta = listaAlertas;

            IServicoAlertas servicoAlerta = Ativador.Get <IServicoAlertas>();

            MarcarComoExibidoResponse response = servicoAlerta.MarcarComoExibido(request);

            MessageBox.Show("Ação executada.", "Marcar como exibida",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: radtek/Gradual
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            IServicoAlertas servicoAlerta = Ativador.Get <IServicoAlertas>();

            AlertaInfo alerta = new AlertaInfo();

            alerta.IdAlerta    = "0";
            alerta.IdCliente   = txtIdCliente.Text;
            alerta.Instrumento = txtInstrumento.Text;

            if (radbtnPreco.Checked)
            {
                alerta.TipoOperando = Operando.Preco;
            }
            else if (radbtnOscilacao.Checked)
            {
                alerta.TipoOperando = Operando.Oscilacao;
            }
            else if (radbtnMaximo.Checked)
            {
                alerta.TipoOperando = Operando.Maximo;
            }
            else if (radbtnMinimo.Checked)
            {
                alerta.TipoOperando = Operando.Minimo;
            }

            if (radbtnMenorIgual.Checked)
            {
                alerta.TipoOperador = Operador.MenorIgual;
            }
            else if (radbtnMaiorIgual.Checked)
            {
                alerta.TipoOperador = Operador.MaiorIgual;
            }
            else if (radbtnAlcancado.Checked)
            {
                alerta.TipoOperador = Operador.Atingido;
            }

            alerta.Valor = Convert.ToDecimal(txtValor.Text);

            CadastrarAlertaRequest reqCadastrarAlerta = new CadastrarAlertaRequest();

            reqCadastrarAlerta.Alerta = alerta;

            CadastrarAlertaResponse respCadastrarAlerta = servicoAlerta.CadastrarAlerta(reqCadastrarAlerta);

            if (respCadastrarAlerta.StatusResposta == Gradual.OMS.Library.MensagemResponseStatusEnum.OK)
            {
                txtIdAlerta.Text = respCadastrarAlerta.IdAlerta;
            }
            else
            {
                txtIdAlerta.Text = "Cadastro Não OK. Desc=[" + respCadastrarAlerta.DescricaoErro + "]";
            }
            disableNewAlertaTxts();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: radtek/Gradual
        private void btnVerificar_Click(object sender, EventArgs e)
        {
            if (txtIdClienteVerificar.Text.Length == 0)
            {
                return;
            }

            btnVerificar.Enabled = false;
            lstboxVerificar.Items.Clear();
            lstboxVerificar.Refresh();

            VerificarAlertasRequest request = new VerificarAlertasRequest();

            request.IdCliente = txtIdClienteVerificar.Text;

            IServicoAlertas servicoAlerta = Ativador.Get <IServicoAlertas>();

            VerificarAlertasResponse response = servicoAlerta.VerificarAlertas(request);

            if (response.StatusResposta == Gradual.OMS.Library.MensagemResponseStatusEnum.OK)
            {
                if (response.Alertas.Count == 0)
                {
                    lstboxVerificar.Items.Add("Não há alertas cadastrados para o Cliente [" + request.IdCliente + "]");
                    lstboxVerificar.Refresh();
                }
                else
                {
                    foreach (AlertaInfo alerta in response.Alertas)
                    {
                        StringBuilder info = new StringBuilder();
                        info.Append("IdAlerta=[" + alerta.IdAlerta + "]");
                        info.Append(" Instrumento=[" + alerta.Instrumento + "]");
                        info.Append(" TipoOperador=[" + alerta.TipoOperador + "]");
                        info.Append(" TipoOperando=[" + alerta.TipoOperando + "]");
                        info.Append(" Valor=[" + alerta.Valor + "]");
                        info.Append(" DataCadastro=[" + alerta.DataCadastro + "]");
                        info.Append(" Atingido=[" + (alerta.Atingido ? "Sim" : "Não") + "]");
                        info.Append(" Exibido=[" + (alerta.Exibido ? "Sim" : "Não") + "]");
                        info.Append(" Cotação=[" + alerta.Cotacao + "]");

                        lstboxVerificar.Items.Add(info.ToString());
                    }
                }

                btnVerificar.Enabled = true;
            }
        }
コード例 #5
0
        public Alertas.Lib.Mensagens.MarcarComoExibidoResponse MarcarComoExibido(Alertas.Lib.Mensagens.MarcarComoExibidoRequest request)
        {
            logger.Debug("MarcarComoExibido: IdCliente = [" + request.IdCliente + "]");

            MarcarComoExibidoResponse response = new MarcarComoExibidoResponse();

            try
            {
                IServicoAlertas servico = Ativador.GetByAddr <IServicoAlertas>(urlalertas);

                response = servico.MarcarComoExibido(request);
            }
            catch (Exception ex)
            {
                logger.Error("Erro MarcarComoExibido(): " + ex.Message, ex);
                response.StatusResposta    = Library.MensagemResponseStatusEnum.ErroPrograma;
                response.DescricaoResposta = ex.Message;
            }

            return(response);
        }
コード例 #6
0
        public Alertas.Lib.Mensagens.ExcluirAlertaResponse ExcluirAlerta(Alertas.Lib.Mensagens.ExcluirAlertaRequest request)
        {
            logger.Debug("Excluir Alerta: IdCliente=[" + request.IdCliente + "] IdAlerta=[" + request.IdAlerta + "]");

            ExcluirAlertaResponse response = new ExcluirAlertaResponse();

            try
            {
                IServicoAlertas servico = Ativador.GetByAddr <IServicoAlertas>(urlalertas);
                response = servico.ExcluirAlerta(request);
                logger.Debug("Excluir Alerta: IdCliente=[" + request.IdCliente + "] IdAlerta=[" + request.IdAlerta + "] excluido");
            }
            catch (Exception ex)
            {
                logger.Error("Erro ExcluirAlerta(): " + ex.Message, ex);
                response.StatusResposta    = Library.MensagemResponseStatusEnum.ErroPrograma;
                response.DescricaoResposta = ex.Message;
            }

            return(response);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: radtek/Gradual
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            if (txtIdAlertaExcluir.Text.Length == 0)
            {
                return;
            }

            if (txtIdClienteExcluir.Text.Length == 0)
            {
                return;
            }

            ExcluirAlertaRequest request = new ExcluirAlertaRequest();

            request.IdAlerta  = txtIdAlertaExcluir.Text;
            request.IdCliente = txtIdClienteExcluir.Text;

            IServicoAlertas servicoAlerta = Ativador.Get <IServicoAlertas>();

            ExcluirAlertaResponse response = servicoAlerta.ExcluirAlerta(request);

            MessageBox.Show("Exclusão executada.", "Exclusão",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }