コード例 #1
0
        private void GerarConsulta(int emp, TipoAplicativo servico, int tpEmis, int cUF, int amb, string versao, List <ConsultaRealizada> consultasRealizadas)
        {
            GerarXML oGerar = new GerarXML(emp);

            string XmlNfeDadosMsg = Empresas.Configuracoes[emp].PastaXmlEnvio + "\\" + oGerar.StatusServico(servico, tpEmis, cUF, amb, versao);

            consultasRealizadas.Add(new ConsultaRealizada
            {
                ArquivoRetorno = XmlNfeDadosMsg,
                Empresa        = Empresas.Configuracoes[emp],
                Emp            = emp,
                Servico        = servico
            });

            Thread.Sleep(1000);
        }
コード例 #2
0
        private void buttonPesquisa_Click(object sender, EventArgs e)
        {
            this.textResultado.Clear();
            this.Refresh();

            try
            {
                TipoAplicativo servico = (TipoAplicativo)cbServico.SelectedValue;
                TipoEmissao    tpEmis  = (TipoEmissao)this.cbEmissao.SelectedValue;

                switch (servico)
                {
                case TipoAplicativo.Cte:
                    if (tpEmis == TipoEmissao.teSVCAN)    // this.cbEmissao.SelectedIndex == 4)
                    {
                        throw new Exception("CT-e não dispõe do tipo de contingência SVCAN.");
                    }
                    break;

                case TipoAplicativo.Nfe:
                    if (tpEmis == TipoEmissao.teSVCSP)    // this.cbEmissao.SelectedIndex == 3)
                    {
                        throw new Exception("NF-e não dispõe do tipo de contingência SCVSP.");
                    }
                    break;

                case TipoAplicativo.MDFe:
                    if (tpEmis != TipoEmissao.teNormal)
                    {
                        throw new Exception("MDF-e só dispõe do tipo de emissão Normal.");
                    }
                    break;

                case TipoAplicativo.NFCe:
                    if (tpEmis != TipoEmissao.teNormal)
                    {
                        throw new Exception("NFC-e só dispõe do tipo de emissão Normal.");
                    }
                    break;
                }

                this.textResultado.Text = "Consultando o servidor. Aguarde....";
                this.textResultado.Update();

                GerarXML oGerar = new GerarXML(Emp);

                int    cUF    = NFe.Components.Functions.UFParaCodigo(this.comboUf.SelectedValue.ToString());
                int    amb    = (int)cbAmbiente.SelectedValue;
                string versao = this.cbVersao.SelectedItem.ToString();

                NFe.UI.Formularios.Wait.Show("Consulta a situação do serviço...");

                string XmlNfeDadosMsg = Empresas.Configuracoes[Emp].PastaXmlEnvio + "\\" +
                                        oGerar.StatusServico(servico, (int)tpEmis, cUF, amb, versao);

                //Demonstrar o status do serviço
                this.textResultado.Text = VerStatusServico(XmlNfeDadosMsg);
            }
            catch (Exception ex)
            {
                NFe.UI.Formularios.Wait.Close();
                this.textResultado.Text = ex.Message;
            }
        }
コード例 #3
0
        private void buttonStatusServidor_Click(object sender, EventArgs e)
        {
            this.textResultado.Text = "";
            this.Refresh();

            TipoEmissao    tpEmis  = (TipoEmissao)Enum.Parse(typeof(TipoEmissao), Enum.GetName(typeof(TipoEmissao), ((ComboElem)(new System.Collections.ArrayList(arrTpEmis))[cbEmissao.SelectedIndex]).Codigo));
            TipoAplicativo servico = (TipoAplicativo)cbServico.SelectedIndex;

            if (servico == TipoAplicativo.Cte)
            {
                if (tpEmis == TipoEmissao.teSVCAN)
                {
                    MessageBox.Show("CT-e não dispõe do tipo de contingência SVCAN.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            else if (servico == TipoAplicativo.Nfe)
            {
                if (tpEmis == TipoEmissao.teSVCSP)
                {
                    MessageBox.Show("NF-e não dispõe do tipo de contingência SCVSP.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            else if (servico == TipoAplicativo.MDFe)
            {
                if (tpEmis != TipoEmissao.teNormal)
                {
                    MessageBox.Show("MDF-e só dispõe do tipo de emissão Normal.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            else if (servico == TipoAplicativo.NFCe)
            {
                if (tpEmis != TipoEmissao.teNormal)
                {
                    MessageBox.Show("NFC-e só dispõe do tipo de emissão Normal.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            this.toolStripStatusLabel1.Text = _wait;
            this.Refresh();

            this.Cursor = Cursors.WaitCursor;
            try
            {
                GerarXML oGerar = new GerarXML(Emp);

                int cUF = ((ComboElem)(new System.Collections.ArrayList(arrUF))[comboUf.SelectedIndex]).Codigo;
                int amb = ((ComboElem)(new System.Collections.ArrayList(arrAmb))[cbAmbiente.SelectedIndex]).Codigo;

                string XmlNfeDadosMsg = Empresas.Configuracoes[Emp].PastaXmlEnvio + "\\" + oGerar.StatusServico(servico, (int)tpEmis, cUF, amb, this.cbVersao.SelectedItem.ToString());

                //Demonstrar o status do serviço
                this.textResultado.Text = VerStatusServico(XmlNfeDadosMsg);
            }
            catch (Exception ex)
            {
                this.textResultado.Text = ex.Message;
            }
            finally
            {
                this.Cursor = Cursors.Default;
                this.toolStripStatusLabel1.Text = "";
            }
        }
コード例 #4
0
        private void buttonStatusServidor_Click(object sender, EventArgs e)
        {
            this.toolStripStatusLabel1.Text = _wait;
            this.textResultado.Text         = "";
            this.Refresh();

            this.Cursor = Cursors.WaitCursor;
            try
            {
                GerarXML oGerar = new GerarXML(Emp);
                Auxiliar oAux   = new Auxiliar();

                int cUF = ((ComboElem)(new System.Collections.ArrayList(arrUF))[comboUf.SelectedIndex]).Codigo;
                int amb = ((ComboElem)(new System.Collections.ArrayList(arrAmb))[cbAmbiente.SelectedIndex]).Codigo;

                string XmlNfeDadosMsg = Empresa.Configuracoes[Emp].PastaEnvio + "\\" + oGerar.StatusServico(this.cbEmissao.SelectedIndex + 1, cUF, amb);

                //Demonstrar o status do serviço
                this.textResultado.Text = VerStatusServico(XmlNfeDadosMsg);
            }
            catch (Exception ex)
            {
                this.textResultado.Text = ex.Message;
            }
            finally
            {
                this.Cursor = Cursors.Default;
                this.toolStripStatusLabel1.Text = "";
            }
        }
コード例 #5
0
ファイル: userPedidoSituacao.cs プロジェクト: akretion/uninfe
        private void buttonPesquisa_Click(object sender, EventArgs e)
        {
            this.textResultado.Clear();
            this.Refresh();

            try
            {
                TipoAplicativo servico = (TipoAplicativo)cbServico.SelectedValue;
                TipoEmissao tpEmis = (TipoEmissao)this.cbEmissao.SelectedValue;

                switch (servico)
                {
                    case TipoAplicativo.Cte:
                        if (tpEmis == TipoEmissao.teSVCAN)// this.cbEmissao.SelectedIndex == 4)
                            throw new Exception("CT-e não dispõe do tipo de contingência SVCAN.");
                        break;

                    case TipoAplicativo.Nfe:
                        if (tpEmis == TipoEmissao.teSVCSP)// this.cbEmissao.SelectedIndex == 3)
                            throw new Exception("NF-e não dispõe do tipo de contingência SCVSP.");
                        break;

                    case TipoAplicativo.MDFe:
                        if (tpEmis != TipoEmissao.teNormal)
                            throw new Exception("MDF-e só dispõe do tipo de emissão Normal.");
                        break;

                    case TipoAplicativo.NFCe:
                        if (tpEmis != TipoEmissao.teNormal)
                            throw new Exception("NFC-e só dispõe do tipo de emissão Normal.");
                        break;
                }

                this.textResultado.Text = "Consultando o servidor. Aguarde....";
                this.textResultado.Update();

                GerarXML oGerar = new GerarXML(Emp);

                int cUF = NFe.Components.Functions.UFParaCodigo(this.comboUf.SelectedValue.ToString());
                int amb = (int)cbAmbiente.SelectedValue;
                string versao = this.cbVersao.SelectedItem.ToString();

                NFe.UI.Formularios.Wait.Show("Consulta a situação do serviço...");

                string XmlNfeDadosMsg = Empresas.Configuracoes[Emp].PastaXmlEnvio + "\\" +
                    oGerar.StatusServico(servico, (int)tpEmis, cUF, amb, versao);

                //Demonstrar o status do serviço
                this.textResultado.Text = VerStatusServico(XmlNfeDadosMsg);
            }
            catch (Exception ex)
            {
                NFe.UI.Formularios.Wait.Close();
                this.textResultado.Text = ex.Message;
            }
        }