public DoctorAppointmentsPage() { InitializeComponent(); _patientService = new PatientService(); _appoitmentService = new AppointmentService(); List<Appointment> list = _appoitmentService.FindAll();//GetNextAppointmentsByDoctorId(SessionData.UserSessionData.CurrentUserId); Dictionary<int, Patient> patientList = GetDictionary(_patientService.FindAll()); List<object> dataSet = null; if (list != null) { dataSet = new List<object>(); foreach (Appointment app in list) { Patient p = patientList[app.IdPacient]; dataSet.Add(new { AppointmentId = app.Id, Patient = p.FirstName + " " + p.LastName, Date = app.ScheduledDate.ToString(), Time = app.Time.ToString(), Symtoms = app.Symptoms.ToString() }); } this._cview = new PagingCollectionView(dataSet, 20); this.DataContext = this._cview; } else { buttonPrevious.IsEnabled = false; buttonNext.IsEnabled = false; } }
/// <summary> /// get all appointments for the current user (represented by SessionData.UserSessionData.CurrentUserId) using AppointmentService, /// if the returned list is empty then show a specific message, /// otherwise for each appointment in the list find the corresponding results in the database using ResultsService, /// it the list returned is not empty append this results to the final list of results, /// if the final list of results is empty the show a specific message, else set dataGridResults.ItemsSource to this list /// </summary> private void RetrieveResults() { _resultService = new ResultsService(); _appointmentService = new AppointmentService(); List<Appointment> appointments = _appointmentService.FindAllByProperty(Utils.AppointmentTableProperties.IdPatient, SessionData.UserSessionData.CurrentUserId.ToString()); List<Results> results = new List<Results>(); if (appointments != null) { foreach (Appointment app in appointments) { List<Results> partialResults = _resultService.FindAllByProperty(Utils.ResultsTableProperties.IdAppointment, app.Id.ToString()); if (partialResults != null) { results.AddRange(partialResults); } } if (results.Count != 0) { dataGridResults.Visibility = Visibility.Visible; dataGridResults.ItemsSource = results; dataGridResults.IsReadOnly = true; } else { labelResultsMsg.Visibility = Visibility.Visible; } } else { labelResultsMsg.Visibility = Visibility.Visible; } }
public ActionResult Edit(AppointmentsItem model) { // int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); //model.EmpID = Empid; AppointmentService objAppoint = new AppointmentService(); objAppoint.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public void Cancel_patient_appointment() { AppointmentService appointmentService = new AppointmentService(CreateDoctorWorkDayStubRepository(), null); appointmentService.CancelPatientAppointment(3, new DateTime(2020, 12, 4)); Appointment canceledAppointment = appointmentService.GetEntity(3); Assert.True(canceledAppointment.Canceled); }
public void GetAppointmentDetailsNullRequestTest() { var svc = new AppointmentService(); var result = svc.GetAppointmentDetails(null).First(); Assert.AreEqual(result.ReturnCode, ServiceStatus.Failed); Assert.IsTrue(result.Message.Contains("ApiGatewayRequest must not be null.")); }
public JobsController(JobService service, AppointmentService appointmentService, PhoneNumberService phoneNumberService, IConfiguration configuration) : base(service) { this.appointmentService = appointmentService; this.phoneNumberService = phoneNumberService; this.configuration = configuration; }
public TimeSlotsController( TimeSlotService service, AppointmentService appointmentService, PhoneNumberService phoneNumberService ) : base(service) { this.appointmentService = appointmentService; this.phoneNumberService = phoneNumberService; }
public ViewAppointmentsForm() { InitializeComponent(); Type obj2 = Type.GetType(ConfigurationManager.AppSettings["AppointmentRep"]); ConstructorInfo constructor = obj2.GetConstructor(new Type[] { }); InterfaceAppointmentDAO defaultRepository2 = (InterfaceAppointmentDAO)constructor.Invoke(null); appointment = new AppointmentService(defaultRepository2); }
public void GetAllActivePatients_WithValidPatients_ShouldReturnPatientsCollection() { var options = new DbContextOptionsBuilder <DentHubContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) // Give a Unique name to the DB .Options; var dbContext = new DentHubContext(options); var patient = new DentHubUser { Id = "1", IsActive = true, FirstName = "Patient 1", LastName = "Test", SSN = "123" }; var patient2 = new DentHubUser { Id = "2", IsActive = true, FirstName = "Patient 2", LastName = "Test", SSN = "123" }; var patient3 = new DentHubUser { Id = "3", IsActive = true, FirstName = "Patient 3", LastName = "Test", }; var patient4 = new DentHubUser { Id = "4", IsActive = true, FirstName = "Patient 4", LastName = "Test", SSN = "123" }; dbContext.DentHubUsers.Add(patient); dbContext.DentHubUsers.Add(patient2); dbContext.DentHubUsers.Add(patient3); dbContext.DentHubUsers.Add(patient4); dbContext.SaveChanges(); var userRepository = new DbRepository <DentHubUser>(dbContext); var appointmentRepository = new DbRepository <Appointment>(dbContext); var ratingRepository = new DbRepository <Rating>(dbContext); var appointmentService = new AppointmentService(appointmentRepository, ratingRepository); var service = new PatientService(userRepository, appointmentService); var result = service.GetAllActivePatients(); Assert.Equal(new DentHubUser[] { patient, patient2, patient4 }, result); }
public ActionResult Delete(string ap_patient, string ap_dept, string date) { DateTime da = DateTime.Parse(date); AppointmentService pa = new AppointmentService(); var res = pa.Delete(ap_patient, ap_dept, da); // return RedirectToAction(nameof(Index)); return(Json(res, JsonRequestBehavior.AllowGet)); }
private void UpdateAppointment(AppointmentService service, Appointment model) { var res = service.UpdateAppointment(model); if (res == null || res.AppointmentId == 0) { Message = "Error recording changes to Appointment"; } }
public ActionResult ChangeStatus(DetailsAppointmentVM model) { AppointmentService service = new AppointmentService(); Appointment item = service.GetById(model.Id); item.IsApproved = model.IsApproved; service.Edit(item); return(RedirectToAction("Index")); }
public override void ExtraDelete(User patient) { AppointmentService service = new AppointmentService(); List <Appointment> result = service.GetAll(r => r.Doctor.Id == patient.Id).ToList(); foreach (var item in result) { service.Delete(item); } }
public async Task GetBookingByOutletAndDate_IsFalse_DateInPast_Test() { //act var appointmentService = new AppointmentService(RepoHelperMock.Object, MapperMock.Object); var result = await appointmentService.GetBookingByOutletAndDate(1, new DateTime(2018, 12, 13)); //Assert Assert.IsFalse(result.IsSuccess); Assert.AreEqual(Validation.DateTimeIsInPast, result.message); }
static void Main(string[] args) { string appointmentResult = AppointmentService.CreateAppointment("Steven Jhonson", "986782342", "5555-555-555", DateTime.Now, "Wall Street", "Armand"); Console.WriteLine(appointmentResult); string appointmentResult2 = AppointmentService.CreateAppointment("Ralf Manson", "", "5555-555-555", DateTime.Now, "Queen Street", ""); Console.WriteLine(appointmentResult2); }
protected void ApointmentGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteAppointment") { int rowNumber = Convert.ToInt32(e.CommandArgument); int ApointmentId = Convert.ToInt32(ApointmentGrid.Rows[rowNumber].Cells[0].Text); AppointmentService appser = new AppointmentService(); appser.DeleteAppointment(ApointmentId); } }
public void DeleteService(AppointmentService appointmentService) { string sql = string.Format(@" DELETE FROM APPOINTMENT_SERVICE WHERE APPOINTMENT_SERVICE_ID = {0} ", appointmentService.Id); ExecuteQuery(sql); }
public void GetDoctorAsignedAppointments() { var appointments = new List <Appointment>(); appointments.Add(new Appointment() { Id = 1, Date = new DateTime(2018, 3, 1, 8, 20, 0), Doctor = new Doctor() { Id = 1 }, State = new State() { Id = (int)StateEnum.Assigned }, Patient = new Patient() { Id = 1 } }); appointments.Add(new Appointment() { Id = 2, Date = new DateTime(2018, 3, 2, 8, 20, 0), Doctor = new Doctor() { Id = 1 }, State = new State() { Id = (int)StateEnum.Assigned }, Patient = new Patient() { Id = 2 } }); appointments.Add(new Appointment() { Id = 3, Date = new DateTime(2018, 3, 2, 10, 20, 0), Doctor = new Doctor() { Id = 1 }, State = new State() { Id = (int)StateEnum.Cancelled }, Patient = new Patient() { Id = 3 } }); mockRepository.Setup(x => x.GetDoctorAppointments(1)).Returns(appointments); mockPatientService.Setup(x => x.GetPatient(1)).Returns(new Patient() { Id = 1 }); var service = new AppointmentService(mockRepository.Object, mockPatientService.Object, mockDoctorService.Object); var result = service.GetDoctorAsignedAppointments(1); Assert.AreEqual(2, result.Count); }
protected void ShowAppointment_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteAppointment") { int rowNumber = Convert.ToInt32(e.CommandArgument); int appId = Convert.ToInt32(ShowAppointment.Rows[rowNumber].Cells[0].Text); AppointmentService ap = new AppointmentService(); ap.DeleteAppointment(appId); SortDDL_SelectedIndexChanged(sender, e); } }
public HomeController() { consultaService = new ConsultaService(); personaService = new PersonaService(); odontogramaService = new OdontogramaService(); periodonciaService = new PeriodonciaService(); usuarioService = new UsuarioService(); agendaService = new AgendaService(); medicamentoService = new MedicamentoService(); EntityService = new AppointmentService(); }
public bool IsValid() { var dep = DependencyService.Get <Common.ServiceContracts.IAppointment>(); using (AppointmentService service = new AppointmentService(dep)) { Message = service.ValidateAppointment(appoint); } return(IsError); }
public ActionResult ChangeStatus(int id) { AppointmentService service = new AppointmentService(); Appointment item = service.GetById(id); DetailsAppointmentVM model = new DetailsAppointmentVM(); PopulateModelDelete(item, model); return(View(model)); }
private async Task RefreshDataAsync() { //an event callback needs to be raised in this component context to re-render the contents and to hide the dialog CustomEditFormShown = false; CurrentAppointment = null; //we also use it to fetch the fresh data from the service - in a real case other updates may have occurred //which is why I chose to use a separate event and not two-way binding. It is also used for refreshing on Cancel var appointments = await AppointmentService.ListAsync(); SchedulerService.RefreshAppointments(appointments); }
public AppointmentController() { Title = "Agendas"; PersonaService = new PersonaService(); horarioService = new HorarioService(); EmpresaService = new EmpresaService(); UsuarioService = new UsuarioService(); TipoIdentificacionService = new TipoIdentificacionService(); agendaService = new AgendaService(); EntityService = new AppointmentService(); }
public DoctorAppointment() { InitializeComponent(); AppointmentService service = new AppointmentService(); var appointmentList = service.GetAllAppointments(); MedicinesListView.IsPullToRefreshEnabled = true; MedicinesListView.ItemsSource = appointmentList; }
public AppointmentListForm(IFormManager formManager, AppointmentService appointmentService, ReminderService reminderService) { _formManager = formManager; this.appointmentService = appointmentService; this.reminderService = reminderService; appointments = appointmentService.FindAllAggregates(); InitializeComponent(); appointmentBindingSource = new BindingSource(); initBindingSource(appointments); appointmentGridView.DataSource = appointmentBindingSource; }
public void LoadAppointments() { if (appointmentList == null) { var dep = DependencyService.Get <Common.ServiceContracts.IAppointment>(); using (AppointmentService service = new AppointmentService(dep)) { appointmentList = service.GetAppointmentsByMonth(currentDate.Month); } } }
public void LoadAppointmentsByMonthTest_No_Record(int month, int val, string msg) { string name = new DateTimeFormatInfo().GetMonthName(month); List <Appointment> res; using (AppointmentService service = new AppointmentService(repos)) { res = service.GetAppointmentsByMonth(month); } Assert.IsTrue(res.Count == val, msg + ": " + name); }
public ActionResult CreateAppointments(List <Appointment> appointments) { var appointmentIds = new List <Guid>(); foreach (var appointment in appointments) { var appointmentId = AppointmentService.CreateAppointment(GetHttpClient(), GetService(), appointment); appointmentIds.Add(appointmentId); } return(Json(appointmentIds, JsonRequestBehavior.AllowGet)); }
public void GetAppointmentByIdTest_Fail() { Appointment val = null; int i = 0; using (AppointmentService service = new AppointmentService(repos)) { val = service.GetAppointment(i); } Assert.IsTrue(val == null, val == null ? "Retrieve Appointment" : "Failed to get Appointment: " + i.ToString()); }
public void GetAppointmentsHasData() { var service = new AppointmentService(); DateTime appointmentDate = DateTime.ParseExact("2012-01-03", "yyyy-MM-dd", null); List <IAppointment> appointments = service.GetAppointments(_staff, appointmentDate); Assert.IsNotNull(appointments); Assert.IsTrue(appointments.Any()); Assert.IsNotNull(appointments.First()); }
public async void CreateAppointmentForUnexistingUserAndDoctorShouldThrowExeption() { var options = new DbContextOptionsBuilder <EClinicDbContext>() .UseInMemoryDatabase(databaseName: "Appointment_CreateAppointment") .Options; var dbContext = new EClinicDbContext(options); var appointmentService = new AppointmentService(dbContext); await Assert.ThrowsAsync <ArgumentException> (async() => await appointmentService.CreateAppointment(null, "*****@*****.**", new DateTime(2019, 08, 03, 09, 00, 00))); }
public DoctorAppointmentAssignResult(int appoitnmentId) { InitializeComponent(); groupBox.Visibility = Visibility.Hidden; h_date.Visibility = Visibility.Hidden; h_diagnosis.Visibility = Visibility.Hidden; h_medication.Visibility = Visibility.Hidden; h_symptoms.Visibility = Visibility.Hidden; h_results.Visibility = Visibility.Hidden; _appointmentService = new AppointmentService(); _patientService = new PatientService(); _resultsService = new ResultsService(); _selectedAppointment = _appointmentService.FindById(appoitnmentId); _selectedPatient = _patientService.FindById(_selectedAppointment.IdPacient); nameLabel.Content = _selectedPatient.FirstName + " " + _selectedPatient.LastName; insuranceNumberLabel.Content = _selectedPatient.InsuranceNumber; geneticDisorderLabel.Content = _selectedPatient.GeneticDiseases; }
/// <summary> /// handler for button save click Event, /// gets user input and check if is valid, /// if input is valid and selected doctor is available user AppointmentService to create new appointment /// otherwise set the errorLabel content and make it visible /// </summary> private void buttonSave_Click(object sender, RoutedEventArgs e) { int deptId = 0; int doctorId = 0; if (comboBoxDepartments.SelectedItem != null) { deptId = Convert.ToInt32(((ComboBoxItem)comboBoxDepartments.SelectedItem).Tag.ToString()); } if (comboBoxDoctors.SelectedItem != null) { doctorId = Convert.ToInt32(((ComboBoxItem)comboBoxDoctors.SelectedItem).Tag.ToString()); } DateTime scheduledDate = _defaultDate; if (datePickerAppointmentDate.SelectedDate != null) { scheduledDate = datePickerAppointmentDate.SelectedDate.Value; } String time = textBoxTime.Text; String symptoms = textBoxSymptoms.Text; if (ValidateUserInput(deptId, doctorId, scheduledDate, time) == true) { //create new appointment _appointmentService = new AppointmentService(); try { _appointmentService.Save(new Appointment(SessionData.UserSessionData.CurrentUserId, doctorId, Convert.ToInt32(time), scheduledDate, symptoms)); MessageBox.Show("Appointment created"); } catch (Exception ex) { MessageBox.Show("Something went wrong\n" + ex.Data.ToString()); } } else { labelError.Content = _errorMessage; labelError.Visibility = Visibility.Visible; } }
/// <summary> /// opens a connection to the database and initializes necessary services /// </summary> private void OpenConnection() { try { DBConnection.CreateConnection("localhost", "xe", "hr", "hr"); } catch (Exception) { try { DBConnection.CreateConnection("localhost", "ORCL", "hr", "roxana"); } catch (Exception e) { throw e; } } credentialsService = new CredentialsService(); administratorService = new AdministratorService(); patientService = new PatientService(); doctorService = new DoctorService(); departmentService = new DepartmentService(); appointmentService = new AppointmentService(); resultService = new ResultsService(); scheduleService = new ScheduleService(); }