public void EditarGerente(tb_gerente entity, IDaoTransacao transacao = null) { _log.TraceMethodStart(); var dao = transacao == null?_factory.GetDaoCorporativo <tb_gerente>() : _factory.GetDaoCorporativo <tb_gerente>(transacao); string where = $" cod_empresa = {entity.cod_empresa} and cod_oper = {entity.cod_oper} and tip_gerente = '{entity.tip_gerente.ToUpper()}' "; var listaEntityBanco = dao.Obter(where); if (listaEntityBanco != null && listaEntityBanco.Any()) { var entityBanco = listaEntityBanco.First(); entityBanco.cod_depend = entity.cod_depend; entityBanco.dat_ini_gerente = entity.dat_ini_gerente; entityBanco.dat_fim_gerente = entity.dat_fim_gerente; entityBanco.usu_atu_gerente = entity.usu_atu_gerente; entityBanco.sit_gerente = entity.sit_gerente; entityBanco.GERIDCMAILCUCVCT = entity.GERIDCMAILCUCVCT; dao.Atualizar(entityBanco, where); } _log.TraceMethodEnd(); }
public tb_gerente GravarGerente(tb_gerente entity, IDaoTransacao transacao = null) { _log.TraceMethodStart(); var dao = transacao == null?_factory.GetDaoCorporativo <tb_gerente>() : _factory.GetDaoCorporativo <tb_gerente>(transacao); string where = $" cod_empresa = {entity.cod_empresa} and cod_oper = {entity.cod_oper} and tip_gerente = '{entity.tip_gerente}' "; var entityBanco = dao.Obter(where); if (entityBanco != null && entityBanco.Any()) { throw new ApplicationException($"Dados informados já foram cadastrados - empresa: {entity.cod_empresa} e operador-gerente: {entity.cod_oper} "); } if (string.IsNullOrWhiteSpace(entity.tip_gerente)) { throw new ApplicationException($"Tipo do gerente obrigatório"); } if (string.IsNullOrWhiteSpace(entity.sit_gerente)) { throw new ApplicationException($"Situação do gerente obrigatório"); } entity = dao.Inserir(entity); _log.TraceMethodEnd(); return(entity); }
public tb_gerente AdaptarMsgOperadorTotb_gerente(MsgRegistroOperador msg, string modo) { _log.TraceMethodStart(); tb_gerente tb_gerente = new tb_gerente(); if (msg.codigoSisbacen != null && msg.codigoSisbacen.Value > 0) { tb_gerente.cod_empresa = msg.codigoSisbacen; } if (msg.codigoFuncionario != null && msg.codigoFuncionario.Value > 0) { tb_gerente.cod_oper = msg.codigoFuncionario; } if (msg.codigoDependenciaSisbacen != null && msg.codigoDependenciaSisbacen.Value > 0) { tb_gerente.cod_depend = msg.codigoDependenciaSisbacen; } if (msg.dataInicioOperacao != null && msg.dataInicioOperacao.Value != DateTime.MinValue) { tb_gerente.dat_ini_gerente = msg.dataInicioOperacao; } if (msg.dataFimOperacao != null && msg.dataFimOperacao.Value != DateTime.MinValue) { tb_gerente.dat_fim_gerente = msg.dataFimOperacao; } if (!string.IsNullOrWhiteSpace(msg.tipoGerente)) { tb_gerente.tip_gerente = msg.tipoGerente.ToUpper(); } if (!string.IsNullOrWhiteSpace(msg.situacaoGerente)) { tb_gerente.sit_gerente = msg.situacaoGerente; } if (!string.IsNullOrWhiteSpace(msg.usuarioUltimaAtualizacao)) { tb_gerente.usu_atu_gerente = msg.usuarioUltimaAtualizacao; } if (!string.IsNullOrWhiteSpace(msg.indicadorRecebCadVencido)) { tb_gerente.GERIDCMAILCUCVCT = msg.indicadorRecebCadVencido; } _log.TraceMethodEnd(); return(tb_gerente); }
public MsgRegistroOperador Adaptartb_depndenciaToMsgOperador(MsgRegistroOperador msg, tb_gerente tb_gerente) { _log.TraceMethodStart(); if (tb_gerente.cod_empresa != null && tb_gerente.cod_empresa.Value > 0) { msg.codigoSisbacen = tb_gerente.cod_empresa; } if (tb_gerente.cod_oper != null && tb_gerente.cod_oper.Value > 0) { msg.codigoFuncionario = tb_gerente.cod_oper; } if (tb_gerente.cod_depend != null && tb_gerente.cod_depend.Value > 0) { msg.codigoDependenciaSisbacen = tb_gerente.cod_depend; } if (tb_gerente.dat_ini_gerente != null && tb_gerente.dat_ini_gerente.Value != DateTime.MinValue) { msg.dataInicioOperacao = tb_gerente.dat_ini_gerente; } if (tb_gerente.dat_fim_gerente != null && tb_gerente.dat_fim_gerente.Value != DateTime.MinValue) { msg.dataFimOperacao = tb_gerente.dat_fim_gerente; } if (!string.IsNullOrWhiteSpace(tb_gerente.tip_gerente)) { msg.tipoGerente = tb_gerente.tip_gerente.TrimEnd(); } if (!string.IsNullOrWhiteSpace(tb_gerente.sit_gerente)) { msg.situacaoGerente = tb_gerente.sit_gerente.TrimEnd(); } if (!string.IsNullOrWhiteSpace(tb_gerente.usu_atu_gerente)) { msg.usuarioUltimaAtualizacao = tb_gerente.usu_atu_gerente.TrimEnd(); } if (!string.IsNullOrWhiteSpace(tb_gerente.GERIDCMAILCUCVCT)) { msg.indicadorRecebCadVencido = tb_gerente.GERIDCMAILCUCVCT.TrimEnd(); } _log.TraceMethodEnd(); return(msg); }