Пример #1
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtJustificativa.Text) && (txtJustificativa.TextLength > 14))
     {
         NotaFiscalControler controler = new NotaFiscalControler();
         string retorno = controler.CancelamentoNFe(identNFe.ChaveNFE, identNFe.NumProtocolo, txtJustificativa.Text, parametroNfe);
         if (retorno.Contains("#"))
         {
             string[] retornos = retorno.Split('#');
             retorno = retornos[1];
             identNFe.NumProtocolo = retorno;
             identNFe.IndStatus = "3";
             ServiceClient.GravarStatusNFe(identNFe);
             MessageBox.Show("Cancelado com sucesso Nº protocolo: "+retorno);
             this.Close();
         }
         else
         {
             MessageBox.Show(retorno);
         }
     }
     else
     {
         MessageBox.Show("Justificativa tem que ter no mínimo 15 caracteres!");
     }
 }