private void tabPatients_Click(object sender, EventArgs e) { listBox1.Items.Clear(); listBox2.Items.Clear(); PatientService service = new PatientService(); var patients = service.GetAll(); DoctorService doctorService = new DoctorService(); var doctors = doctorService.GetAll(); var patientsName = patients.Select(p => p.GetFullName).ToList(); var doctorsName = doctors.Select(d => d.GetFullName).ToList(); foreach (var p in patientsName) { listBox1.Items.Add(p); } foreach (var d in doctorsName) { listBox2.Items.Add(d); } }
public ActionResult Index() { List <Doctor> Doctors; Doctors = Service.GetAll(); return(View(Doctors)); }
private void button5_Click(object sender, EventArgs e) { addDoctorControl1.Visible = false; doctorListGridView.Visible = true; DoctorService doctorService = new DoctorService(); doctorListGridView.DataSource = doctorService.GetAll(); }
public IActionResult GetAll() { var doctors = _doctorService.GetAll(); if (doctors != null) { return(Ok(doctors)); } return(BadRequest("Doctors not found.")); }
private void btnGetAllDoctors_Click(object sender, EventArgs e) { DoctorService service = new DoctorService(); var doctors = service.GetAll(); dgDoctor.Rows.Clear(); if (doctors != null) { foreach (var p in doctors) { dgDoctor.Rows.Add(p.Position, p.FirstName, p.LastName, p.Patronimic, p.Specialization, p.Id); } } }
private void btnUpdateDoctor_Click(object sender, EventArgs e) { DoctorService service = new DoctorService(); if (btnUpdateDoctor.Text == "Confirm") { Doctor doctor = new Doctor() { FirstName = txtDoctorFirstName.Text, LastName = txtDoctorLastName.Text, Patronimic = txtDoctorPatronimic.Text, Position = txtDoctorPosition.Text, Specialization = txtSpec.Text, Id = Guid.NewGuid().ToString() }; doctor.Id = selectedDoctor.Id; service.UpdateDoctor(doctor); selectedDoctor = null; btnUpdateDoctor.Text = "Update"; btnCancelUpdateDoctor.Visible = false; ClearDoctorValues(); var doctors = service.GetAll(); dgDoctor.Rows.Clear(); if (doctors != null) { foreach (var p in doctors) { dgDoctor.Rows.Add(p.Position, p.FirstName, p.LastName, p.Patronimic, p.Specialization, p.Id); } } } else { if (selectedDoctor != null) { btnUpdateDoctor.Text = "Confirm"; txtSpec.Text = selectedDoctor.Specialization; txtDoctorFirstName.Text = selectedDoctor.FirstName; txtDoctorLastName.Text = selectedDoctor.LastName; txtDoctorPatronimic.Text = selectedDoctor.Patronimic; txtDoctorPosition.Text = selectedDoctor.Position; btnCancelUpdateDoctor.Visible = true; } } }
static void Main(string[] args) { DatabaseContext.PopulateDatabaseWithMockData(); ILoggerService loggerService = new TextFileLoggerService(); IAppointmentService appointmentService = new AppointmentService(loggerService); IEntityService <Doctor> doctorService = new DoctorService(loggerService); IEntityService <Patient> patientService = new PatientService(loggerService); var appointments = appointmentService.GetAppointments(); var doctor1Appointments = appointmentService.GetDoctorAppointments(1); var doctor2Appointments = appointmentService.GetDoctorAppointments(2); var patient1Appointments = appointmentService.GetPatientAppointments(1); var patient2Appointments = appointmentService.GetPatientAppointments(2); var doctors = doctorService.GetAll(); var patients = patientService.GetAll(); }
private void btnRemoveDoctor_Click(object sender, EventArgs e) { if (selectedDoctor != null) { DoctorService service = new DoctorService(); service.Remove(selectedDoctor.Id); var doctors = service.GetAll(); dgDoctor.Rows.Clear(); if (doctors?.Count > 0) { foreach (var p in doctors) { dgDoctor.Rows.Add(p.Position, p.FirstName, p.LastName, p.Patronimic, p.Specialization, p.Id); } } } }
private void btnCancelUpdateDoctor_Click(object sender, EventArgs e) { DoctorService service = new DoctorService(); if (btnUpdateDoctor.Text == "Confirm") { selectedDoctor = null; ClearDoctorValues(); btnUpdateDoctor.Text = "Update"; var doctors = service.GetAll(); dgDoctor.Rows.Clear(); if (doctors?.Count > 0) { foreach (var p in doctors) { dgDoctor.Rows.Add(p.Position, p.FirstName, p.LastName, p.Patronimic, p.Specialization, p.Id); } } } }
private void btnAddDoctor_Click(object sender, EventArgs e) { lbError.Text = ""; DoctorService service = new DoctorService(); if (!string.IsNullOrEmpty(txtDoctorFirstName.Text) && !string.IsNullOrEmpty(txtDoctorLastName.Text) && !string.IsNullOrEmpty(txtDoctorPatronimic.Text) && !string.IsNullOrEmpty(txtDoctorPosition.Text) && !string.IsNullOrEmpty(txtSpec.Text)) { Doctor doctor = new Doctor() { FirstName = txtDoctorFirstName.Text, LastName = txtDoctorLastName.Text, Patronimic = txtDoctorPatronimic.Text, Position = txtDoctorPosition.Text, Specialization = txtSpec.Text, Id = Guid.NewGuid().ToString() }; service.AddDoctor(doctor); var doctors = service.GetAll(); dgDoctor.Rows.Clear(); if (doctors != null) { foreach (var p in doctors) { dgDoctor.Rows.Add(p.Position, p.FirstName, p.LastName, p.Patronimic, p.Specialization, p.Id); } } } else { lbError.Text = "Filed can't be empty"; } }
//public override List<Appointment> ListRepo(BaseRepo<Appointment> repo) //{ // List<Appointment> result = new List<Appointment>(); // result = repo.GetAll(r => r.DoctorId == AuthenticationManager.LoggedUser.Id || r.User.Id == AuthenticationManager.LoggedUser.Id).ToList(); // return result; //} public override void FillList(EditAppointmentVM model) { UserService serviceUser = new UserService(); DoctorService serviceDoctor = new DoctorService(); List <Doctor> doctors = serviceDoctor.GetAll().ToList(); List <User> result = new List <User>(); foreach (var item in doctors) { result.Add(serviceUser.GetById(item.User.Id)); } model.ListDoctors = new List <SelectListItem>(); foreach (var item in result) { model.ListDoctors.Add(new SelectListItem() { Text = "Dr. " + item.Lastname, Value = item.Id.ToString() }); } model.ListDoctors[0].Selected = true; }
[HttpGet] // GET /api/doctor public IActionResult Get() { return(Ok(doctorService.GetAll())); }
public List <DoctorUser> GetAll() { return(doctorService.GetAll()); }
public IEnumerable <Doctor> GetAll() => _doctorService.GetAll();
public List <Doctor> GetAll() { List <Doctor> doctors = (List <Doctor>)_service.GetAll(); return(doctors); }