示例#1
0
        private void VerificaSituacaodoArquivo(string NumeroNota, int CUPOMELETRONICOID)
        {
            try
            {
                Application.DoEvents();
                this.Text = "Aguarde.. processando...";

                string arquivo = BmsSoftware.ConfigNFCe.Default.LocalInstalacaoNewSystems + @"\Processados\NFCe_" + NumeroNota + ".txt";

                //100 Autorizado o uso da NF-e
                //101 Cancelamento de NF-e homologado
                //102 Inutilização de número homologado
                //103 Lote recebido com sucesso
                //104 Lote processado
                //105 Lote em processamento
                //106 Lote não localizado
                //107 Serviço em Operação
                //108 Serviço Paralisado Momentaneamente (curto prazo)
                //109 Serviço Paralisado sem Previsão
                //110 Uso Denegado
                //111 Consulta cadastro com uma ocorrência
                //112 Consulta cadastro com mais de uma ocorrência

                //usando a instrução using os recursos são liberados após a conclusão da operação

                if (File.Exists(arquivo))
                {
                    using (StreamReader sr = new StreamReader(arquivo))
                    {
                        String linha;
                        // Lê linha por linha até o final do arquivo
                        while ((linha = sr.ReadLine()) != null)
                        {
                            if (linha.IndexOf("|100|") != -1)//Autorizado
                            {
                                CUPOMELETRONICOEntity CUPOMELETRONICOTy_2 = new CUPOMELETRONICOEntity();
                                CUPOMELETRONICOTy_2 = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);
                                CUPOMELETRONICOTy_2.IDSTATUSNFCE = 1;//Enviado
                                CUPOMELETRONICOTy_2.PROTOCOLO    = linha.Substring(3, 15);
                                CUPOMELETRONICOP.Save(CUPOMELETRONICOTy_2);
                            }
                        }
                    }
                }
                else
                {
                    Application.DoEvents();
                    this.Text = "Fechar Venda";
                }
            }
            catch (Exception ex)
            {
                Application.DoEvents();
                this.Text = "Fechar Venda";

                MessageBox.Show("Erro técnico: " + ex.Message);
            };
        }
示例#2
0
 private void Grava()
 {
     try
     {
         if (Validacoes())
         {
             _CUPOMELETRONICOID = CUPOMELETRONICOP.Save(Entity);
             GravaProduto();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ConfigMessage.Default.MsgSaveErro);
         MessageBox.Show("Erro técnico: " + ex.Message);
     }
 }
示例#3
0
 private void btnLimpaPesquisa_Click(object sender, EventArgs e)
 {
     try
     {
         CUPOMELETRONICOTy.IDSTATUSNFCE = Convert.ToInt32(cbStatus.SelectedValue);
         CUPOMELETRONICOTy.CHAVEACESSO  = txtChave.Text;
         CUPOMELETRONICOTy.PROTOCOLO    = txtProtocolo.Text;
         CUPOMELETRONICOP.Save(CUPOMELETRONICOTy);
         MessageBox.Show(ConfigMessage.Default.MsgSave);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro técnico: " + ex.Message);
     }
 }
示例#4
0
        private void VerificaArquivoContingencia(string NumeroNota, int CUPOMELETRONICOID)
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                string arquivo = BmsSoftware.ConfigNFCe.Default.LocalInstalacaoNewSystems + @"\Processados\nsConcluido\contingencia_ret.txt";

                Application.DoEvents();
                this.Text = "Aguarde.. processando...";

                //100 Autorizado o uso da NF-e
                //101 Cancelamento de NF-e homologado
                //102 Inutilização de número homologado
                //103 Lote recebido com sucesso
                //104 Lote processado
                //105 Lote em processamento
                //106 Lote não localizado
                //107 Serviço em Operação
                //108 Serviço Paralisado Momentaneamente (curto prazo)
                //109 Serviço Paralisado sem Previsão
                //110 Uso Denegado
                //111 Consulta cadastro com uma ocorrência
                //112 Consulta cadastro com mais de uma ocorrência

                //usando a instrução using os recursos são liberados após a conclusão da operação

                if (File.Exists(arquivo))
                {
                    CUPOMELETRONICOEntity CUPOMELETRONICOTy_2 = new CUPOMELETRONICOEntity();
                    CUPOMELETRONICOTy_2 = CUPOMELETRONICOP.Read(CUPOMELETRONICOID);

                    using (StreamReader sr = new StreamReader(arquivo))
                    {
                        String linha;
                        // Lê linha por linha até o final do arquivo
                        while ((linha = sr.ReadLine()) != null)
                        {
                            if (Util.RetiraLetras(CUPOMELETRONICOTy_2.CHAVEACESSO) != string.Empty)
                            {
                                if (linha.IndexOf(Util.RetiraLetras(CUPOMELETRONICOTy_2.CHAVEACESSO)) != -1) //Chave de acesso na linha
                                {
                                    if (linha.IndexOf("Autorizado") != -1)                                   //Autorizado
                                    {
                                        CUPOMELETRONICOTy_2.IDSTATUSNFCE = 1;                                //Enviado
                                        CUPOMELETRONICOTy_2.PROTOCOLO    = Util.RetiraLetras(linha.Substring(3, 16));
                                        CUPOMELETRONICOP.Save(CUPOMELETRONICOTy_2);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Application.DoEvents();
                }

                this.Cursor = Cursors.Default;
                this.Text   = "  IMEX Sistemas - NFCe Nota Fiscal de Consumidor Eletrônica";
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                this.Text   = "  IMEX Sistemas - NFCe Nota Fiscal de Consumidor Eletrônica";
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }