public IActionResult BuscarVooAnterior()
        {
            var c = new Cancelamento();

            c.VooCancelado = new Voo();
            return(PartialView("_VooAnterior", c));
        }
Beispiel #2
0
        protected void btnConcluir_Click(object sender, EventArgs e)
        {
            Cancelamento a = new Cancelamento();

            a.preenchimentoCompleto = true;
            update(a);
        }
Beispiel #3
0
        public IRetorno Cancelar(Cancelamento eventoCancelamento, String caminhoXml)
        {
            var tpEvento = "110111";
            var id       = "ID" + tpEvento + eventoCancelamento.NotaChaveAcesso + "01";

            var xmlString = new StringBuilder();

            xmlString.Append("	<evento xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"1.00\">");
            xmlString.Append("		<infEvento Id=\""+ id + "\">");
            xmlString.Append("			<cOrgao>35</cOrgao>");
            xmlString.Append("			<tpAmb>"+ (NFeContexto.Producao ? "1" : "2") + "</tpAmb>");
            xmlString.Append("			<CNPJ>"+ eventoCancelamento.CNPJ + "</CNPJ>");
            xmlString.Append("			<chNFe>"+ eventoCancelamento.NotaChaveAcesso + "</chNFe>");
            xmlString.Append("			<dhEvento>"+ DateTime.Now.ToString("s") + "-03:00" + "</dhEvento>");
            xmlString.Append("			<tpEvento>"+ tpEvento + "</tpEvento>");
            xmlString.Append("			<nSeqEvento>1</nSeqEvento>");
            xmlString.Append("			<verEvento>1.00</verEvento>");
            xmlString.Append("			<detEvento versao=\"1.00\">");
            xmlString.Append("				<descEvento>Cancelamento</descEvento>");
            xmlString.Append("				<nProt>"+ eventoCancelamento.Protocolo + "</nProt>");
            xmlString.Append("				<xJust>"+ eventoCancelamento.Justificativa + "</xJust>");
            xmlString.Append("			</detEvento>");
            xmlString.Append("		</infEvento>");
            xmlString.Append("	</evento>");

            var arquivoTemporario = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\temp.xml";

            return(EnviarEvento(xmlString, id, arquivoTemporario, "envEventoCancNFe_v1.00.xsd"));
        }
Beispiel #4
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Cancelamento a = new Cancelamento();

            a.preenchimentoCompleto = false;
            update(a);
        }
        public async Task <IActionResult> Editar(int id, [Bind("Id,Observacao,VooCancelado,VooAnterior, Anexo,TipoCancelamento,Cancelado,AlvoDeProcesso,Observacao, CriadoPor,DataCriacao")] Cancelamento cancelamento)
        {
            if (id != cancelamento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _ctx.Voos.Update(cancelamento.VooCancelado);
                    _ctx.SaveChanges();

                    cancelamento.TipoCancelamento = _ctx.Tipos.Where(x => x.Id == cancelamento.TipoCancelamento.Id).FirstOrDefault();

                    if (cancelamento.VooAnterior != null)
                    {
                        _ctx.Voos.Update(cancelamento.VooAnterior);
                        _ctx.SaveChanges();
                    }
                    else
                    {
                        cancelamento.VooAnterior = null;
                    }

                    cancelamento.DataAtualizacao = DateTime.Now;
                    cancelamento.AtualizadoPor   = User.Identity.Name;

                    _ctx.Update(cancelamento);
                    await _ctx.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CancelamentoExists(cancelamento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Tipos = _opTipos;

            var matches = from m in _ctx.Tipos
                          where m.Tipo.Contains(cancelamento.TipoCancelamento.Tipo)
                          select m;

            ViewBag.TiposSelecionados = matches.ToList();
            return(View(cancelamento));
        }
Beispiel #6
0
 public string CancelarNotaFiscalAvulso(Cancelamento model)
 {
     try
     {
         return(new NfeCancelamentoController().CancelarNotaFiscalAvulso(model));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #7
0
 public void save(Cancelamento f)
 {
     if (f.id == 0)
     {
         cancelamentoDal.create(f);
     }
     else
     {
         cancelamentoDal.update(f);
     }
 }
Beispiel #8
0
        public string CancelarNotaFiscal(Cancelamento model)
        {
            try
            {
                return(new NfeCancelamentoController().CancelarNotaFiscal(model));
            }
            catch (Exception ex)
            {
                new EmailController().Enviar(ex.Message, model.Homologacao);

                throw new Exception(ex.Message);
            }
        }
Beispiel #9
0
        public string CancelarNotaFiscalAvulso(Cancelamento model)
        {
            DataBase.SystemEnvironment = model.Homologacao ? SystemEnvironment.Development : SystemEnvironment.Production;

            var nfe = new NfeController().ConsultarNotaFiscal(model.IdentificadorNota);

            if (nfe == null)
            {
                new NfeWsErroController().CadastrarErroGenerico(model.GrvId, model.UsuarioId, model.IdentificadorNota, OrigemErro.MobLink, Acao.Retorno, "Nota Fiscal não encontrada");

                throw new Exception("Nota Fiscal não encontrada");
            }

            #region Empresa
            EmpresaEntity Empresa;

            if ((Empresa = new EmpresaController().Selecionar(new EmpresaEntity {
                Cnpj = model.Cnpj
            })) == null)
            {
                throw new Exception("Empresa associada não encontrada");
            }
            #endregion Empresa

            var tools = new Tools();

            string jsonEnvio = tools.ObjToJSON(new Dictionary <string, string>()
            {
                {
                    "justificativa",
                    model.Justificativa
                }
            });

            string jsonRetorno;

            try
            {
                jsonRetorno = tools.CancelarNfse(new NfeConfiguracao().GetRemoteServer() + "/" + model.IdentificadorNota, jsonEnvio, Empresa.Token);
            }
            catch (Exception ex)
            {
                throw new Exception("Ocorreu um erro ao cancelar a Nota Fiscal (" + model.IdentificadorNota + "): " + ex.Message);
            }

            nfe.Status = 'N';

            new NfeController().Atualizar(nfe);

            return(jsonRetorno);
        }
        public IActionResult BuscarVooAnterior([FromBody] VooForm v = null)
        {
            try
            {
                var listaVoosPortalEscala = new List <Cancelamento>();
                var listVooAnteriores     = new List <Voo>();

                var pe = PortalEscalaService.GetDadosDoVoo(v.DataDoVoo, v.NumeroDoVoo);
                if (pe == null)
                {
                    return(this.StatusCode(StatusCodes.Status404NotFound, "Voo não encontrado no portal escala"));
                }

                foreach (var p in pe)
                {
                    var c = new Cancelamento();
                    c.VooAnterior              = new Voo();
                    c.VooAnterior.MetarOrigem  = GerMetar(p.scheduledAirportDeparture, p.scheduledDeparture);
                    c.VooAnterior.MetarDestino = GerMetar(p.scheduledAirportArrival, p.scheduledArrival);
                    c.VooAnterior.Origem       = p.scheduledAirportDeparture;
                    c.VooAnterior.Destino      = p.scheduledAirportArrival;
                    c.VooAnterior.Matricula    = p.aircraftRegistration;
                    c.VooAnterior.TipoVoo      = p.legType;
                    c.VooAnterior.STA          = p.scheduledArrival;
                    c.VooAnterior.STD          = p.scheduledDeparture;
                    c.VooAnterior.NumeroDoVoo  = v.NumeroDoVoo;
                    c.VooAnterior.DataVoo      = p.scheduledArrival;

                    listaVoosPortalEscala.Add(c);
                    listVooAnteriores.Add(c.VooAnterior);
                }

                if (listaVoosPortalEscala.Count > 1)
                {
                    var    filePath = Path.Combine(_path, "voosMultiplosAnteriores.json");
                    string json     = JsonConvert.SerializeObject(listVooAnteriores);
                    System.IO.File.WriteAllText(filePath, json);
                }

                return(PartialView("_ComboVoosAnteriores", listaVoosPortalEscala));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Erro interno: " + e.Message));
            }
        }
        public async Task <IActionResult> Criar([Bind("Observacao, VooCancelado,VooAnterior, EnviarEmail, EmailUsuario, SenhaUsuario, Anexo, TipoCancelamento, Cancelado, AlvoDeProcesso")] Cancelamento cancelamento)

        {
            if (ModelState.IsValid)
            {
                cancelamento.TipoCancelamento = _ctx.Tipos.Find(cancelamento.TipoCancelamento.Id);
                cancelamento.DataCriacao      = DateTime.Now;
                cancelamento.CriadoPor        = User.Identity.Name;
                cancelamento.DataAtualizacao  = DateTime.Now;
                cancelamento.AtualizadoPor    = User.Identity.Name;
                _ctx.Add(cancelamento);
                await _ctx.SaveChangesAsync();

                if (!string.IsNullOrEmpty(cancelamento.Anexo.NomeCriado))
                {
                    cancelamento.Anexo.Cancelamento = cancelamento;
                    _ctx.Anexos.Add(cancelamento.Anexo);

                    _ctx.SaveChanges();
                }

                if (cancelamento.EnviarEmail)
                {
                    sendEmail(cancelamento);
                }


                return(RedirectToAction(nameof(Index)));
            }

            var t = new Filter
            {
                FilterName = _ctx.Tipos.Find(cancelamento.TipoCancelamento.Id).Tipo
            };

            ViewBag.Tipos       = _opTipos;
            ViewBag.TiposSelect = GetListTipos(t);
            return(View(cancelamento));
        }
Beispiel #12
0
 public Cancelamento.TRetEnvEvento Cancelar(string justificativa, int numLote, int nSequencia, out Cancelamento.TProcEvento procCancelamento)
 {
     if (NotasFiscais.Count > 1)
     {
         throw new InvalidOperationException("Só é possível cancelar uma nota por vez.");
     }
     var nota = NotasFiscais[0];
     var ws = new C_WebService(Configuracao.PastaLog);
     justificativa = Funcoes.RemoverAcentos(justificativa.Trim());
     var retCanc = ws.CancelaNFe(nota, justificativa, Certificado, numLote, nSequencia, Configuracao.Ambiente, out procCancelamento);
     if (retCanc.retEvento[0].infEvento.cStat == "135")
     {
         SalvarEventoCancelamento(ref procCancelamento, nota.NFe.infNFe.ide.dEmi);
     }
     return retCanc;
 }
Beispiel #13
0
 public void SalvarEventoCancelamento(ref Cancelamento.TProcEvento procEvento, string dataEmissao)
 {
     procEvento.NomeArquivo = GetFileNameEventoCancelamento(procEvento.evento.infEvento, dataEmissao);
     procEvento.ArquivoXML = SaveXml(procEvento.Serialize(), procEvento.NomeArquivo);
 }
Beispiel #14
0
        public string CancelarNotaFiscal(Cancelamento model)
        {
            DataBase.SystemEnvironment = model.Homologacao ? SystemEnvironment.Development : SystemEnvironment.Production;

            var nfe = new NfeController().ConsultarNotaFiscal(model.GrvId, model.UsuarioId, model.IdentificadorNota, Acao.Cancelamento);

            if (nfe == null)
            {
                new NfeWsErroController().CadastrarErroGenerico(model.GrvId, model.UsuarioId, model.IdentificadorNota, OrigemErro.MobLink, Acao.Retorno, "Nota Fiscal não encontrada");

                return($"Nota Fiscal {model.GrvId}/{model.IdentificadorNota} não encontrada");
            }

            var grv = new GrvController().Selecionar(model.GrvId);

            #region Empresa
            EmpresaEntity Empresa;

            if ((Empresa = new EmpresaController().Selecionar(new EmpresaEntity {
                EmpresaId = new DepositoController().Selecionar(grv.DepositoId).EmpresaId
            })) == null)
            {
                new NfeWsErroController().CadastrarErroGenerico(model.GrvId, model.UsuarioId, model.IdentificadorNota, OrigemErro.MobLink, Acao.Retorno, "Empresa associada não encontrada");

                return("Empresa associada não encontrada");
            }
            else if (Empresa.Token == null)
            {
                new NfeWsErroController().CadastrarErroGenerico(model.GrvId, model.UsuarioId, model.IdentificadorNota, OrigemErro.MobLink, Acao.Retorno, $"Empresa {Empresa.Nome} sem Token cadastrado");

                return($"Empresa {Empresa.Nome} sem Token cadastrado");
            }
            #endregion Empresa

            var tools = new Tools();

            string jsonEnvio = tools.ObjToJSON(new Dictionary <string, string>()
            {
                {
                    "justificativa",
                    model.Justificativa
                }
            });

            string jsonRetorno;

            try
            {
                jsonRetorno = tools.CancelarNfse(new NfeConfiguracao().GetRemoteServer() + "/" + model.IdentificadorNota, jsonEnvio, Empresa.Token);
            }
            catch (Exception ex)
            {
                new NfeWsErroController().CadastrarErroGenerico(nfe.GrvId, model.UsuarioId, nfe.IdentificadorNota, OrigemErro.WebService, Acao.Cancelamento, "Ocorreu um erro ao cancelar a Nota Fiscal: " + ex.Message);

                return($"Ocorreu um erro ao cancelar a Nota Fiscal ({model.GrvId}/{model.IdentificadorNota}): {ex.Message}");
            }

            try
            {
                var retornoConsulta = new JavaScriptSerializer()
                {
                    MaxJsonLength = int.MaxValue
                }.Deserialize <RetornoCancelamentoEntity>(jsonRetorno);

                if (retornoConsulta.erros != null)
                {
                    var retornoErro = new NfeWsErroModel();

                    foreach (var erro in retornoConsulta.erros)
                    {
                        retornoErro.GrvId             = model.GrvId;
                        retornoErro.IdentificadorNota = model.IdentificadorNota;
                        retornoErro.UsuarioId         = model.UsuarioId;
                        retornoErro.Acao       = (char)Acao.Retorno;
                        retornoErro.OrigemErro = (char)OrigemErro.WebService;
                        retornoErro.Status     = retornoConsulta.status.Trim().ToUpper();

                        if (erro.codigo != null)
                        {
                            retornoErro.CodigoErro = erro.codigo.Replace("  ", " ").Trim().ToUpper();
                        }

                        if (erro.mensagem != null)
                        {
                            retornoErro.MensagemErro = erro.mensagem.Replace("  ", " ").Trim();
                        }

                        if (erro.correcao != null)
                        {
                            retornoErro.CorrecaoErro = erro.correcao.Replace("  ", " ").Trim();
                        }

                        retornoErro.ErroId = new NfeWsErroController().Cadastrar(retornoErro);
                    }

                    return(jsonRetorno);
                }
            }
            catch (Exception ex)
            {
                if (true)
                {
                }
            }



            nfe.Status = 'N';

            new NfeController().Atualizar(nfe);

            return(jsonRetorno);
        }
        private void sendEmail(Cancelamento can, bool vooReativado = false)
        {
            string to = "[email protected], [email protected]"; //To address
            //string to = "[email protected], [email protected]"; //To address
            //string to = "*****@*****.**"; //To address
            string      from    = can.EmailUsuario; //From address
            MailMessage message = new MailMessage(from, to);
            var         url     = "http://10.4.213.90/Home/Mostrar/" + can.Id;

            var tipo = vooReativado ? "Reativamento do Voo: " : "Cancelamento do Voo: ";

            var body = string.Format($@"
            <h1>Cancelamento teste - Homologacao, desconsiderar cancelamento </h1>
       <h1>{ tipo + can.VooCancelado.NumeroDoVoo} Data: {can.VooCancelado.STD.ToString("dd/MM/yyyy HH:mm")}</h1>
            <table style=' 
            border: 2px solid #FFFFFF;
            width: 100%;
            text-align: left;
            border: 1px solid #000000;
            border-collapse: collapse;'>
                <tbody>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>Motivo: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.TipoCancelamento.CodAdm}</td>                       
                    </tr>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>Voo: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.VooCancelado.NumeroDoVoo}</td>                       
                    </tr>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>Data: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.VooCancelado.STD.ToString("dd/MM/yyyy HH:mm")}</td>                       
                    </tr>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>Etapa: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.VooCancelado.Origem + " | " + can.VooCancelado.Destino}</td>                       
                    </tr>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>Obs: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.Observacao}</td>                       
                    </tr>
                    <tr>
                        <td style='width: 30%; border: 1px solid #000000;'>N.° de Passageiros: </td>
                        <td style='width: 70%; border: 1px solid #000000;'>{can.VooCancelado.QtdPassageiros}</td>                       
                    </tr>
                </tbody>
            </table> 
          

");

            if (vooReativado)
            {
                body = body + string.Format($@"<a href='{url}'>Detalhes do voo cancelado: <em>{can.VooCancelado.NumeroDoVoo} do dia {can.VooCancelado.STD.ToString("dd/MM/yyyy HH:mm")}</em> </a>");
            }



            message.Subject      = string.Format($@"{tipo + can.VooCancelado.NumeroDoVoo} Data: {can.VooCancelado.STD.ToString("dd/MM/yyyy HH:mm")} ");
            message.Body         = body;
            message.BodyEncoding = Encoding.UTF8;
            message.IsBodyHtml   = true;
            SmtpClient client = new SmtpClient("smtp.office365.com", 587); //Gmail smtp

            System.Net.NetworkCredential basicCredential1 = new
                                                            System.Net.NetworkCredential(can.EmailUsuario, can.SenhaUsuario);
            client.EnableSsl             = true;
            client.UseDefaultCredentials = false;
            client.Credentials           = basicCredential1;
            try
            {
                client.Send(message);
            }

            catch (Exception ex)
            {
                RedirectToAction(nameof(Index));
            }
        }
Beispiel #16
0
 public string GetFileNameEventoCancelamento(Cancelamento.TEventoInfEvento infEvento, string dataEmissao)
 {
     var cnpjEmpresa = infEvento.Item;
     var tipoEvento = Funcoes.ConvertEnumToString(infEvento.tpEvento);
     var chaveEvento = infEvento.chNFe;
     var seqEvento = infEvento.nSeqEvento;
     return GetFileNameEvento(cnpjEmpresa, tipoEvento, chaveEvento, seqEvento, dataEmissao);
 }
Beispiel #17
0
        private void update(Cancelamento c)
        {
            try
            {
                FormularioBll   formularioBll   = new FormularioBll();
                CancelamentoBll cancelamentoBll = new CancelamentoBll();

                c.id              = string.IsNullOrEmpty(hfId.Value) ? 0 : Convert.ToInt32(hfId.Value);
                c.formularioId    = Convert.ToInt32(hfFormularioId.Value);
                c.questao_1       = rbQuestao_1.SelectedValue;
                c.obs_questao_1   = string.IsNullOrEmpty(txtObsQuestao_1.Text) ? null : txtObsQuestao_1.Text;
                c.questao_1_1     = rbQuestao_1_1_0.SelectedValue;
                c.obs_questao_1_1 = string.IsNullOrEmpty(txtObsQuestao_1_1.Text) ? null : txtObsQuestao_1_1.Text;
                c.questao_1_2     = rbQuestao_1_2_0.SelectedValue;
                c.obs_questao_1_2 = string.IsNullOrEmpty(txtObsQuestao_1_2.Text) ? null : txtObsQuestao_1_2.Text;
                c.questao_1_3     = rbQuestao_1_3_0.SelectedValue;
                c.obs_questao_1_3 = string.IsNullOrEmpty(txtObsQuestao_1_3.Text) ? null : txtObsQuestao_1_3.Text;
                c.questao_2       = rbQuestao_2.Text;
                c.obs_questao_2   = string.IsNullOrEmpty(txtObsQuestao_2.Text) ? null : txtObsQuestao_2.Text;
                c.questao_3       = (string.IsNullOrEmpty(txtDtInsQuestao_3.Text) ? (DateTime?)null : Convert.ToDateTime(txtDtInsQuestao_3.Text));
                c.obs_questao_3   = string.IsNullOrEmpty(txtObsQuestao_3.Text) ? null : txtObsQuestao_3.Text;
                c.questao_4       = rbQuestao_4.SelectedValue;
                c.obs_questao_4   = string.IsNullOrEmpty(txtObsQuestao_4.Text) ? null : txtObsQuestao_4.Text;
                c.questao_5       = rbQuestao_5.SelectedValue;
                c.obs_questao_5   = string.IsNullOrEmpty(txtObsQuestao_5.Text) ? null : txtObsQuestao_5.Text;
                c.questao_6       = rbQuestao_6.SelectedValue;
                c.obs_questao_6   = string.IsNullOrEmpty(txtObsQuestao_6.Text) ? null : txtObsQuestao_6.Text;
                c.questao_7       = rbQuestao_7.SelectedValue;
                c.obs_questao_7   = string.IsNullOrEmpty(txtObsQuestao_7.Text) ? null : txtObsQuestao_7.Text;
                c.questao_8       = rbQuestao_8.SelectedValue;
                c.obs_questao_8   = string.IsNullOrEmpty(txtObsQuestao_8.Text) ? null : txtObsQuestao_8.Text;
                c.questao_9       = rbQuestao_9.SelectedValue;
                c.obs_questao_9   = string.IsNullOrEmpty(txtObsQuestao_9.Text) ? null : txtObsQuestao_9.Text;
                c.os_questao_9    = string.IsNullOrEmpty(txtOsQuestao_9.Text) ? null : txtOsQuestao_9.Text;
                c.questao_10      = rbQuestao_10.SelectedValue;
                c.obs_questao_10  = string.IsNullOrEmpty(txtObsQuestao_10.Text) ? null : txtObsQuestao_10.Text;
                c.questao_11      = rbQuestao_11.SelectedValue;
                c.obs_questao_11  = string.IsNullOrEmpty(txtObsQuestao_11.Text) ? null : txtObsQuestao_11.Text;
                c.questao_12      = rbQuestao_12.SelectedValue;
                c.obs_questao_12  = string.IsNullOrEmpty(txtObsQuestao_12.Text) ? null : txtObsQuestao_12.Text;
                c.questao_13      = txtQuestao_13.Text;
                c.obs_questao_13  = string.IsNullOrEmpty(txtObsQuestao_13.Text) ? null : txtObsQuestao_13.Text;
                c.questao_14      = txtQuestao_14.Text;
                c.obs_questao_14  = string.IsNullOrEmpty(txtObsQuestao_14.Text) ? null : txtObsQuestao_14.Text;
                c.questao_15      = rbQuestao_15.SelectedValue;
                c.obs_questao_15  = string.IsNullOrEmpty(txtObsQuestao_15.Text) ? null : txtObsQuestao_15.Text;
                c.questao_16      = rbQuestao_16.SelectedValue;
                c.obs_questao_16  = string.IsNullOrEmpty(txtObsQuestao_16.Text) ? null : txtObsQuestao_16.Text;
                c.questao_17      = rbQuestao_17.SelectedValue;
                c.obs_questao_17  = string.IsNullOrEmpty(txtObsQuestao_17.Text) ? null : txtObsQuestao_17.Text;
                c.questao_18      = rbQuestao_18.SelectedValue;
                c.obs_questao_18  = string.IsNullOrEmpty(txtObsQuestao_18.Text) ? null : txtObsQuestao_18.Text;
                c.questao_19      = rbQuestao_19.SelectedValue;
                c.obs_questao_19  = string.IsNullOrEmpty(txtObsQuestao_19.Text) ? null : txtObsQuestao_19.Text;
                c.questao_20      = rbQuestao_20.SelectedValue;
                c.obs_questao_20  = string.IsNullOrEmpty(txtObsQuestao_20.Text) ? null : txtObsQuestao_20.Text;
                c.questao_21      = rbQuestao_21.SelectedValue;
                c.obs_questao_21  = string.IsNullOrEmpty(txtObsQuestao_21.Text) ? null : txtObsQuestao_21.Text;
                c.questao_22      = rbQuestao_22.SelectedValue;
                c.obs_questao_22  = string.IsNullOrEmpty(txtObsQuestao_22.Text) ? null : txtObsQuestao_22.Text;
                c.questao_23      = rbQuestao_23.SelectedValue;
                c.obs_questao_23  = string.IsNullOrEmpty(txtObsQuestao_23.Text) ? null : txtObsQuestao_23.Text;
                c.questao_24      = rbQuestao_24.SelectedValue;
                c.obs_questao_24  = string.IsNullOrEmpty(txtObsQuestao_24.Text) ? null : txtObsQuestao_24.Text;
                c.questao_25      = rbQuestao_25.SelectedValue;
                c.obs_questao_25  = string.IsNullOrEmpty(txtObsQuestao_25.Text) ? null : txtObsQuestao_25.Text;
                c.questao_26      = rbQuestao_26.SelectedValue;
                c.obs_questao_26  = string.IsNullOrEmpty(txtObsQuestao_26.Text) ? null : txtObsQuestao_26.Text;
                c.consideracao    = txtQuestao_27.Text;
                c.obs_questao_28  = string.IsNullOrEmpty(txtObsQuestao_28.Text) ? null : txtObsQuestao_28.Text;

                cancelamentoBll.save(c);
                formularioBll.update(c.formularioId, UserControlHeader.linha, UserControlHeader.contrato, (c.preenchimentoCompleto == true ? true : false));

                UserControlExecQuestao1.Salvar(c.formularioId);

                if (UserControlQuestao3_4.panelPrincipal3.Visible)
                {
                    UserControlQuestao3_4.SaveQuestao3_4(c.formularioId);
                }

                if (UserControlQuestao5.panelPrincipal5.Visible)
                {
                    UserControlQuestao5.Salvar(c.formularioId);
                }

                if (UserControlQuestao6.panelPrincipal6.Visible)
                {
                    UserControlQuestao6.Salvar(c.formularioId);
                }

                UserControlQuestao7.Salvar(c.formularioId);
                UserControlOcorrenciaNet.Salvar(c.formularioId);

                if (UserControlQuestao11.panelPrincipal11.Visible)
                {
                    UserControlQuestao11.Salvar(c.formularioId);
                }

                if (UserControlQuestao12.panelPrincipal12.Visible)
                {
                    UserControlQuestao12.Salvar(c.formularioId);
                }

                if (UserControlQuestao14.panelPrincipal14.Visible)
                {
                    UserControlQuestao14.Salvar(c.formularioId);
                }

                Util.Alertbootsrap("Dados atualizados", this, upSalvar);
            }
            catch (Exception ex)
            {
                Util.Alertbootsrap(string.Concat(ex.Message, " - ", ex.InnerException), this, upSalvar);
            }
        }