public Retorno Alterar(AcessoSistema Entity) { try { Retorno retorno = PreenchimentoObrigatorio(Entity); if (retorno.IsValido) { retorno = new DataAcessoSistema().Alterar(Entity); } return(retorno); } catch (Exception ex) { ISEmail.EnviarErro(String.Format(Mensagens.MSG_26, ex.Message, "Na camada Business ao ALTERAR Acesso Sistema")); return(new Retorno(false, String.Format(Mensagens.MSG_05, ex.Message, "Alterar Acesso Sistema"))); } }
public Retorno PreenchimentoObrigatorio(AcessoSistema Entity) { if (Entity.Data == DateTime.MinValue) { return(new Retorno(false, String.Format(Mensagens.MSG_01, "Data"))); } if (Entity.Backup == false) { return(new Retorno(false, String.Format(Mensagens.MSG_01, "Backup"))); } if (Entity.Bloqueado == false) { return(new Retorno(false, String.Format(Mensagens.MSG_01, "Bloqueado"))); } return(new Retorno(true)); }
public Retorno Excluir(AcessoSistema Entity) { try { CommandSQL = new StringBuilder(); CommandSQL.AppendLine("DELETE FROM TB_ACESSO_SISTEMA WHERE DATA = @DATA"); Command = CriaComandoSQL(CommandSQL.ToString()); Command.Parameters.AddWithValue("@DATA", Entity.Data); Abrir(); Command.ExecuteNonQuery(); return(new Retorno(true, String.Format(Mensagens.MSG_02, "Acesso Sistema", "Excluido "))); } catch (Exception ex) { ISEmail.EnviarErro(String.Format(Mensagens.MSG_26, ex.Message, "Na camada de dados ao EXCLUIR Acesso Sistema")); return(new Retorno(false, String.Format(Mensagens.MSG_05, ex.Message, "Excluir Acesso Sistema"))); } finally { Fechar(); } }
public bool ValidarAcessoSistema(AdmSistema x) { acesso = new AcessoSistema(); return(acesso.ValidarAcesso(x)); }