コード例 #1
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;
            }
        }