/// <summary> /// Configura acesso ao Web Service. /// </summary> /// <returns></returns> private void ConfigurarService() { if (this.WSUserLive == null) { this.WSUserLive = new ServiceUserLive(); // Verifica se existe a configuração necessária para acesso ao Web Service if (!this.ExistsIntegracaoExterna()) { throw new ValidationException("Não foi possível encontrar as configuração para integração externa."); } if (string.IsNullOrEmpty(this.WSIntegracaoExterna.ine_urlInterna) || string.IsNullOrEmpty(this.WSIntegracaoExterna.ine_tokenInterno)) { throw new ArgumentException("Url interna ou Token interno de acesso ao Web Service está nulo ou em branco."); } // Configura Web Service this.WSUserLive.Url = this.WSIntegracaoExterna.ine_urlInterna; // Configura Token do Web Service SymmetricAlgorithm encript = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); ServiceValidation authentication = new ServiceValidation { WSToken = encript.Encrypt(this.WSIntegracaoExterna.ine_tokenInterno) }; this.WSUserLive.ServiceValidationValue = authentication; } }
/// <summary> /// <para>Encrypts binary data from a <see cref="Stream"/>, using specified symmetric algorithm.</para> /// </summary> /// <param name="self">Symmetric algorithm to be used for encryption.</param> /// <param name="source">Stream of binary data to be encrypted.</param> /// <param name="close">Whether to close <paramref name="source"/> stream when all data from it has been read and encrypted.</param> /// <returns>Encrypted binary data.</returns> /// <exception cref="ArgumentNullException">If either <paramref name="self"/> or <paramref name="source"/> is a <c>null</c> reference.</exception> /// <seealso cref="Encrypt(SymmetricAlgorithm, byte[])"/> public static byte[] Encrypt(this SymmetricAlgorithm self, Stream source, bool close = false) { Assertion.NotNull(self); Assertion.NotNull(source); return(self.Encrypt(source.Bytes(close))); }
public new static bool Save(SYS_IntegracaoExterna entity) { SYS_IntegracaoExternaDAO dao = new SYS_IntegracaoExternaDAO(); if (entity.ine_proxyAutenticacao) { if (string.IsNullOrEmpty(entity.ine_proxyAutenticacaoSenha)) { SYS_IntegracaoExterna NewEntity = new SYS_IntegracaoExterna() { ine_id = entity.ine_id }; GetEntity(NewEntity); entity.ine_proxyAutenticacaoSenha = NewEntity.ine_proxyAutenticacaoSenha; } else { SymmetricAlgorithm encript = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); entity.ine_proxyAutenticacaoSenha = encript.Encrypt(entity.ine_proxyAutenticacaoSenha); } } if (entity.Validate()) { return(dao.Salvar(entity)); } else { throw new ValidationException(entity.PropertiesErrorList[0].Message); } }
/// <summary> /// Retorna os dados do log criptografado. /// </summary> /// <param name="entityUsuario">Entidade do usu�rio</param> /// <param name="senha">Senha do usu�rio (Opcional)</param> /// <returns></returns> public static string GetDadosUsuarioAD(SYS_Usuario entityUsuario, string senha = null) { LOG_DadosUsuarioAD log = new LOG_DadosUsuarioAD() { entidade = entityUsuario.ent_id , login = entityUsuario.usu_login , senha = string.IsNullOrEmpty(senha) ? string.Empty : senha }; // Remover o Namespace xsi, xsd do XML XmlSerializerNamespaces xmlNamespace = new XmlSerializerNamespaces(); xmlNamespace.Add(string.Empty, string.Empty); // Omite a declara��o do XML: <?xml version="1.0" encoding="utf-8"?> XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; StringBuilder sb = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(sb, settings)) { XmlSerializer serializer = new XmlSerializer(typeof(LOG_DadosUsuarioAD)); serializer.Serialize(writer, log, xmlNamespace); } SymmetricAlgorithm encript = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); return(encript.Encrypt(sb.ToString())); }
/// <summary> /// Returns a binary array of encrypted data for the given parameters. /// </summary> /// <param name="algorithm"><see cref="SymmetricAlgorithm"/> to use for encryption.</param> /// <param name="data">Source buffer containing data to encrypt.</param> /// <param name="startIndex">Offset into <paramref name="data"/> buffer.</param> /// <param name="length">Number of bytes in <paramref name="data"/> buffer to encrypt starting from <paramref name="startIndex"/> offset.</param> /// <param name="key">The secret key to use for the symmetric algorithm.</param> /// <param name="iv">The initialization vector to use for the symmetric algorithm.</param> /// <returns>Encrypted version of <paramref name="data"/> buffer.</returns> public static byte[] Encrypt(this SymmetricAlgorithm algorithm, byte[] data, int startIndex, int length, byte[] key, byte[] iv) { // Fastest to use existing buffer in non-expandable memory stream for source and large block allocated memory stream for destination using MemoryStream source = new MemoryStream(data, startIndex, length); using BlockAllocatedMemoryStream destination = new BlockAllocatedMemoryStream(); algorithm.Encrypt(source, destination, key, iv); return(destination.ToArray()); }
public static string LinkReport(string PastaRelatorio, string reportID, string parameters) { #region VALIDA PARAMETROS DE ENTRADA if (String.IsNullOrEmpty(reportID)) { return("~/" + PastaRelatorio + "/Relatorio.aspx"); } #endregion VALIDA PARAMETROS DE ENTRADA if (String.IsNullOrEmpty(ExternalUrlReport)) { CurrentReportID = reportID; CurrentReportParameters = parameters; SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); return(String.Format("~/" + PastaRelatorio + "/Relatorio.aspx?dummy='{0}'" , HttpUtility.UrlEncode(sa.Encrypt(reportID)))); } else { //Adiciona o UserID nos parâmetros do relatório para uma validação de segurança quando executado pelo //site do GestaoReports através do IFrame. parameters = parameters + "&usu_login="******"iso-8859-1")); string tipRel = sa.Encrypt(reportID, System.Text.Encoding.GetEncoding("iso-8859-1")); string paramsRel = sa.Encrypt(parameters, System.Text.Encoding.GetEncoding("iso-8859-1")); return(String.Format("~/" + PastaRelatorio + "/Relatorio.aspx?dummy={0}&tipRel={1}¶ms={2}" , HttpUtility.UrlEncode(report) , HttpUtility.UrlEncode(tipRel) , HttpUtility.UrlEncode(paramsRel))); } }
protected void btnGerar_Click(object sender, EventArgs e) { if (Page.IsValid) { SalvarBusca(); string report, parameter; parameter = string.Empty; report = ((int)ReportNameGestaoAcademica.GraficoSinteseResultadosAvaliacaoComponenteCurricularTurmas).ToString(); XtraReport DevReport = null; SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); DevReport = new RelGrafComponenteCurricularTurmas (UCBuscaDocenteTurma.ComboEscola.Esc_ID, UCBuscaDocenteTurma.ComboEscola.Uni_ID, UCBuscaDocenteTurma.ComboCalendario.Valor, UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[0], UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[1], UCBuscaDocenteTurma.ComboCurriculoPeriodo.Valor[2], UCComboTipoDisciplina.Valor, UCCPeriodoCalendario.Valor[0], UCCPeriodoCalendario.Valor[1], __SessionWEB.__UsuarioWEB.Usuario.usu_id, __SessionWEB.__UsuarioWEB.Grupo.gru_id, (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao), __SessionWEB.__UsuarioWEB.Usuario.ent_id, ACA_ParametroAcademicoBO.ParametroValorInt32PorEntidade(eChaveAcademico.TIPO_NIVEL_ENSINO_EDUCACAO_INFANTIL, __SessionWEB.__UsuarioWEB.Usuario.ent_id), GetGlobalResourceObject("Relatorios", "SinteseResultadosAvaliacao.GraficoComponenteCurricularTurmas.Busca.MensagemAviso").ToString(), GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Municipio").ToString(), GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Secretaria").ToString(), ApplicationWEB.LogoRelatorioDB); GestaoEscolarUtilBO.SendParametersToReport(DevReport); Response.Redirect(String.Format("~/Documentos/RelatorioDev.aspx?dummy='{0}'", HttpUtility.UrlEncode(sa.Encrypt(report))), false); HttpContext.Current.ApplicationInstance.CompleteRequest(); } }
/// <summary> /// Cifra con algoritmo simétrico y serializa con base hexadecimal /// </summary> /// <param name="o"></param> /// <returns></returns> public static string EncryptToHexString(this SymmetricAlgorithm self, object o) { return(self.Encrypt(o).ToHexString()); }
/// <summary> /// Gera o relatorio com base nos filtros selecionados. /// </summary> private void GerarRel() { SalvarBusca(); string report, parameter; parameter = string.Empty; report = ((int)MSTech.GestaoEscolar.BLL.ReportNameGestaoAcademica.GraficoJustificativaFalta).ToString(); XtraReport DevReport = null; SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); string DRE = ""; string escola = ""; string filtros = ""; if (UCComboUAEscola.Uad_ID != Guid.Empty) { DRE = UCComboUAEscola.TextoComboUA; } else if (UCComboUAEscola.Esc_ID > 0) { ESC_Escola esc = new ESC_Escola { esc_id = UCComboUAEscola.Esc_ID }; ESC_EscolaBO.GetEntity(esc); SYS_UnidadeAdministrativa uadSup = new SYS_UnidadeAdministrativa { uad_id = esc.uad_idSuperiorGestao, ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id }; SYS_UnidadeAdministrativaBO.GetEntity(uadSup); DRE = uadSup.uad_nome; } if (UCComboUAEscola.Esc_ID > 0) { escola = UCComboUAEscola.TextoComboEscola; } if (UCComboCursoCurriculo1.Valor[0] > 0) { filtros = UCComboCursoCurriculo1.Texto; } if (UCComboCurriculoPeriodo1.Valor[2] > 0) { filtros += (string.IsNullOrEmpty(filtros) ? "" : " - ") + UCComboCurriculoPeriodo1.Texto; } if (UCComboTurma1.Valor[0] > 0) { filtros += (string.IsNullOrEmpty(filtros) ? "" : " - ") + UCComboTurma1.Texto; } DevReport = new MSTech.GestaoEscolar.RelatoriosDevExpress.Doctos.Spo.GraficoJustificativaFalta (UCComboUAEscola.Uad_ID, UCComboUAEscola.Esc_ID, UCComboUAEscola.Uni_ID, UCComboCalendario1.Valor, UCComboCursoCurriculo1.Valor[0], UCComboCursoCurriculo1.Valor[1], UCComboCurriculoPeriodo1.Valor[2], UCComboTurma1.Valor[0], __SessionWEB.__UsuarioWEB.Usuario.usu_id, __SessionWEB.__UsuarioWEB.Grupo.gru_id, (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao), __SessionWEB.__UsuarioWEB.Usuario.ent_id, GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Municipio").ToString(), GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Secretaria").ToString(), DRE, escola, UCComboCalendario1.Texto, filtros, ApplicationWEB.LogoRelatorioDB); GestaoEscolarUtilBO.SendParametersToReport(DevReport); Response.Redirect(String.Format("~/Documentos/RelatorioDev.aspx?dummy='{0}'", HttpUtility.UrlEncode(sa.Encrypt(report))), false); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
/// <summary> /// O método gera o relatório de alunos abaixo da frequência /// </summary> private void GerarRelatorio() { string report, parametros = string.Empty; report = ((int)MSTech.GestaoEscolar.BLL.ReportNameGestaoAcademica.AlunoConselhoDeClasse).ToString(); parametros = "uad_idSuperior=" + (UCComboUAEscola.Uad_ID == Guid.Empty ? string.Empty : UCComboUAEscola.Uad_ID.ToString()) + "&esc_id=" + UCComboUAEscola.Esc_ID + "&uni_id=" + UCComboUAEscola.Uni_ID + "&cur_id=" + UCComboCursoCurriculo1.Valor[0] + "&crr_id=" + UCComboCursoCurriculo1.Valor[1] + "&crp_id=" + UCComboCurriculoPeriodo1.Valor[2] + "&cal_id=" + UCComboCalendario1.Valor + "&tur_id=" + UCComboTurma1.Valor[0] + "&tipobusca=" + UCCamposBuscaAluno1.TipoBuscaNomeAluno + "&pes_nome=" + (chkBuscaAvancada.Checked ? UCCamposBuscaAluno1.NomeAluno : string.Empty) + "&alc_matricula=" + (chkBuscaAvancada.Checked ? UCCamposBuscaAluno1.MatriculaAluno : string.Empty) + "&ent_id=" + __SessionWEB.__UsuarioWEB.Usuario.ent_id + "&adm=" + (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao) + "&usu_id=" + __SessionWEB.__UsuarioWEB.Usuario.usu_id + "&gru_id=" + __SessionWEB.__UsuarioWEB.Grupo.gru_id + "&emitirDocAnoAnt=false" + "&trazMatriculaIgual=false" + "&MostraCodigoEscola=" + ACA_ParametroAcademicoBO.ParametroValorBooleanoPorEntidade(eChaveAcademico.ORDENAR_ESCOLAS_POR_CODIGO, __SessionWEB.__UsuarioWEB.Usuario.ent_id) + "&nomeMunicipio=" + GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoPaisagem.Municipio") + "&nomeSecretaria=" + GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoPaisagem.Secretaria") + "&logo=" + String.Concat(MSTech.GestaoEscolar.BLL.CFG_ServidorRelatorioBO.CarregarCredencialServidorPorRelatorio(__SessionWEB.__UsuarioWEB.Usuario.ent_id, Convert.ToInt32(report)).srr_pastaRelatorios.ToString() , ApplicationWEB.LogoRelatorioSSRS) + "&lblCodigoEOL=" + GetGlobalResourceObject("Reporting", "Reporting.AlunoConselhoDeClasse.lblCodigoEOL.label") + "&cal_ano=" + UCComboCalendario1.Cal_ano.ToString() + "&documentoOficial=true"; SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); MSTech.GestaoEscolar.BLL.CFG_RelatorioBO.SendParametersToReport(report, parametros); Response.Redirect(String.Format("~/Relatorios/Relatorio.aspx?dummy='{0}'", HttpUtility.UrlEncode(sa.Encrypt(report))), false); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
public virtual byte[] Encrypt(byte[] input) { return(_algorithm.Encrypt(input)); }
protected void btnGerarRelatorio_Click(object sender, EventArgs e) { try { SalvarBusca(); __SessionWEB.PostMessages = String.Empty; string esc_ids = String.Empty; string alu_ids_boletim = String.Empty; // Alu_ids não ordenado pelo id, e sim pelo nome string alu_ids_boletim_nao_ordenado = String.Empty; _VS_AlunosSelecionados.Clear(); //bool bTodasPaginas = false; //Boolean.TryParse(hdnSelecionaGrid.Value, out bTodasPaginas); if (chkTodos.Checked) { DataTable dtAlunos = ACA_AlunoBO.BuscaAlunos_Documentos_GraficoIndividualNotas ( UCBuscaDocenteTurma.ComboCalendario.Valor, UCBuscaDocenteTurma.ComboEscola.Esc_ID, UCBuscaDocenteTurma.ComboEscola.Uni_ID, UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[0], UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[1], UCBuscaDocenteTurma.ComboCurriculoPeriodo.Valor[2], UCBuscaDocenteTurma.ComboTurma.Valor[0], Convert.ToByte(UCCamposBuscaAluno1.TipoBuscaNomeAluno), UCCamposBuscaAluno1.NomeAluno, Convert.ToDateTime(string.IsNullOrEmpty(UCCamposBuscaAluno1.DataNascAluno) ? new DateTime().ToString() : UCCamposBuscaAluno1.DataNascAluno), UCCamposBuscaAluno1.NomeMaeAluno, UCCamposBuscaAluno1.MatriculaAluno, UCCamposBuscaAluno1.MatriculaEstadualAluno, __SessionWEB.__UsuarioWEB.Usuario.ent_id, UCBuscaDocenteTurma.ComboEscola.Uad_ID, (__SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao), __SessionWEB.__UsuarioWEB.Usuario.usu_id, __SessionWEB.__UsuarioWEB.Grupo.gru_id, 0, 0, (int)VS_SortDirection, VS_Ordenacao, false ); foreach (DataRow row in dtAlunos.Rows) { alu_ids_boletim_nao_ordenado = (String.IsNullOrEmpty(alu_ids_boletim_nao_ordenado) ? "" : alu_ids_boletim_nao_ordenado + ",") + row["alu_id"]; if (!_VS_AlunosSelecionados.ContainsKey(Convert.ToInt64(row["alu_id"]))) { esc_ids = !String.IsNullOrEmpty(esc_ids) ? String.Concat(esc_ids + ',', row["esc_id"].ToString()) : row["esc_id"].ToString(); _VS_AlunosSelecionados.Add(Convert.ToInt64(row["alu_id"]), true); } } } else // se só a pagina atual tem selecionados corre as linhas do grid pegando os alu_ids atuais { foreach (GridViewRow row in grvDocumentoAluno.Rows) { CheckBox chkSelecionar = (CheckBox)row.FindControl("chkSelecionar"); if (chkSelecionar.Checked) { alu_ids_boletim_nao_ordenado = (String.IsNullOrEmpty(alu_ids_boletim_nao_ordenado) ? "" : alu_ids_boletim_nao_ordenado + ",") + grvDocumentoAluno.DataKeys[row.RowIndex].Values["alu_id"]; if (!_VS_AlunosSelecionados.ContainsKey(Convert.ToInt64(grvDocumentoAluno.DataKeys[row.RowIndex].Values["alu_id"]))) { _VS_AlunosSelecionados.Add(Convert.ToInt64(grvDocumentoAluno.DataKeys[row.RowIndex].Values["alu_id"]), true); esc_ids = !String.IsNullOrEmpty(esc_ids) ? String.Concat(esc_ids + ',', Convert.ToString(grvDocumentoAluno.DataKeys[row.RowIndex].Values["esc_id"])) : Convert.ToString(grvDocumentoAluno.DataKeys[row.RowIndex].Values["esc_id"]); } } } } if (_VS_AlunosSelecionados.Count > 0) { string alu_ids = String.Empty; foreach (KeyValuePair <long, bool> kvp in _VS_AlunosSelecionados) { alu_ids = !String.IsNullOrEmpty(alu_ids) ? String.Concat(alu_ids + ',', kvp.Key) : kvp.Key.ToString(); } string report, parameter; parameter = string.Empty; report = ((int)MSTech.GestaoEscolar.BLL.ReportNameGestaoAcademica.GraficoIndividualNotaComponente).ToString(); XtraReport DevReport = null; SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES); DevReport = new RelGrafIndividualNotaComponente (UCBuscaDocenteTurma.ComboEscola.Esc_ID, UCBuscaDocenteTurma.ComboEscola.Uni_ID, UCBuscaDocenteTurma.ComboCalendario.Valor, UCCPeriodoCalendario.Valor[0], UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[0], UCBuscaDocenteTurma.ComboCursoCurriculo.Valor[1], UCBuscaDocenteTurma.ComboCurriculoPeriodo.Valor[2], alu_ids, __SessionWEB.__UsuarioWEB.Usuario.ent_id, GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Municipio").ToString(), GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoRetrato.Secretaria").ToString(), ApplicationWEB.LogoRelatorioDB); GestaoEscolarUtilBO.SendParametersToReport(DevReport); Response.Redirect(String.Format("~/Documentos/RelatorioDev.aspx?dummy='{0}'", HttpUtility.UrlEncode(sa.Encrypt(report))), false); HttpContext.Current.ApplicationInstance.CompleteRequest(); } else { lblMessage.Text = UtilBO.GetErroMessage("Selecione pelo menos um aluno para gerar documento.", UtilBO.TipoMensagem.Alerta); } } catch (ValidationException ex) { lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta); } catch (Exception err) { ApplicationWEB._GravaErro(err); lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o documento do aluno.", UtilBO.TipoMensagem.Erro); } }
protected void _Salvar() { if (this._IsValid()) { CFG_ServidorRelatorioDAO dal = new CFG_ServidorRelatorioDAO(); dal._Banco.Open(IsolationLevel.RepeatableRead); try { /* Remove os valores dos campos exclusivo para servidores do tipo remoto */ if (!this.divRemoteReport.Visible) { this._txtUsuario.Text = String.Empty; this._txtSenha.Text = String.Empty; this._txtConfirmaSenha.Text = String.Empty; this._txtDominio.Text = String.Empty; this._txtUrlRelatorios.Text = String.Empty; } /* Preenche o objeto a ser salvo */ CFG_ServidorRelatorio srv = new CFG_ServidorRelatorio() { ent_id = this.__SessionWEB.__UsuarioWEB.Usuario.ent_id, sis_id = Convert.ToInt32(this._ddlSistema.SelectedValue), srr_id = this._VS_srr_id }; /* Caso o usuário queira alterar a senha */ if ((!this._chkAlterarSenha.Visible) || (this._chkAlterarSenha.Checked)) { SymmetricAlgorithm encript = new SymmetricAlgorithm(CoreLibrary.Security.Cryptography.SymmetricAlgorithm.Tipo.TripleDES); srv.srr_senha = encript.Encrypt(this._txtSenha.Text); } else { CFG_ServidorRelatorioBO.GetEntity(srv); } srv.srr_nome = this._txtNome.Text; srv.srr_descricao = this._txtDescricao.Text; srv.srr_remoteServer = Convert.ToBoolean(this._ddlLocalProcessamento.SelectedValue); srv.srr_usuario = this._txtUsuario.Text; srv.srr_dominio = this._txtDominio.Text; srv.srr_diretorioRelatorios = this._txtUrlRelatorios.Text; srv.srr_pastaRelatorios = this._txtPastaRelatorios.Text; srv.srr_situacao = Convert.ToByte(this._ddlSituacao.SelectedValue); srv.srr_dataCriacao = DateTime.Now; srv.srr_dataAlteracao = DateTime.Now; srv.IsNew = (this._VS_srr_id.Equals(-1)); bool ret = CFG_ServidorRelatorioBO.Save(srv, dal._Banco); if (ret) { /* Insere os relatório pertencentes ao servidor de relatório a uma lista */ IList <CFG_RelatorioServidorRelatorio> lt = (from item in this._chkRelatorios.Items.Cast <ListItem>() where item.Selected select new CFG_RelatorioServidorRelatorio() { sis_id = srv.sis_id, ent_id = srv.ent_id, srr_id = srv.srr_id, rlt_id = int.Parse(item.Value) }).ToList(); if (lt.Count > 0) { CFG_ServidorRelatorioBO.SalvarRelatoriosDoServidor(lt, dal._Banco); } else { CFG_ServidorRelatorioBO.ApagarTodosRelatoriosServidor(srv.ent_id, srv.sis_id, srv.srr_id, dal._Banco); } } } catch (Exception err) { dal._Banco.Close(err); throw; } finally { dal._Banco.Close(); this.ConfigDivSalvarDados(); } } }