public MensagemController(OperacionalContext context, IOptionsSnapshot <OperacionalSettings> settings, IOperacionalIntegrationEventService operacionalIntegrationEventService, IStringLocalizer <MensagemController> localizer) { _operacionalContext = context ?? throw new ArgumentNullException(nameof(context)); _operacionalIntegrationEventService = operacionalIntegrationEventService ?? throw new ArgumentNullException(nameof(operacionalIntegrationEventService)); _settings = settings.Value; _localizer = localizer; }
internal static async Task <Valid <SituacaoItem> > ValidaSituacaoAtual(OperacionalContext context, IStringLocalizer <IntegracaoController> localizer, int IdAcomodacao, int Id_TipoSituacao) { IStringLocalizer <IntegracaoController> _localizer; _localizer = localizer; Valid <SituacaoItem> vl = new Valid <SituacaoItem>(); //CONSULTA A SITUACAO DA ACOMODACAO var situacaoToOr = context.SituacaoItems .OfType <SituacaoItem>() .SingleOrDefault(c => c.Id_Acomodacao == IdAcomodacao && c.dt_FimSituacaoAcomodacao == null); if (situacaoToOr.Id_TipoSituacaoAcomodacao == Id_TipoSituacao) { string msgStatus = ""; vl.retorno = true; vl.msg = msgStatus; vl.Id = situacaoToOr.Id_TipoSituacaoAcomodacao; vl.obj = situacaoToOr; return(vl); } else { string msgStatus = ""; vl.retorno = false; vl.msg = msgStatus; return(vl); } }
private static Valid <bool> ValidaOutroPacienteAtivo(OperacionalContext context, IOptionsSnapshot <OperacionalSettings> settings, IStringLocalizer <IntegracaoController> localizer, int IdEmpresa, int IdAcomodacao, int IdPaciente) { OperacionalSettings _settings; _settings = settings.Value; IStringLocalizer <IntegracaoController> _localizer; _localizer = localizer; Valid <bool> vl = new Valid <bool>(); //CONSULTA SE A ACOMODACAO TEM UM PACIENTE ATIVO NAO SENDO O PACIENTE INDICADO var pacienteToValidate = context.PacienteAcomodacaoItems .OfType <PacienteAcomodacaoItem>() .SingleOrDefault(c => c.Id_Acomodacao == IdAcomodacao && c.Dt_Saida == null && c.Id_Paciente != IdPaciente); //VALIDA SE A ACOMODACAO TEM UM PACIENTE ATIVO NAO SENDO O PACIENTE INDICADO if (pacienteToValidate != null) { string msgStatus = _localizer["VALIDA_ACOMODACAOSEMPACIENTE"]; vl.retorno = false; vl.msg = msgStatus; return(vl); } vl.retorno = true; vl.msg = "SUCESSO"; vl.obj = true; return(vl); }
public SetorController(OperacionalContext context, IOptionsSnapshot <OperacionalSettings> settings, IOperacionalIntegrationEventService setorIntegrationEventService) { _setorContext = context ?? throw new ArgumentNullException(nameof(context)); _setorIntegrationEventService = setorIntegrationEventService ?? throw new ArgumentNullException(nameof(setorIntegrationEventService)); _settings = settings.Value; ((DbContext)context).ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; }
public OperacionalIntegrationEventService(IEventBus eventBus, OperacionalContext operacionalContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _operacionalContext = operacionalContext ?? throw new ArgumentNullException(nameof(operacionalContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_operacionalContext.Database.GetDbConnection()); _eventLogServiceSec = _integrationEventLogServiceFactory(_operacionalContext.Database.GetDbConnection()); }
internal static async Task <Valid <bool> > ValidaSituacaoOrigemDestino(OperacionalContext context, IStringLocalizer <IntegracaoController> localizer, int IdEmpresa, int Id_TipoSituacaoAcomodacaoOrigem, int Id_TipoSituacaoAcomodacaoDestino) { IStringLocalizer <IntegracaoController> _localizer; _localizer = localizer; Valid <bool> vl = new Valid <bool>(); string msgStatus = ""; vl.retorno = true; vl.msg = msgStatus; return(vl); }
private static Valid <bool> ValidaExistePacienteAcomodacao(OperacionalContext context, IOptionsSnapshot <OperacionalSettings> settings, IStringLocalizer <IntegracaoController> localizer, int IdEmpresa, int IdAcomodacao, int IdPaciente) { OperacionalSettings _settings; _settings = settings.Value; IStringLocalizer <IntegracaoController> _localizer; _localizer = localizer; Valid <bool> vl = new Valid <bool>(); //CONSULTA SE O PACIENTE ESTÁ ATIVO NA ACOMODACAO var pacienteToValidate = context.PacienteAcomodacaoItems .OfType <PacienteAcomodacaoItem>() .SingleOrDefault(c => c.Id_Acomodacao == IdAcomodacao && c.Dt_Saida == null && c.Id_Paciente == IdPaciente); //VALIDA SE A ACOMODACAO TEM UM PACIENTE ATIVO if (pacienteToValidate == null) { PacienteAcomodacaoItem pac = new PacienteAcomodacaoItem(); pac.Id_Paciente = IdPaciente; pac.Id_Acomodacao = IdAcomodacao; pac.Dt_Entrada = DateTime.Now; context.PacienteAcomodacaoItems.Add(pac); } vl.retorno = true; vl.msg = "SUCESSO"; return(vl); }
private static Valid <bool> ValidaExistePacienteCadastrado(OperacionalContext context, IOptionsSnapshot <OperacionalSettings> settings, IStringLocalizer <IntegracaoController> localizer, int IdEmpresa, int IdAcomodacao, string CodExternoPaciente, string NomePaciente, DateTime DataNascimentoPaciente, string GeneroPaciente ) { OperacionalSettings _settings; _settings = settings.Value; IStringLocalizer <IntegracaoController> _localizer; _localizer = localizer; Valid <bool> vl = new Valid <bool>(); //CONSULTA O PACIENTE var pacienteToExist = context.PacienteItems .OfType <PacienteItem>() .SingleOrDefault(c => c.Cod_Externo == CodExternoPaciente); //VALIDA SE EXISTE O PACIENTE if (pacienteToExist == null) { //INCLUI PACIENTE PacienteItem pacienteToSave = new PacienteItem(); pacienteToSave.Nome_Paciente = NomePaciente; pacienteToSave.Dt_NascimentoPaciente = DataNascimentoPaciente; pacienteToSave.GeneroPaciente = GeneroPaciente; pacienteToSave.Cod_Externo = CodExternoPaciente; pacienteToSave.PendenciaFinanceira = "N"; //ASSOCIA O PACIENTE List <PacienteAcomodacaoItem> lstPacienteAcomodacao = new List <PacienteAcomodacaoItem>(); PacienteAcomodacaoItem pacienteAcomodacaoToSave = new PacienteAcomodacaoItem(); pacienteAcomodacaoToSave.Id_Acomodacao = IdAcomodacao; pacienteAcomodacaoToSave.NumAtendimento = "INTERNO"; pacienteAcomodacaoToSave.Dt_Entrada = DateTime.Now; pacienteAcomodacaoToSave.Dt_Saida = null; lstPacienteAcomodacao.Add(pacienteAcomodacaoToSave); pacienteToSave.PacienteAcomodacaoItems = lstPacienteAcomodacao; context.PacienteItems.Add(pacienteToSave); } else { //ATUALIZA pacienteToExist.Nome_Paciente = NomePaciente; pacienteToExist.Dt_NascimentoPaciente = DataNascimentoPaciente; pacienteToExist.GeneroPaciente = GeneroPaciente; pacienteToExist.PendenciaFinanceira = "N"; //VALIDA ASSOCIACAO //SENAO ESTA ASSOCIADO ASSOCIA. ValidaExistePacienteAcomodacao(context, settings, localizer, IdEmpresa, IdAcomodacao, pacienteToExist.Id_Paciente); context.PacienteItems.Update(pacienteToExist); } vl.retorno = true; vl.msg = "SUCESSO"; return(vl); }