public void TreatmentRepositoryConstructor() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Assert.NotNull(treatmentRepository); }
public async Task <IResult <IMessageOutput> > Handle(TreatmentSessionInput input, CancellationToken cancellationToken) { var validationResult = Validator.Validate(input); if (validationResult.Errors.Count > 0) { return(new Result <IMessageOutput>(validationResult.Errors)); } var patient = await PatientRepository.SingleOrDefaultAsync(p => p.ReferenceId == input.PatientReferenceId, cancellationToken); var dentalTeam = await DentalTeamRepository.SingleOrDefaultAsync(dt => dt.ReferenceId == input.DentalTeamReferenceId, cancellationToken); var treatment = await TreatmentRepository.SingleOrDefaultAsync(t => t.ReferenceId == input.TreatmentReferenceId, cancellationToken); var treatmentSession = new TreatmentSession() { PatientId = patient.Id, DentalTeamId = dentalTeam.Id, TreatmentId = treatment.Id, Start = input.Start.Value, End = input.End.Value }; await TreatmentSessionRepository.AddAsync(treatmentSession, cancellationToken); await UoW.SaveAsync(cancellationToken); return(new Result <IMessageOutput>( value: new MessageOutput("Treatment Session successfully created."), type: ResultType.Created )); }
public async Task <IResult <IMessageOutput> > ExecuteAsync(ITreatmentSessionInput input) { var validationResult = Validator.Validate(input); if (validationResult.Errors.Count > 0) { return(new Result <IMessageOutput>(validationResult.Errors)); } var treatmentSession = await TreatmentSessionRepository.Where( ts => ts.ReferenceId == input.ReferenceId ) .Include(ts => ts.Treatment) .Include(ts => ts.DentalTeam) .SingleOrDefaultAsync(); if (treatmentSession == null) { return(new Result <IMessageOutput>( new List <IError> { new Error( ErrorType.NotFound, $"Treatment session for the given Patient, Dental Team and period cannot be found." ) }, ResultType.NotFound )); } if (treatmentSession.Treatment.ReferenceId != input.TreatmentReferenceId) { var treatment = await TreatmentRepository.SingleOrDefaultAsync( t => t.ReferenceId == input.TreatmentReferenceId ); treatmentSession.TreatmentId = treatment.Id; } if (treatmentSession.DentalTeam.ReferenceId != input.DentalTeamReferenceId) { var dentalTeam = await DentalTeamRepository.SingleOrDefaultAsync( dt => dt.ReferenceId == input.DentalTeamReferenceId ); treatmentSession.DentalTeamId = dentalTeam.Id; } treatmentSession.Start = input.Start.Value; treatmentSession.End = input.End.Value; treatmentSession.Status = Enum.Parse <TreatmentSessionStatus>(input.Status); await UoW.SaveAsync(); return(new Result <IMessageOutput>( value: new MessageOutput("Treatment Session successfully updated."), type: ResultType.Updated )); }
public void GetByDoctorFalseInput() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentRepository.GetByDoctor(-1)); Assert.Equal("Het dokterId is leeg.", ex.Message); }
public void UpdateFalseInput() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentRepository.Update(null)); Assert.Equal("De behandeling is leeg.", ex.Message); }
public void Update() { EmptyLists(); Treatment treatment = new Treatment(1, "een", DateTime.Today, DateTime.Today); treatmentRepository = new TreatmentRepository(context); Assert.True(treatmentRepository.Update(treatment)); }
public void Add() { EmptyLists(); Treatment treatment = new Treatment(1, "een", DateTime.Today, DateTime.Today); treatmentRepository = new TreatmentRepository(context); Assert.Equal(4, treatmentRepository.Insert(treatment)); }
public void TreatmentRepositoryConstructorFalseInput() { EmptyLists(); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentRepository = new TreatmentRepository(null)); Assert.Equal("De behandelingContext is leeg.", ex.Message); }
public void CheckTreatmentRelationshipFalsePatientId() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentRepository.CheckTreatmentRelationship(1, -1)); Assert.Equal("Het patiëntId is leeg.", ex.Message); }
public void DeleteT(int id) { using (var treatment = new TreatmentRepository()) { Treatment treat = treatment.GetById(id); if (treat != null) { treatment.Delete(treat); } } }
public List <TreatmentModelView> GetAllT() { using (var treatment = new TreatmentRepository()) { return(treatment.GetAll().Select(x => new TreatmentModelView { Tid = x.Tid, Tname = x.Tname, }).ToList()); } }
/// <summary> /// Default constructor for patient controller /// </summary> /// <param name="patientRepository"></param> /// <param name="treatmentRepository"></param> public PatientController( PatientRepository patientRepository, TreatmentRepository treatmentRepository, TreatmentTypeRepository treatmentTypeRepository, CommentRepository commentRepository ) { this.patientRepository = patientRepository; this.treatmentRepository = treatmentRepository; this.treatmentTypeRepository = treatmentTypeRepository; this.commentRepository = commentRepository; }
public void AddT(TreatmentModelView model) { using (var treatment = new TreatmentRepository()) { var treat = new Treatment { Tid = model.Tid, Tname = model.Tname, }; treatment.Insert(treat); } }
public bool saveTreatment(IEnumerable <TreatmentPresntViewModel> treatmentList, int AppointmentID, int DoctorID, int PatientID, int clinecID) { bool check = false; IEnumerable <TreatmentPresntViewModel> treatmentListToAdd = treatmentList.Where(x => x.TeratmentID == 0); IEnumerable <TreatmentPresntViewModel> treatmentListToupdate = treatmentList.Where(x => x.TeratmentID != 0); TreatmentRepository tr = new TreatmentRepository(); tr.updateTreatmentList(treatmentListToupdate); tr.addTreatmentList(treatmentListToAdd, AppointmentID, DoctorID, PatientID, clinecID); return(check); }
public TreatmentModelView GetTById(int id) { using (var treatment = new TreatmentRepository()) { Treatment treat = treatment.GetById(id); var treatView = new TreatmentModelView(); if (treat != null) { treatView.Tid = treat.Tid; treatView.Tname = treat.Tname; } return(treatView); } }
public void UpdateT(TreatmentModelView model) { using (var treatment = new TreatmentRepository()) { Treatment treat = treatment.GetById(model.Tid); if (treat != null) { treat.Tid = model.Tid; treat.Tname = model.Tname; treatment.Update(treat); } } }
/// <summary> /// Default constructor for profiles /// </summary> /// <param name="patientRepository"></param> /// <param name="doctorRepository"></param> /// <param name="treatmentTypeRepository"></param> /// <param name="treatmentRepository"></param> public ProfileController( PatientRepository patientRepository, DoctorRepository doctorRepository, TreatmentTypeRepository treatmentTypeRepository, TreatmentRepository treatmentRepository ) { this.patientRepository = patientRepository; this.doctorRepository = doctorRepository; this.treatmentTypeRepository = treatmentTypeRepository; this.treatmentRepository = treatmentRepository; patientConverter = new PatientViewModelConverter(); doctorConverter = new DoctorViewModelConverter(); typeConverter = new TreatmentTypeViewModelConverter(); }
void IUnitOfWork.InitializeRepositories() { providerRepository = (ProviderRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(ProviderRepository)); countryRepository = (CountryRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(CountryRepository)); cityRepository = (CityRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(CityRepository)); localityRepository = (LocalityRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(LocalityRepository)); specialtyRepository = (SpecialtyRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(SpecialtyRepository)); treatmentRepository = (TreatmentRepository)base.Factory.RepositoryFactory.CreateRepository(typeof(TreatmentRepository)); providerRepository.DataContext = base.Context; countryRepository.DataContext = base.Context; cityRepository.DataContext = base.Context; localityRepository.DataContext = base.Context; specialtyRepository.DataContext = base.Context; treatmentRepository.DataContext = base.Context; }
public async Task <IResult <IMessageOutput> > Handle(UpdateTreatmentSessionInput input, CancellationToken cancellationToken) { var validationResult = Validator.Validate(input); if (validationResult.Errors.Count > 0) { return(new Result <IMessageOutput>(validationResult.Errors)); } var treatmentSession = await TreatmentSessionRepository.Where( ts => ts.ReferenceId == input.ReferenceId ) .Include(ts => ts.Treatment) .Include(ts => ts.DentalTeam) .SingleOrDefaultAsync(cancellationToken); if (treatmentSession.Treatment.ReferenceId != input.TreatmentReferenceId) { var treatment = await TreatmentRepository.SingleOrDefaultAsync( t => t.ReferenceId == input.TreatmentReferenceId, cancellationToken ); treatmentSession.TreatmentId = treatment.Id; } if (treatmentSession.DentalTeam.ReferenceId != input.DentalTeamReferenceId) { var dentalTeam = await DentalTeamRepository.SingleOrDefaultAsync( dt => dt.ReferenceId == input.DentalTeamReferenceId, cancellationToken ); treatmentSession.DentalTeamId = dentalTeam.Id; } treatmentSession.Start = input.Start.Value; treatmentSession.End = input.End.Value; treatmentSession.Status = Enum.Parse <TreatmentSessionStatus>(input.Status); await UoW.SaveAsync(cancellationToken); return(new Result <IMessageOutput>( value: new MessageOutput("Treatment Session successfully updated."), type: ResultType.Updated )); }
static void Main(string[] args) { // Test the pattern var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("global.json"); string conString = builder.Build().GetConnectionString("DefaultConnection"); MyContext myContext = MyContextFactory.Create(conString); TreatmentRepository tr = new TreatmentRepository(myContext); foreach (Treatment item in tr.GetAll()) { Console.WriteLine(item.Text); } Console.WriteLine(conString); }
/// <summary> /// Initializes a new instance of the <see cref="RestApp.Controllers.TreatmentsController"/> class. /// </summary> public TreatmentsController() { _repository = new TreatmentRepository(); }
public TreatmentManager() { _treatmentsRepository = new TreatmentRepository(); }
public UnitOfWork(MyContext context) { this._context = context; Persons = new TreatmentRepository(context); }
public void GetById() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Assert.Equal("Arm amputeren", treatmentRepository.GetById(1).Name); }
public TreatmentService() { treatmentRepository = TreatmentRepository.GetInstance(); treatmentMapper = new TreatmentMapper(); }
public App() { var medicationRepository = new MedicationRepository(new Stream <Medication>(MEDICATION_FILE)); var diagnosisRepository = new DiagnosisRepository(new Stream <Diagnosis>(DIAGNOSIS_FILE)); var allergenRepository = new AllergensRepository(new Stream <Allergens>(ALLERGEN_FILE)); var categoryRepository = new MedicationCategoryRepository(new Stream <MedicationCategory>(CATEGORY_FILE)); var symptomsRepository = new SymptomsRepository(new Stream <Symptoms>(SYMPTOMS_FILE)); var ingredientsRepository = new MedicationIngredientRepository(new Stream <MedicationIngredient>(INGREDIENTS_FILE)); var specializationRepository = new SpecializationRepository(new Stream <Specialization>(SPECIALIZATION_FILE)); var cityRepository = new CityRepository(new Stream <City>(CITY_FILE)); var addressRepository = new AddressRepository(new Stream <Address>(ADDRESS_FILE), cityRepository); var stateRepository = new StateRepository(new Stream <State>(STATE_FILE)); var hospitalRepository = new HospitalRepository(new Stream <Hospital>(HOSPITAL_FILE)); var departmentRepository = new DepartmentRepository(hospitalRepository, new Stream <Department>(DEPARTMENT_FILE)); var roomRepository = new RoomRepository(departmentRepository, new Stream <Room>(ROOM_FILE)); var userRepository = new UserRepository(new Stream <RegisteredUser>(USER_FILE), cityRepository, addressRepository, departmentRepository, roomRepository); var renovationRepository = new RenovationRepository(roomRepository, new Stream <Renovation>(RENOVATION_FILE)); var medicalRecordRepository = new MedicalRecordRepository(new Stream <MedicalRecord>(RECORD_FILE), diagnosisRepository, medicationRepository, userRepository); var bedRepository = new BedRepository(roomRepository, medicalRecordRepository, new Stream <Bed>(BED_FILE)); var equipmentTypeRepository = new EquipmentTypeRepository(new Stream <EquipmentType>(EQUIPMENT_TYPE_FILE)); var equipmentRepository = new HospitalEquipmentRepository(new Stream <HospitalEquipment>(EQUIPMENT_FILE)); var treatmentsRepository = new TreatmentRepository(medicationRepository, departmentRepository, new Stream <Treatment>(TREATMENTS_FILE)); var examinationSurgeryRepository = new ExaminationSurgeryRepository(treatmentsRepository, medicalRecordRepository, userRepository, new Stream <ExaminationSurgery>(EXAMINATION_SURGERY_FILE)); var emergencyRequestRepository = new EmergencyRequestRepository(medicalRecordRepository, new Stream <EmergencyRequest>(EMERGENCY_REQUEST_FILE)); var vaccinesRepository = new VaccinesRepository(new Stream <Vaccines>(VACCINES_FILE)); var notificationRepository = new NotificationRepository(userRepository, new Stream <Notification>(NOTIFICATION_FILE)); var articleRepository = new ArticleRepository(userRepository, new Stream <Article>(ARTICLE_FILE)); var questionRepository = new QuestionRepository(userRepository, new Stream <Question>(QUESTIONS_FILE)); var doctorReviewsRepository = new DoctorReviewRepository(userRepository, new Stream <DoctorReview>(DOCTOR_REVIEWS_FILE)); var feedbackRepository = new FeedbackRepository(userRepository, new Stream <Feedback>(FEEDBACK_FILE)); var surveyRepository = new SurveyRepository(userRepository, new Stream <Survey>(SURVEY_FILE)); var appointmentsRepository = new AppointmentRepository(userRepository, medicalRecordRepository, roomRepository, new Stream <Appointment>(APPOINTMENTS_FILE)); var workDayRepository = new WorkDayRepository(userRepository, new Stream <WorkDay>(WORK_DAY_FILE)); var vacationRequestRepository = new VacationRequestRepository(userRepository, new Stream <VacationRequest>(VACATION_REQUEST_FILE)); var reportsRepository = new ReportRepository(new Stream <Report>(REPORTS_FILE)); var labTestTypeRepository = new LabTestTypeRepository(new Stream <LabTestType>(LAB_TEST_TYPE_FILE)); var validationMedicationRepository = new ValidationMedicationRepository(new Stream <ValidationMed>(VALIDATION_FILE), userRepository, medicationRepository); var equipmentTypeService = new EquipmentTypeService(equipmentTypeRepository); var medicationService = new MedicationService(medicationRepository, validationMedicationRepository); var diagnosisService = new DiagnosisService(diagnosisRepository); var allergenService = new AllergensService(allergenRepository); var categoryService = new MedicationCategoryService(categoryRepository); var symptomsService = new SymptomsService(symptomsRepository); var ingredientsService = new MedicationIngredientService(ingredientsRepository); var specializationService = new SpecializationService(specializationRepository); var cityService = new CityService(cityRepository); var stateService = new StateService(stateRepository); var addressService = new AddressService(addressRepository); var notificationService = new NotificationService(notificationRepository, userRepository, medicalRecordRepository); var validationMedicationService = new ValidationMedicationService(validationMedicationRepository, notificationService); var hospitalService = new HospitalService(hospitalRepository); var departmentService = new DepartmentService(departmentRepository); var bedService = new BedService(bedRepository); var medicalRecordService = new MedicalRecordService(medicalRecordRepository); var treatmentService = new TreatmentService(treatmentsRepository, notificationService); var examiantionSurgeryService = new ExaminationSurgeryService(examinationSurgeryRepository); var emergencyRequestService = new EmergencyRequestService(emergencyRequestRepository, notificationService); var vaccinesService = new VaccinesService(vaccinesRepository); var articleService = new ArticleService(articleRepository); var questionService = new QuestionService(questionRepository, notificationService); var doctorsReviewService = new DoctorReviewService(doctorReviewsRepository); var feedbackService = new FeedbackService(feedbackRepository); var surveyService = new SurveyService(surveyRepository); var userService = new UserService(userRepository, medicalRecordService); var workDayService = new WorkDayService(workDayRepository, MAX_HOURS_PER_WEEK); var appointmentService = new AppointmentService(appointmentsRepository, workDayService, notificationService, VALID_HOURS_FOR_SCHEDULING, APPOINTMENT_LENGTH_IN_MINUTES, SURGERY_LENGTH_IN_MINUTES, START_WORKING_HOURS, END_WORKING_HOURS); var vacationRequestService = new VacationRequestService(vacationRequestRepository, notificationService, NUMBER_OF_ALLOWED_VACAY_REQUESTS); var reportsService = new ReportService(reportsRepository, treatmentsRepository, medicationRepository, examinationSurgeryRepository, roomRepository); var labTestTypeService = new LabTestTypeService(labTestTypeRepository); var roomService = new RoomService(roomRepository, appointmentsRepository); var hospitalEquipmentService = new HospitalEquipmentService(equipmentRepository); var renovationService = new RenovationService(renovationRepository, roomService, appointmentsRepository, hospitalEquipmentService, notificationService, RENOVATION_DAYS_RESTRICTION, RENOVATION_DAYS_RESTRICTION); var availableAppointmentService = new AvailableAppointmentService(appointmentsRepository, workDayService, VALID_HOURS_FOR_SCHEDULING, APPOINTMENT_LENGTH_IN_MINUTES, SURGERY_LENGTH_IN_MINUTES, START_WORKING_HOURS, END_WORKING_HOURS); equipmentTypeController = new EquipmentTypeController(equipmentTypeService); medicationController = new MedicationController(medicationService); userController = new UserController(userService); diagnosisController = new DiagnosisController(diagnosisService); symptomsController = new SymptomsController(symptomsService); categoryController = new MedicationCategoryController(categoryService); allergensController = new AllergensController(allergenService); vaccinesController = new VaccinesController(vaccinesService); labTestTypeController = new LabTestTypeController(labTestTypeService); medicationIngredientController = new MedicationIngredientController(ingredientsService); cityController = new CityController(cityService); specializationController = new SpecializationController(specializationService); addressController = new AddressController(addressService); stateController = new StateController(stateService); departmentController = new DepartmentController(departmentService); hospitalController = new HospitalController(hospitalService); roomController = new RoomController(roomService); renovationController = new RenovationController(renovationService); hospitalEquipmentController = new HospitalEquipmentController(hospitalEquipmentService); medicalRecordController = new MedicalRecordController(medicalRecordService); treatmentController = new TreatmentController(treatmentService); examinationSurgeryController = new ExaminationSurgeryController(examiantionSurgeryService); articleController = new ArticleController(articleService); questionController = new QuestionController(questionService); doctorReviewController = new DoctorReviewController(doctorsReviewService); surveyController = new SurveyController(surveyService); feedbackController = new FeedbackController(feedbackService); workDayController = new WorkDayController(workDayService); reportController = new ReportController(reportsService); validationMedicationController = new ValidationMedicationController(validationMedicationService); vacationRequestController = new VacationRequestController(vacationRequestService); bedController = new BedController(bedService); emergencyRequestController = new EmergencyRequestController(emergencyRequestService); appointmentController = new AppointmentController(appointmentService); notificationController = new NotificationController(notificationService); availableAppointmentController = new AvailableAppointmentController(availableAppointmentService); validations = new Validations(UNDERAGE_RESTRICTION); }
public PatientBillInfoWrap patientTotalCost(int patientID, int clinecID, DateTime from, DateTime to) { decimal?TotalCost = 0; decimal treatmentCost = 0; decimal?opperationCost = 0; decimal?materialCost = 0; decimal?customMatrialCost = 0; decimal?patientPayment = 0; decimal?remain = 0; CustomMatrialRepository customMatrialRepository = new CustomMatrialRepository(); customMatrialCost = customMatrialRepository.getPatientCusmotMatrialCostTotal(patientID, clinecID, from, to); TreatmentRepository treatmentRepository = new TreatmentRepository(); IEnumerable <Treatment> patientTreatmentList = treatmentRepository.getPatientTreatmentList(patientID, clinecID, from, to); foreach (Treatment treatment in patientTreatmentList) { treatmentCost += treatment.TeratmentCost; opperationCost += treatment.OpperationCost; IEnumerable <MaterialTreatment> matrialTreatmentList = treatment.MaterialTreatments; foreach (MaterialTreatment matrialTreatment in matrialTreatmentList) { materialCost += matrialTreatment.MaterialCost * (int)matrialTreatment.Quantity; } } if (opperationCost == null) { opperationCost = 0; } if (materialCost == null) { materialCost = 0; } if (customMatrialCost == null) { customMatrialCost = 0; } TotalCost = treatmentCost + opperationCost + materialCost;// +customMatrialCost; patientPayment = patientTotalPayment(patientID, clinecID, from, to); if (patientPayment == null) { patientPayment = 0; } remain = TotalCost - patientPayment; PatientBillInfoWrap billInfo = new PatientBillInfoWrap { customMatrialCost = customMatrialCost, materialCost = materialCost, opperationCost = opperationCost, treatmentCost = treatmentCost, TotalCost = TotalCost, PatientPayment = patientPayment, Remain = remain }; return(billInfo); }
public void CheckTreatmentRelationship() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Assert.True(treatmentRepository.CheckTreatmentRelationship(11, 12)); }
public void GetByDoctor() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Assert.Equal(3, treatmentRepository.GetByDoctor(11).Count); }
public void GetByPatient() { EmptyLists(); treatmentRepository = new TreatmentRepository(context); Assert.Equal(4, treatmentRepository.GetByPatient(12).Count); }