private void UpdateTime(DoctorDTO doctor, DateTime date) { try { cboxTime.ItemsSource = null; cboxTime.Items.Clear(); TimeManager tm = new TimeManager(); string time = MainPage.GetDoctorShedules(doctor, date).FirstOrDefault().Time; List <string> timeVariants = tm.TimeParsing(time).ToList(); foreach (var el in tm.GetByDoctor(doctor)) { timeVariants.RemoveAll(x => x == el.Time); } cboxTime.ItemsSource = timeVariants; } catch (NullReferenceException) { Console.WriteLine("Null ref in UpdateTime"); return; } catch (ValidationException) { Console.WriteLine("Error with substrings"); return; } }
private void Enroll(object sender, RoutedEventArgs e) { if (cboxDocsList.SelectedIndex == -1) { MessageBox.Show("Select doctor"); return; } if (this.dpDate.SelectedDate == null) { MessageBox.Show("Please select date"); return; } if (cboxTime.SelectedIndex == -1) { MessageBox.Show("Select time"); return; } TimeManager tm = new TimeManager(); DoctorDTO doctor = cboxDocsList.SelectedValue as DoctorDTO; DateTime date = dpDate.SelectedDate.Value; var schedule = ModelCreator.CreateEnroll(doctor.Id, (PatientsPage.instance.lstPatients.SelectedValue as PatientDTO).Id, date, cboxTime.SelectedItem.ToString()); tm.Add(schedule); MessageBox.Show("Enroll"); this.Close(); }
public void UpdateDoctor(DoctorDTO doctorDTO) { Database.Doctors.Update(new Doctor { Id = doctorDTO.Id, Name = doctorDTO.Name, Surname = doctorDTO.Surname, Patronymic = doctorDTO.Patronymic, SpecialityId = doctorDTO.SpecialityId, TheBeginingOfReception = doctorDTO.TheBeginingOfReception, TheEndOfReception = doctorDTO.TheEndOfReception, Cabinet = doctorDTO.Cabinet, Login = doctorDTO.Login }); Database.Save(); }
public async Task <ActionResult> Profile(int id) { DoctorDTO doctor = await _UserService.getDoctorByIdAsync(id); // return Json(doctor, JsonRequestBehavior.AllowGet); return(View(doctor)); }
public ActionResult DeleteConfirm(int id) { string URL = "DoctorData/GetDoctor/" + id; ListDoctor ViewModel = new ListDoctor(); HttpResponseMessage HttpResponse = Client.GetAsync(URL).Result; if (HttpResponse.IsSuccessStatusCode) { DoctorDTO Doctor = HttpResponse.Content.ReadAsAsync <DoctorDTO>().Result; ViewModel.Doctor = Doctor; URL = "PracticeData/FindPractice/" + Doctor.PracticeID; HttpResponse = Client.GetAsync(URL).Result; PracticeDTO Practice = HttpResponse.Content.ReadAsAsync <PracticeDTO>().Result; ViewModel.Practice = Practice; return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }
public IEnumerable <DoctorDTO> GetAllDoctor()//按名查找 { using (MyContext ctx = new MyContext()) { var docs = ctx.Doctors; if (docs == null) { return(null); } List <DoctorDTO> list = new List <DoctorDTO>(); foreach (var s in docs) { DoctorDTO dto = new DoctorDTO(); dto.doctor_ID = s.doctor_ID; dto.doctor_name = s.doctor_name; dto.doctor_dept = s.doctor_dept; dto.doctor_position = s.doctor_position; dto.salary = s.salary; dto.sex = s.sex; dto.age = s.age; dto.is_arranged = s.is_arranged; list.Add(dto); } return(list); } }
public bool add(DoctorDTO d) { int s = 0; if (d.Available == true) { s = 1; } try { string query = "insert into doctor (Name, Salary, Available) values ('" + d.Name + "'," + d.Salary + "," + s + ")"; c.sqlComm = new SqlCommand(query, c.sqlConn); c.sqlComm.ExecuteNonQuery(); for (int i = 0; i < 7; i++) { new AppointmentDAO().addNew(d.Name, DateTime.Today.AddDays(i).ToString("dd-MM-yyyy")); } c.sqlConn.Close(); return(true); } catch (Exception e) { return(false); } }
public static void DoctorsDepartments() { ObservableCollection <DoctorDTO> doctors = new ObservableCollection <DoctorDTO>(TestClass.GetSomeDoctors()); DoctorDTO doctorDTO = doctors.FirstOrDefault(x => x.Id == 1); Console.WriteLine(doctorDTO.GetDepartment().Name); }
public async Task <IActionResult> Put(DoctorDTO doctorDto) { var doctor = _context.Doctors.Include(x => x.DoctorMedicalProcedures).FirstOrDefault(x => x.Id == doctorDto.Id); var medicalProcedureIds = doctorDto.DoctorMedicalProcedures.Select(x => x.MedicalProcedureId).ToList(); doctor.FirstName = doctorDto.FirstName; doctor.LastName = doctorDto.LastName; var proceduresToRemove = doctor.DoctorMedicalProcedures .Where(x => !medicalProcedureIds.Contains(x.MedicalProcedureId)).ToList(); foreach (var doctorMedicalProcedure in proceduresToRemove) { doctor.DoctorMedicalProcedures.Remove(doctorMedicalProcedure); } foreach (var medicalProcedureId in medicalProcedureIds .Where(medicalProcedureId => doctor.DoctorMedicalProcedures.All(x => x.MedicalProcedureId != medicalProcedureId))) { doctor.DoctorMedicalProcedures.Add(new DoctorMedicalProcedure() { DoctorId = doctor.Id, MedicalProcedureId = medicalProcedureId }); } await _context.SaveChangesAsync(); return(NoContent()); }
public ActionResult DeleteDoctor(int id) { DoctorDTO doctorDTO = doctorService.GetDoctor(id); userService.DeleteUser(doctorDTO.Login); doctorService.DeleteDoctor(id); return(RedirectToRoute(new { Controller = "Admin", Action = "Doctors" })); }
private void AddDoctor_Click(object sender, RoutedEventArgs e) { DoctorDTO doctor = (DoctorDTO)AllDoctorList.SelectedItem; ((DataContext as MedicalAppointmentDTO).Doctors as List <DoctorDTO>).Add(doctor); CollectionViewSource.GetDefaultView(DoctorList.ItemsSource).Refresh(); CollectionViewSource.GetDefaultView(AllDoctorList.Items).Refresh(); }
public async Task <DoctorDTO> CreateDoctor(DoctorDTO doctorDTO) { var doctor = _mapper.Map <Doctor>(doctorDTO); var result = _unitOfWork.DoctorRepository.Insert(doctor); await _unitOfWork.SaveAsync(); return(_mapper.Map <DoctorDTO>(result)); }
public ActionResult DoctorRecords() { DoctorDTO doctorDTO = doctorService.GetDoctor(Session["Login"].ToString()); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <RecordDTO, RecordViewModel>()).CreateMapper(); DateTime Tommorow = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1); return(View(mapper.Map <IEnumerable <RecordDTO>, IEnumerable <RecordViewModel> >(recordService.GetRecordsForDoctor(doctorDTO.Id).Where(r => r.Date.Date == DateTime.Now.Date || r.Date.Date == Tommorow.Date)))); }
public static void DoctorWorkDDoctor() { ObservableCollection <DoctorDTO> doctors = new ObservableCollection <DoctorDTO>(TestClass.GetSomeDoctors()); DoctorDTO doctorDTO = doctors.FirstOrDefault(x => x.Id == 1); List <WorkDayDoctorDTO> workDayDoctorDTOs = new List <WorkDayDoctorDTO>(doctorDTO.GetWorkDaysDoctorsDTO()); Console.WriteLine(workDayDoctorDTOs.ElementAt(0).WorkDayId); }
public Doctor() { InitializeComponent(); this.DataContext = this; //list of appotments for this doctor and where the logged in patient is scheguled List <MedicalAppointmentDTO> tempAppointments = new List <MedicalAppointmentDTO>(); RoomDTO tempRoom = new RoomDTO() { Floor = "two", Type = Project.Model.RoomType.medicalRoom, Ward = "op" }; tempAppointments.Add(new MedicalAppointmentDTO() { Room = tempRoom, Beginning = new DateTime(2020, 5, 10, 15, 0, 0), Type = Project.Model.MedicalAppointmentType.examination, End = new DateTime(2020, 5, 10, 15, 30, 0), IsScheduled = true }); tempAppointments.Add(new MedicalAppointmentDTO() { Room = tempRoom, Beginning = new DateTime(2020, 5, 11, 15, 0, 0), Type = Project.Model.MedicalAppointmentType.examination, End = new DateTime(2020, 5, 11, 15, 30, 0), IsScheduled = true }); tempAppointments.Add(new MedicalAppointmentDTO() { Room = tempRoom, Beginning = new DateTime(2020, 5, 12, 15, 0, 0), Type = Project.Model.MedicalAppointmentType.examination, End = new DateTime(2020, 5, 12, 15, 30, 0), IsScheduled = true }); tempAppointments.Add(new MedicalAppointmentDTO() { Room = tempRoom, Beginning = new DateTime(2020, 5, 13, 15, 0, 0), Type = Project.Model.MedicalAppointmentType.examination, End = new DateTime(2020, 5, 13, 15, 30, 0), IsScheduled = true }); tempAppointments.Add(new MedicalAppointmentDTO() { Room = tempRoom, Beginning = new DateTime(2020, 5, 14, 15, 0, 0), Type = Project.Model.MedicalAppointmentType.examination, End = new DateTime(2020, 5, 14, 15, 30, 0), IsScheduled = true }); SelectedDoctor = new DoctorDTO() { Appointments = tempAppointments, FirstName = "Filip", LastName = "Zdelar", AverageReviewScore = 4.5F }; //list of available medical appoitments for the selected period nad this doctor AvailableAppoitments = new ObservableCollection <MedicalAppointmentDTO>(); //Chart initilization SeriesCollection = new SeriesCollection { new ColumnSeries() { Title = "Rating", Values = new ChartValues <int> { 3, 2, 2, 10, 13 } } }; Labels = new[] { "1", "2", "3", "4", "5" }; Formatter = value => value.ToString("N"); }
public ActionResult EditDoctor(int?id) { DoctorDTO doctor = doctorService.GetDoctor(id); var doctor2 = new DoctorViewModel { Id = doctor.Id }; return(View(doctor2)); }
public static Doctor DoctorDTOToDoctor(DoctorDTO doctorDTO) { Doctor doctor = new Doctor(); doctor.Name = doctorDTO.Name; doctor.Surname = doctorDTO.Surname; doctor.Jmbg = doctorDTO.Jmbg; return(doctor); }
public static Doctor UpdateDoctorFieldsFromDTO(Doctor doctor, DoctorDTO doctorDTO) { doctor.FirstName = doctorDTO.FirstName; doctor.LastName = doctorDTO.LastName; doctor.Patronymic = doctorDTO.Patronymic; doctor.PhoneNumber = doctorDTO.PhoneNumber; doctor.Speciality = doctorDTO.Speciality; return(doctor); }
public async Task <IActionResult> Post(DoctorDTO doctorDto) { var doctor = _mapper.Map <Doctor>(doctorDto); _context.Add(doctor); await _context.SaveChangesAsync(); return(Ok(doctor.Id)); }
public static DoctorDTO DoctorToDoctorDTO(Doctor doctor) { DoctorDTO doctorDTO = new DoctorDTO(); doctorDTO.Name = doctor.Name; doctorDTO.Surname = doctor.Surname; doctorDTO.Jmbg = doctor.Jmbg; return(doctorDTO); }
public void EditDoctor(DoctorDTO doctorDTO) { var doctor = Database.Doctors.Get(doctorDTO.Id); Database.Doctors.Get(doctorDTO.Id).FirstName = doctorDTO.FirstName; Database.Doctors.Get(doctorDTO.Id).SecondName = doctorDTO.SecondName; Database.Doctors.Get(doctorDTO.Id).Specialization = doctorDTO.Specialization; //Database.Doctors.Update(doctor); Database.Save(); }
public IEnumerable <PatientDTO> GetDoctorPatients(int id) { DoctorDTO doctor = _doctorRepository.GetDoctor(id); IEnumerable <PatientDTO> patients = _patientRepository.GetAllPatients(); IEnumerable <AppointmentDTO> appointments = _appointmentRepository.GetAllAppointments(); DoctorLogic doctorLogic = new DoctorLogic(doctor, patients, appointments); IEnumerable <PatientDTO> doctorsPatients = doctorLogic.GetDoctorPatients(); return(doctorsPatients); }
public DoctorDTO CreateDoctor([FromBody] DoctorDTO doctor) { Doctor doctorEntity = _mapper.Map <Doctor>(doctor); _repository.CreateDoctor(doctorEntity); _repository.Save(); DoctorDTO newDoctor = _mapper.Map <DoctorDTO>(doctorEntity); return(newDoctor); }
public IHttpActionResult AddDoctor([FromBody] DoctorDTO doctorDTO) { if (doctorDTO == null) { return(BadRequest()); } var results = _doctorService.AddDoctor(doctorDTO); return(Ok(results)); }
private void Add_Doctor_Click(object sender, RoutedEventArgs e) { DoctorDTO item = (DoctorDTO)(sender as System.Windows.Controls.Button).DataContext; MessageBox.Show("Da li ste sigurni da zelite da dodate Dr." + item.FirstName + " " + item.LastName + " u termin?", "Potvrda", MessageBoxButton.OKCancel); AllDoctorList.Visibility = Visibility.Hidden; DoctorList.Visibility = Visibility.Visible; Change_Doctor_Button.Visibility = Visibility.Visible; Cancel_Change_Doctor_Button.Visibility = Visibility.Hidden; }
public IEnumerable <ScheduleDTO> GetByDoctor(DoctorDTO doctorDTO) { Doctor doctor = Database.Doctors.Find(x => x.Id == doctorDTO.Id).FirstOrDefault(); if (doctor == null) { throw new ArgumentNullException(); } return(Mapper.Map <IEnumerable <Schedule>, List <ScheduleDTO> >(Database.Schedules.GetAll().Where(x => x.DoctorId == doctor.Id))); }
public ActionResult AcknowledgeRecord(string time) { DoctorDTO doctorDTO = doctorService.GetDoctor(Convert.ToInt32(Session["DoctorId"].ToString())); PatientDTO patientDTO = patientService.GetPatient(Session["Login"].ToString()); DateTime Tommorow = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day + 1); RecordViewModel recordDTO = new RecordViewModel { Date = Tommorow.Date, PatientId = patientDTO.Id, PatientName = patientDTO.Surname + " " + patientDTO.Name + " " + patientDTO.Patronymic, DoctorId = doctorDTO.Id, DoctorName = doctorDTO.Surname + " " + doctorDTO.Name + " " + doctorDTO.Patronymic, Time = time, Cabinet = doctorDTO.Cabinet }; return(View(recordDTO)); }
public Response <DoctorDTO> Post(DoctorDTO doctorDTO) { try { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; doctorDTO.FirstName = textInfo.ToTitleCase(doctorDTO.FirstName); doctorDTO.LastName = textInfo.ToTitleCase(doctorDTO.LastName); doctorDTO.DisplayName = textInfo.ToTitleCase(doctorDTO.DisplayName); using (VDEntities entities = new VDEntities()) { // 1- send email to doctor UserEmail.DoctorEmail(doctorDTO); // 2- save User first User userDB = new User(); userDB.MobileNumber = doctorDTO.MobileNumber; userDB.Password = doctorDTO.Password; userDB.CountryCode = doctorDTO.CountryCode; userDB.UserType = "DOCTOR"; entities.Users.Add(userDB); entities.SaveChanges(); // 2- save Doctor Doctor doctorDB = Mapper.Map <Doctor>(doctorDTO); doctorDB.ValidUpto = null; doctorDB.UserID = userDB.ID; entities.Doctors.Add(doctorDB); entities.SaveChanges(); doctorDTO.ID = doctorDB.ID; //generate SMS and save it to the db UserSMS.DoctorSMS(doctorDTO); // 4- check if clinicDto exsist; then save clinic as well if (doctorDTO.ClinicDTO != null && !String.IsNullOrEmpty(doctorDTO.ClinicDTO.Name)) { doctorDTO.ClinicDTO.Name = textInfo.ToTitleCase(doctorDTO.ClinicDTO.Name); doctorDTO.ClinicDTO.DoctorID = doctorDB.ID; Clinic clinicDB = Mapper.Map <Clinic>(doctorDTO.ClinicDTO); entities.Clinics.Add(clinicDB); entities.SaveChanges(); doctorDTO.ClinicDTO.ID = clinicDB.ID; } } return(new Response <DoctorDTO>(true, null, doctorDTO)); } catch (Exception ex) { return(new Response <DoctorDTO>(false, GetMessageFromExceptionObject(ex), null)); } }
public void EditDoctor(DoctorDTO doctorDTO) { Doctor doctor = Database.Doctors.Find(x => x.DoctorId == doctorDTO.DoctorId).FirstOrDefault(); if (doctor != null) { doctor = MapperUtil.UpdateDoctorFieldsFromDTO(doctor, doctorDTO); Database.Doctors.Update(doctor); Database.Save(); } }
public int insertCoreDoctor(DoctorDTO newDoctor) { int flagInsert = new DOCTORTableAdapter().insertDoctorQuery( newDoctor.IdSpecialist, newDoctor.IdPassport, newDoctor.FullName, newDoctor.IsGeneral ); return(flagInsert); }