Beispiel #1
0
        public MessageCustom SaveAdditionalExamsForCalendar(List <AdditionalExamCreate> data, int userId, int nodeId)
        {
            MessageCustom _MessageCustom = new MessageCustom();
            var           result         = new CalendarDal().SaveAdditionalExamsForCalendar(data, userId, nodeId);

            if (!result)
            {
                _MessageCustom.Error   = true;
                _MessageCustom.Status  = 500;
                _MessageCustom.Message = "Sucedió un error al guardar los cambios.";
            }
            else
            {
                _MessageCustom.Error   = false;
                _MessageCustom.Status  = 200;
                _MessageCustom.Message = "Se guardaron los cambios.";
            }
            return(_MessageCustom);
        }
Beispiel #2
0
        public MessageCustom CircuitStart(string CalendarId, int userId)
        {
            MessageCustom _MessageCustom = new MessageCustom();
            var           result         = new CalendarDal().CircuitStart(CalendarId, userId);

            if (result)
            {
                _MessageCustom.Error   = false;
                _MessageCustom.Status  = (int)StatusHttp.Ok;
                _MessageCustom.Message = "El circuito se inició correctamente";
            }
            else
            {
                _MessageCustom.Error   = true;
                _MessageCustom.Status  = (int)StatusHttp.BadRequest;
                _MessageCustom.Message = "Sucedió un error al iniciar el circuito, porfavor vuelva a intentar.";
            }

            return(_MessageCustom);
        }
Beispiel #3
0
        public string CreateService(ServiceCustom data, int nodeId, int userId)
        {
            string serviceId = "";
            List <ProtocolComponentCustom> ListProtocolComponent = new ProtocolComponentDal().GetProtocolComponents(data.ProtocolId);

            if (data.FechaCalendario == null)
            {
                data.ProtocolId = new ProtocolBL().ReturnOrDuplicateProtocol(data, nodeId, userId, ListProtocolComponent);
            }

            serviceId = new ServiceDal().CreateService(data, nodeId, userId);
            if (serviceId == null)
            {
                return(null);
            }



            data.ServiceId = serviceId;

            if (data.MasterServiceTypeId == (int)MasterServiceType.Empresarial)
            {
                bool result = new ServiceComponentDal().AddServiceComponent(ListProtocolComponent, data, nodeId, userId);
                if (!result)
                {
                    return(null);
                }
            }
            else
            {
                bool result = new ServiceComponentDal().AddServiceComponent(ListProtocolComponent, data, nodeId, userId);
                if (!result)
                {
                    return(null);
                }
            }

            CalendarDto _CalendarDto = new CalendarDto();

            _CalendarDto.v_PersonId          = data.PersonId;
            _CalendarDto.v_ServiceId         = data.ServiceId;
            _CalendarDto.v_PersonId          = data.PersonId;
            _CalendarDto.d_DateTimeCalendar  = data.FechaCalendario == null ? DateTime.Now : data.FechaCalendario;
            _CalendarDto.d_CircuitStartDate  = data.FechaCalendario == null ? DateTime.Now : data.FechaCalendario;
            _CalendarDto.d_EntryTimeCM       = data.FechaCalendario == null ? DateTime.Now : data.FechaCalendario;
            _CalendarDto.i_ServiceTypeId     = data.MasterServiceTypeId;
            _CalendarDto.i_CalendarStatusId  = 1;
            _CalendarDto.i_ServiceId         = data.MasterServiceId;
            _CalendarDto.v_ProtocolId        = data.ProtocolId;
            _CalendarDto.i_NewContinuationId = 1;
            _CalendarDto.i_LineStatusId      = 1;
            _CalendarDto.i_IsVipId           = 0;

            bool calendarResult = new CalendarDal().AddCalendar(_CalendarDto, nodeId, userId);

            if (!calendarResult)
            {
                return(null);
            }
            int tipoEmpresa = ProtocolDal.ObtenerTipoEmpresaByProtocol(data.ProtocolId);

            if ((data.MasterServiceId == 19 || data.MasterServiceId == 10 || data.MasterServiceId == 15 || data.MasterServiceId == 16 || data.MasterServiceId == 17 || data.MasterServiceId == 18 || data.MasterServiceId == 19) && tipoEmpresa == 4)
            {
                bool resultHospi = new HospitalizacionDal().AddHospitalizacion(data.PersonId, data.ServiceId, nodeId, userId);
                if (!resultHospi)
                {
                    return(null);
                }
            }

            return(serviceId);
        }