public override RetriveResourceSchedulingAndAppoinmentsRes Execute(RetriveResourceSchedulingAndAppoinmentsReq pServiceRequest) { RetriveResourceSchedulingAndAppoinmentsRes wRes = new RetriveResourceSchedulingAndAppoinmentsRes(); wRes.BusinessData.ResourceSchedulerList = SchedulingDAC.RetriveBy_ResourceId(pServiceRequest.BusinessData.ResourceId, pServiceRequest.BusinessData.HealthInstId); if (pServiceRequest.BusinessData.UseStartDate) { wRes.BusinessData.AppoimentsList = SchedulingDAC.Retrive_Appointment_By_Params_1(pServiceRequest.BusinessData.ResourceId, pServiceRequest.BusinessData.Date, null, pServiceRequest.BusinessData.HealthInstId); } else { wRes.BusinessData.AppoimentsList = SchedulingDAC.Retrive_Appointment_By_Params_2(pServiceRequest.BusinessData.ResourceId, pServiceRequest.BusinessData.Date, null, pServiceRequest.BusinessData.HealthInstId); } Guid g = new Guid(pServiceRequest.ContextInformation.UserId); foreach (AppointmentBE appointment in wRes.BusinessData.AppoimentsList.Where(p => p.Status.Equals((int)AppoimantsStatus_SP.Reservado))) { if (appointment.End <= DateTime.Now) { Health.Back.SchedulingDAC.Update_Appointment_Status(appointment.AppointmentId, AppoimantsStatus_SP.Expirado, (g)); } } return(wRes); }
public override CreateResourceSchedulingRes Execute(CreateResourceSchedulingReq pServiceRequest) { CreateResourceSchedulingRes wRes = new CreateResourceSchedulingRes(); SchedulingDAC.Create(pServiceRequest.BusinessData, new Guid(pServiceRequest.ContextInformation.UserId)); return(wRes); }
public override RemoveAppointmentRes Execute(RemoveAppointmentReq pServiceRequest) { RemoveAppointmentRes wRes = new RemoveAppointmentRes(); SchedulingDAC.RemoveAppointment(pServiceRequest.BusinessData.AppointmentId); return(wRes); }
public override UpdateAppointmentStatusRes Execute(UpdateAppointmentStatusReq pServiceRequest) { UpdateAppointmentStatusRes wRes = new UpdateAppointmentStatusRes(); foreach (AppointmentBE app in pServiceRequest.BusinessData) { SchedulingDAC.Update_Appointment_Status(app.AppointmentId, (AppoimantsStatus_SP)app.Status, new Guid(pServiceRequest.ContextInformation.UserId)); } return(wRes); }
public override UpdateResourceSchedulingRes Execute(UpdateResourceSchedulingReq pServiceRequest) { UpdateResourceSchedulingRes wRes = new UpdateResourceSchedulingRes(); if (pServiceRequest.BusinessData != null) { SchedulingDAC.Update(pServiceRequest.BusinessData, new Guid(pServiceRequest.ContextInformation.UserId)); } return(wRes); }
public override GetAppoinmentByParamsRes Execute(GetAppoinmentByParamsReq pServiceRequest) { GetAppoinmentByParamsRes wRes = new GetAppoinmentByParamsRes(); wRes.BusinessData.AppointmentBE = SchedulingDAC.Get_Appointment_By_Id(pServiceRequest.BusinessData.AppointmentId.Value); Guid g = new Guid(pServiceRequest.ContextInformation.UserId); if (wRes.BusinessData.AppointmentBE.Status == (int)AppoimantsStatus_SP.Reservado && wRes.BusinessData.AppointmentBE.End <= DateTime.Now) { Health.Back.SchedulingDAC.Update_Appointment_Status(wRes.BusinessData.AppointmentBE.AppointmentId, AppoimantsStatus_SP.Expirado, (g)); } //TODO Chequear En Atencion //if (wRes.BusinessData.AppointmentBE.Status == (int)AppoimantsStatus_SP.EnAtencion // && wRes.BusinessData.AppointmentBE.End <= DateTime.Now) //{ // Health.Back.SchedulingDAC.Update_Appointment_Status(wRes.BusinessData.AppointmentBE.AppointmentId, AppoimantsStatus_SP.Expirado, (g)); //} return(wRes); }
public override RetriveAppointmentRes Execute(RetriveAppointmentReq pServiceRequest) { RetriveAppointmentRes wRes = new RetriveAppointmentRes(); wRes.BusinessData.AppoimentsList = SchedulingDAC.Retrive_ProfessionalAppointment(pServiceRequest.BusinessData.StartDate, pServiceRequest.BusinessData.Status, pServiceRequest.BusinessData.ResourseId, pServiceRequest.BusinessData.HealthInstId); Guid g = new Guid(pServiceRequest.ContextInformation.UserId); //TODO: Mejorar ciclo foreach (AppointmentBE appointment in wRes.BusinessData.AppoimentsList.Where(p => p.Status.Equals((int)AppoimantsStatus_SP.Reservado))) { if (appointment.End <= DateTime.Now) { Health.Back.SchedulingDAC.Update_Appointment_Status(appointment.AppointmentId, AppoimantsStatus_SP.Expirado, (g)); } } return(wRes); }
public override GetProfesionalRes Execute(GetProfesionalReq pServiceRequest) { GetProfesionalRes res = new GetProfesionalRes(); if (pServiceRequest.BusinessData.IncludeScheduler && !pServiceRequest.BusinessData.IdProfesional.HasValue) { throw new FunctionalException("El servicio GetProfesional requiere el IdProfesional para incluir la programacion del profesional"); } if (pServiceRequest.BusinessData.IdProfesional.HasValue) { res.BusinessData.profesional = ProfesionalesDAC.GetById(pServiceRequest.BusinessData.IdProfesional.Value); } if (pServiceRequest.BusinessData.UserGuid.HasValue) { res.BusinessData.profesional = ProfesionalesDAC.GetByUserGuid(pServiceRequest.BusinessData.UserGuid.Value); } if (res.BusinessData.profesional == null) { throw new FunctionalException("El usuario no esta asociado a un profesional valido o habilitado en el sistema"); } if (pServiceRequest.BusinessData.IncludeScheduler && pServiceRequest.BusinessData.IdProfesional.HasValue) { res.BusinessData.ResourceSchedulerList = SchedulingDAC.RetriveBy_ResourceId(pServiceRequest.BusinessData.IdProfesional.Value, pServiceRequest.BusinessData.HealthInstitutionId.Value); } Fwk.Security.BC.UserBC userBc = new Fwk.Security.BC.UserBC(pServiceRequest.ContextInformation.AppId, pServiceRequest.SecurityProviderName); Fwk.Security.Common.User user = new Fwk.Security.Common.User(); Fwk.Security.Common.RolList rolList = null; if (pServiceRequest.BusinessData.IncludeSecurityInfo) { if (!string.IsNullOrEmpty(res.BusinessData.profesional.UserName)) { userBc.GetUserByParams(res.BusinessData.profesional.UserName, out user, out rolList); var roles = from r in rolList select r.RolName; user.Roles = roles.ToArray <string>(); } res.BusinessData.User = user; ///Si != nul indica q se trata de un usuario profesional relacionado a una instoituciĆ³n if (pServiceRequest.BusinessData.HealthInstitutionId.HasValue) { HealthInstitution_ProfesionalBE wHealthInstitution_ProfesionalBE = HealthInstitutionDAC.Get_HealthInstitution_Profesional(pServiceRequest.BusinessData.HealthInstitutionId.Value, res.BusinessData.profesional.IdProfesional, null); res.BusinessData.User.Roles = res.BusinessData.User.Roles.Union(wHealthInstitution_ProfesionalBE.Roles).ToArray <String>(); res.BusinessData.HealthInstitution_Profesional = wHealthInstitution_ProfesionalBE; } } if (pServiceRequest.BusinessData.IncludeAllInstitutions) { res.BusinessData.HealthInstitution_ProfesionalList = ProfesionalesDAC.Retrive_HealthInstitution_Relationships( res.BusinessData.profesional.IdProfesional); } return(res); }