public async Task <IActionResult> PostAsync(Transfer_Facility facility) { try { _logger.LogInformation($"Adding new facility."); var validCheck = new CheckerClass(_facilityRepository); validCheck.CheckFacility(facility); Inner_Facility transformedFacility = new Inner_Facility { FacilityId = 0, FacilityAddress1 = facility.FacilityAddress1, FacilityCity = facility.FacilityCity, FacilityName = facility.FacilityName, FacilityState = facility.FacilityState, FacilityZipcode = facility.FacilityZipcode, FacilityPhoneNumber = facility.FacilityPhoneNumber, }; await _facilityRepository.AddFacilityAsync(transformedFacility); return(CreatedAtAction(nameof(GetByIdAsync), new { id = facility.FacilityId }, facility)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> PostAsync(Transfer_Provider provider) { try { _logger.LogInformation($"Adding new provider."); var checkProvider = new CheckerClass(_facilityRepository, _specialtyRepository); checkProvider.CheckProvider(provider); Inner_Provider transformedProvider = new Inner_Provider { ProviderId = 0, ProviderFirstName = provider.ProviderFirstName, ProviderLastName = provider.ProviderLastName, ProviderPhoneNumber = provider.ProviderPhoneNumber, Facility = await _facilityRepository.GetFacilityByIdAsync(provider.FacilityId), Specialty = await _specialtyRepository.GetSpecialtyByIdAsync(provider.FacilityId) }; await _providerRepository.AddProviderAsync(transformedProvider); return(CreatedAtAction(nameof(GetByIdAsync), new { id = provider.ProviderId }, provider)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private List <Int64> _matchRoles(CheckerClass c) { List <Int64> matchRoles = new List <Int64>(); foreach (RoleRuleItem e in this.expressions) { //string parsestr = "(user.ContainsProperty('lockoutTime'))"; //string parsestr = "(user.PropertyIsEqual('Status', 'Ativo'))"; //string parsestr = "(user.fromThisPlugin())"; //string parsestr = "(user.propertyContainsText('Status', 'Ativo'))"; /* * var p = new CompiledExpression(e.Expression.ToLower()); * p.RegisterType("user", c); * p.Parse(); * p.Compile(); * Object ret = p.Eval(); * * if ((ret is Boolean) && ((Boolean)ret)) * if (!matchRoles.Contains(e.RoleId)) * matchRoles.Add(e.RoleId); * * //Console.WriteLine("Result: {0} {1}", p.Eval(), p.Eval().GetType().Name);*/ } return(matchRoles); }
public async Task <IActionResult> PostAsync(Transfer_Patient patient) { try { _logger.LogInformation($"Adding new patient."); var checkPatient = new CheckerClass(_patientRepository, _insuranceRepository); checkPatient.CheckPatient(patient); Inner_Patient transformedPatient = new Inner_Patient { PatientId = 0, PatientFirstName = patient.PatientFirstName, PatientLastName = patient.PatientLastName, PatientPassword = patient.PatientPassword, PatientAddress1 = patient.PatientAddress1, PatientCity = patient.PatientCity, PatientState = patient.PatientState, PatientZipcode = patient.PatientZipcode, PatientBirthDay = patient.PatientBirthDay, PatientPhoneNumber = patient.PatientPhoneNumber, PatientEmail = patient.PatientEmail, Insurance = await _insuranceRepository.GetInsuranceByIdAsync(patient.InsuranceId) }; await _patientRepository.AddPatientAsync(transformedPatient); return(CreatedAtAction(nameof(GetByIdAsync), new { id = patient.PatientId }, patient)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public List <Int64> MatchRoles(Dictionary <String, List <String> > properties) { if ((properties == null) || (properties.Count == 0)) { return(new List <Int64>()); } if ((this.expressions == null) || (this.expressions.Count == 0)) { return(new List <Int64>()); } CheckerClass c = new CheckerClass(properties); return(_matchRoles(c)); }
public async Task <IActionResult> PostAsync(Transfer_Appointment appointment) { try { _logger.LogInformation($"Adding new appointment."); var myChecker = new CheckerClass(_patientRepository, _providerRepository, _appointmentRepository); myChecker.CheckAppointment(appointment); Inner_Appointment transformedAppointment = new Inner_Appointment { AppointmentId = 0, AppointmentDate = (DateTime)appointment.AppointmentDate, Patient = await _patientRepository.GetPatientByIdAsync(appointment.PatientId), Provider = await _providerRepository.GetProviderByIdAsync(appointment.ProviderId) }; await _appointmentRepository.AddAppointmentAsync(transformedAppointment); return(CreatedAtAction(nameof(GetByIdAsync), new { id = appointment.AppointmentId }, appointment)); } catch (Exception e) { return(BadRequest(e.Message)); } }