private bool isDoctorResposableForAppointment(DoctorUser doctor, DoctorAppointment appointment) { if (appointment.doctor.id.ToString().Equals(doctor.id.ToString())) { return(true); } return(false); }
public ActionResult CancelBooking(int?id) { DoctorAppointment DoctorAppointment = db.DoctorApointments.Find(id); DoctorAppointment.Confirmed = false; db.SaveChanges(); return(RedirectToAction("Bookings")); }
/// <summary> This method is calling <c>AppointmentRepository</c> to create new appointment. </summary> /// <param name="appointment"><c>appointment</c> is appointment we want to create.</param> /// <returns> Created appointment. </returns> public void New(DoctorAppointment appointment, Operation operation) { if (!GetAllAvailableAppointmentsForDate(appointment.Date, appointment.DoctorUserId, appointment.PatientUserId).Contains(appointment)) { return; } _appointmentRepository.New(appointment); }
public ActionResult DeleteConfirmed(int id) { DoctorAppointment doctorAppointment = db.DoctorAppointments.Find(id); db.DoctorAppointments.Remove(doctorAppointment); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Create_Appointment() { RegularAppointmentService service = new RegularAppointmentService(CreateAppointmentStubRepository(), CreateScheduleStubRepository(), new DoctorService(CreateOperationStubRepository(), CreateAppointmentStubRepository(), CreateScheduleStubRepository(), CreateDoctorStubRepository()), CreatePatientStubRepository(), new OperationService(CreateOperationStubRepository())); DoctorAppointment appointment = service.CreateRecommended(new DoctorAppointment(7, new TimeSpan(0, 14, 0, 0, 0), "07/03/2020", new PatientUser(), new DoctorUser(1, "TestDoctorName1", "TestDoctorNameSurname1", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1")); appointment.ShouldNotBeNull(); }
public AppointmentEditViewModel(DoctorAppointment doctorAppointment) { this.doctorAppointment = doctorAppointment ?? default; Date = doctorAppointment.Date; INR = doctorAppointment.INR; DatabaseManager = DatabaseManager.Instance; }
public DoctorAppointment CreateRegular(DoctorAppointment appointment) { var appointments = GetAllAvailableAppointmentsForDate(appointment.Date, appointment.DoctorUserId, appointment.PatientUserId); if (!appointments.Contains(appointment)) { return(null); } return(_appointmentRepository.New(appointment)); }
private static IAppointmentRepository CreateAppointmentStubRepository() { var stubRepository = new Mock <IAppointmentRepository>(); DoctorAppointment appointment7 = new DoctorAppointment(7, new TimeSpan(0, 14, 0, 0, 0), "07/03/2020", 1, 1, new List <Referral>(), "1"); stubRepository.Setup(m => m.New(It.IsAny <DoctorAppointment>())).Returns(appointment7); return(stubRepository.Object); }
public IActionResult Post(DoctorAppointment appointment) { DoctorAppointment doctorAppointment = this.regularAppointmentService.CreateRegular(appointment); if (doctorAppointment == null) { return(BadRequest()); } return(Ok(doctorAppointment)); }
public IActionResult CancelAppointment(int appointmentId) { DoctorAppointment appointment = this.regularAppointmentService.CancelAppointment(appointmentId); if (appointment == null) { return(BadRequest()); } return(Ok(appointment)); }
public void Create_Appointment() { RegularAppointmentService service = new RegularAppointmentService(CreateAppointmentStubRepository(), new OperationService(CreateOperationStubRepository())); DateTime dt = DateTime.Now.AddDays(10); String date = dt.ToString("dd/MM/yyyy"); DoctorAppointment appointment = service.CreateRecommended(new DoctorAppointment(8, new TimeSpan(0, 14, 0, 0, 0), date, 1, 1, new List <Referral>(), "1")); appointment.ShouldNotBeNull(); }
public ActionResult UpdateBooking(int doctorId, int bookingID, string bookingDateTime, string comments) { DoctorAppointment DoctorAppointment = db.DoctorApointments.Find(bookingID); DoctorAppointment.DoctorID = doctorId; DoctorAppointment.BookingDateTime = Convert.ToDateTime(bookingDateTime); DoctorAppointment.PatientComments = comments; DoctorAppointment.Confirmed = false; db.SaveChanges(); return(RedirectToAction("Bookings")); }
private static void GetPatients(Dictionary <int, int> dict, DoctorAppointment appointment) { if (dict.ContainsKey(appointment.PatientUserId)) { dict[appointment.PatientUserId]++; } else { dict[appointment.PatientUserId] = 1; } }
public DoctorAppointmentViewModel(DoctorAppointment doctorAppointmentOpen) { loginCurrent = new vwLoginCurrent(); appointment = new vwDoctorAppointment(); doctorAppointment = doctorAppointmentOpen; using (Service1Client wcf = new Service1Client()) { PatientsList = wcf.GetAllPatients().ToList(); MedicalDepartmentsList = wcf.GetAllMedicalDepartments().ToList(); } }
public async Task <IActionResult> Create([Bind("Id,ApptDate,MedicalProviderId,ReasonForVisit,SymptomComplaint,FacilityName,Phone,Fax,Email,Comments,RemindMe")] DoctorAppointment doctorAppointment) { if (ModelState.IsValid) { _context.Add(doctorAppointment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(doctorAppointment)); }
public ActionResult Edit([Bind(Include = "doctorAppointmentId,docLastName,doctorId,patientId")] DoctorAppointment doctorAppointment) { if (ModelState.IsValid) { db.Entry(doctorAppointment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.doctorId = new SelectList(db.Doctors, "doctorId", "docLastName", doctorAppointment.doctorId); ViewBag.patientId = new SelectList(db.Patients, "patientId", "patientLastName", doctorAppointment.patientId); return(View(doctorAppointment)); }
private static IAppointmentRepository CreateAppointmentStubRepository() { var stubRepository = new Mock <IAppointmentRepository>(); var patientAppointments = new List <DoctorAppointment>(); var doctorAppointments1 = new List <DoctorAppointment>(); var doctorAppointments2 = new List <DoctorAppointment>(); var doctorAppointments3 = new List <DoctorAppointment>(); Referral referral1 = new Referral(1, "Medicine", "Take medicine until", 3, "classify", "comment", 1); Referral referral2 = new Referral(2, "Medicine2", "Take medicine until", 3, "Appointment", "comment", 1); var referrals = new List <Referral>(); referrals.Add(referral1); referrals.Add(referral1); DoctorAppointment appointment1 = new DoctorAppointment(1, new TimeSpan(0, 14, 15, 0, 0), "03/03/2020", new PatientUser(), new DoctorUser(1, "TestDoctorName1", "TestDoctorNameSurname1", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(2, new TimeSpan(0, 14, 30, 0, 0), "03/03/2020", new PatientUser(), new DoctorUser(2, "TestDoctorName2", "TestDoctorNameSurname2", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment3 = new DoctorAppointment(3, new TimeSpan(0, 15, 0, 0, 0), "03/03/2020", new PatientUser(), new DoctorUser(2, "TestDoctorName2", "TestDoctorNameSurname2", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment4 = new DoctorAppointment(4, new TimeSpan(0, 15, 45, 0, 0), "03/03/2020", new PatientUser(), new DoctorUser(2, "TestDoctorName2", "TestDoctorNameSurname2", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment5 = new DoctorAppointment(5, new TimeSpan(0, 12, 0, 0, 0), "02/02/2020", new PatientUser(), new DoctorUser(1, "TestDoctorName1", "TestDoctorNameSurname1", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment6 = new DoctorAppointment(6, new TimeSpan(0, 12, 15, 0, 0), "02/02/2020", new PatientUser(), new DoctorUser(3, "TestDoctorName3", "TestDoctorNameSurname3", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); DoctorAppointment appointment7 = new DoctorAppointment(7, new TimeSpan(0, 14, 0, 0, 0), "07/03/2020", new PatientUser(), new DoctorUser(1, "TestDoctorName1", "TestDoctorNameSurname1", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"), new List <Referral>(), "1"); patientAppointments.Add(appointment1); doctorAppointments1.Add(appointment1); patientAppointments.Add(appointment2); doctorAppointments2.Add(appointment2); doctorAppointments2.Add(appointment3); doctorAppointments2.Add(appointment4); doctorAppointments1.Add(appointment5); doctorAppointments3.Add(appointment6); patientAppointments.Add(appointment6); patientAppointments.Add(appointment7); doctorAppointments1.Add(appointment7); stubRepository.Setup(m => m.GetAppointmentsForPatient(2)).Returns(patientAppointments); stubRepository.Setup(m => m.GetAppointmentsForDoctor(1)).Returns(doctorAppointments1); stubRepository.Setup(m => m.GetAppointmentsForDoctor(2)).Returns(doctorAppointments2); stubRepository.Setup(m => m.GetAppointmentsForDoctor(3)).Returns(doctorAppointments3); stubRepository.Setup(m => m.Create(It.IsAny <DoctorAppointment>())).Returns(appointment7); return(stubRepository.Object); }
private void DoctorAppointmentExecute() { try { DoctorAppointment doctorAppointmentWindow = new DoctorAppointment(); patientChoice.Close(); doctorAppointmentWindow.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private Boolean compareTimeForAppointment(TimeSpan time, DoctorAppointment appointment) { TimeSpan durationOfAppointment = TimeSpan.FromMinutes(15); TimeSpan endTime = appointment.time.Add(durationOfAppointment); int areSelectedAndAppointmentTimeEqual = TimeSpan.Compare(time, appointment.time); int areSelectedAndEndTimeEqual = TimeSpan.Compare(time, endTime); if ((areSelectedAndAppointmentTimeEqual == 1 && areSelectedAndEndTimeEqual == -1) || areSelectedAndAppointmentTimeEqual == 0) { return(true); } return(false); }
private void DoctorAppointmentExecute() { try { DoctorAppointment view = new DoctorAppointment(); medicalDeparmentsViewByPatient.Close(); view.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public bool checkIfDoctorIsBusyForAppointment(DoctorAppointment appointment, TimeSpan selectedTime) { TimeSpan durationOfAppointment = TimeSpan.FromMinutes(15); TimeSpan scheduledEndTime = appointment.Start.Add(durationOfAppointment); int areSelectedAndAppointmentTimeEqual = TimeSpan.Compare(selectedTime, appointment.Start); int areSelectedAndScheduledEndTimeEqual = TimeSpan.Compare(selectedTime, scheduledEndTime); if ((areSelectedAndAppointmentTimeEqual == 1 && areSelectedAndScheduledEndTimeEqual == -1) || areSelectedAndAppointmentTimeEqual == 0) { return(true); } return(false); }
// GET: DoctorAppointments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorAppointment doctorAppointment = db.DoctorAppointments.Find(id); if (doctorAppointment == null) { return(HttpNotFound()); } return(View(doctorAppointment)); }
public static List <Appointment> ShowAppointment(DoctorAppointment value) { Console.WriteLine("Show Appointment start"); var connString = "mongodb://127.0.0.1:27017"; MongoClient client = new MongoClient(connString); var db = client.GetDatabase("dataPSTL"); var collection = db.GetCollection <Appointment>("Appointment"); var firstFilter = Builders <Appointment> .Filter.Eq("idDoctor", value.userId); var cursor = collection.Find(firstFilter); return(cursor.ToList()); }
private static IAppointmentRepository CreateStubRepository() { var stubRepository = new Mock <IAppointmentRepository>(); var appointments = new List <DoctorAppointment>(); DoctorAppointment doctorAppointment1 = new DoctorAppointment(1, new TimeSpan(), "22/04/2020", 2, 1, new List <Referral>(), "1"); DoctorAppointment doctorAppointment2 = new DoctorAppointment(2, new TimeSpan(), "07/01/2020", 2, 2, new List <Referral>(), "1"); appointments.Add(doctorAppointment1); appointments.Add(doctorAppointment2); stubRepository.Setup(m => m.GetAppointmentsForPatient(2)).Returns(appointments); return(stubRepository.Object); }
// GET: DoctorAppointments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorAppointment doctorAppointment = db.DoctorAppointments.Find(id); if (doctorAppointment == null) { return(HttpNotFound()); } ViewBag.doctorId = new SelectList(db.Doctors, "doctorId", "docLastName", doctorAppointment.doctorId); ViewBag.patientId = new SelectList(db.Patients, "patientId", "patientLastName", doctorAppointment.patientId); return(View(doctorAppointment)); }
//public DoctorAppointmentClass(AddEditAppointment appointmentAddEdit, AppointmentBase ap) :base(appointmentAddEdit,ap) //{ // _frm.PopulateDoctors(); // _frm.cmbSpecialistId.SelectedValue = ((DoctorAppointment)_ap).Doctor.PersonId; // _frm.cmbResidentId.SelectedValue = _ap.Student.PersonId; // _frm.cmbStaffAccompanyingId.SelectedValue = _ap.StaffAccompanying.PersonId; // _frm.cmbKeyCode.SelectedText = ((DoctorAppointment)_ap).KeyCode; // _frm.cmbAddSpecialist.Enabled = true; // _frm.cmbKeyCode.Enabled = true; // base.AddIndexChangedEvent(); //} public DoctorAppointmentClass(AddEditAppointment appointmentAddEdit) : base(appointmentAddEdit) { _frm.cmbSpecialistId.SelectedIndexChanged -= _frm.cmbSpecialistId_SelectedIndexChanged; _frm.cmbAppointmentType.SelectedValue = _frm._appointmentBase.ProfessionalServiceProviderTypeId; _frm.PopulateDoctors(); DoctorAppointment ap = (DoctorAppointment)_frm._appointmentBase; //if(ap.Doctor !=null) _frm.cmbSpecialistId.SelectedValue = ap.Doctor.PersonId; _frm.cmbKeyCode.Text = ap.KeyCode; base.setComboBoxValues(); //_frm.cmbAddSpecialist.Enabled = true; _frm.cmbKeyCode.Enabled = true; _frm.lblHeader.Text = "Edit Appointment"; _frm.Text = "Edit Appointment"; _frm.cmbSpecialistId.SelectedIndexChanged += _frm.cmbSpecialistId_SelectedIndexChanged; //_frm.cmbKeyCode.SelectedIndex = -1; }
public void cmbAppointmentType_SelectedIndexChanged(object sender, EventArgs e) { AppointmentBase ap; if (cmbAppointmentType.SelectedIndex == 0) { ap = new DoctorAppointment(); _appointmentClassBase = new NewDoctorAppointmentClass(this); } else { ap = new SpecialistAppointment(); _appointmentBase.ProfessionalServiceProviderTypeId = (int)cmbAppointmentType.SelectedValue; _appointmentClassBase = new NewSpecialistAppointmentClass(this); } CommonFunctions.TransferPropertyValues(_appointmentBase, ap); _appointmentBase = ap; //_appointmentBase.ProfessionalServiceProviderTypeId = (int)cmbAppointmentType.SelectedValue; }
public ActionResult Delete(int?id) { string userID = User.Identity.GetUserId(); if (string.IsNullOrEmpty(userID)) { return(RedirectToAction("Login", "Account")); } else { SqlParameter[] sqlparams = new SqlParameter[2]; Patient patient = db.Patients.SqlQuery("select * from Patients where UserId = @id", new SqlParameter("@id", userID)).FirstOrDefault(); sqlparams[0] = new SqlParameter("@patient_id", patient.PatientID); sqlparams[1] = new SqlParameter("@booking_id", id); string query = "select * from DoctorAppointments where BookingID = @booking_id AND PatientID = @patient_id"; DoctorAppointment booking = db.DoctorApointments.SqlQuery(query, sqlparams).FirstOrDefault(); return(View(booking)); } }
public async Task <IActionResult> Appointment([FromBody] DoctorAppointment appointment) { // type must be appointment, timestamp must be now, ignore/override any values posted in appointment.Type = "appointment"; appointment.Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); var key = Guid.NewGuid().ToString(); var result = await _bucket.InsertAsync(new Document <DoctorAppointment> { Id = key, Content = appointment }); if (result.Success) { return(Ok(appointment)); } return(CouchbaseError(result)); }
public ActionResult ViewAppointments() { var memId = Convert.ToInt32(Session["MemberId"]); ClASDBEntities db = new ClASDBEntities(); var currentPat = db.Patients.FirstOrDefault(m => m.MemberID == memId); List <PatientModel> lst = new List <PatientModel>(); DoctorAppointment obj = new DoctorAppointment(); var getdata = (from m in db.DoctorAppointments join t in db.Doctors on m.DoctorId equals t.DoctorId where (currentPat.PatientID == m.PatientId) select new { m.AppointmentDate, m.DoctorId, m.Subject, m.Description, m.AppointmentStatus, m.PatientId, t.FirstName }); foreach (var item in getdata) { lst.Add(new PatientModel { DoctorId = item.DoctorId, PatientId = item.PatientId, AppointDate = item.AppointmentDate, AppointSub = item.Subject, AppointDesc = item.Description, AppointStatus = item.AppointmentStatus, DoctorName = item.FirstName }); } PatientModel pm = new PatientModel(); pm.ListApp = lst; return(View(pm)); }