예제 #1
0
        //New booking
        public BookingForm(Patient relevantpatient, Employee currentUser)
        {
            data = new Bookingdata(relevantpatient, currentUser, ROOMFUNCTION_MOTTAGNING);
            InitializeComponent();
            UpdateWindow();

            string patientName = data.ThePatient.LastName + ", " + data.ThePatient.FirstName;

            bookingPersonNrBox.Text     = data.ThePatient.Personnummer;
            bookingPatientName.Text     = patientName;
            startTime2.Text             = DateTime.Now.ToShortTimeString();
            endTime2.Value              = DateTime.Now.AddMinutes(15);
            roomComboBox.DataSource     = data.RoomList.Where(x => x.RoomFunction == ROOMFUNCTION_MOTTAGNING).ToList();
            doctorComboBox.DataSource   = data.DoctorList;
            testTypeComboBox.DataSource = data.TestTypeList;
            testTypeComboBox.Enabled    = false;
            TimeSpan depStartingHours        = new TimeSpan(8, 0, 0);
            TimeSpan depFinalAppointmentTime = new TimeSpan(16, 45, 0);
        }
예제 #2
0
        //Update booking
        public BookingForm(Booking booking)
        {
            DatabaseHandler db              = new DatabaseHandler();
            Employee        selectedDr      = db.LoadEmployee(booking.Staff_ID);
            Patient         relevantpatient = db.LoadPatient(booking.Patient_ID);

            data = new Bookingdata(relevantpatient, selectedDr, ROOMFUNCTION_MOTTAGNING);
            InitializeComponent();
            UpdateWindow();

            booking_id = booking.BookingID;
            this.bookingPersonNrBox.Text = booking.Patient_ID;
            this.bookingPatientName.Text = relevantpatient.LastName + ", " + relevantpatient.FirstName;
            this.dateTimePicker1.Value   = booking.BookingStart.Date;
            this.startTime2.Value        = booking.BookingStart;
            this.endTime2.Value          = booking.BookingEnd;
            this.purposeBox.Text         = booking.BookingPurpose;
            this.roomComboBox.DataSource = data.RoomList;
            //roomComboBox.SelectedIndex = data.RoomList.IndexOf(data.RoomList.FirstOrDefault(x => x.RoomID == booking.RoomNr));
            roomComboBox.SelectedItem      = data.RoomList.FirstOrDefault(x => x.RoomID == booking.RoomNr);
            this.doctorComboBox.DataSource = data.DoctorList;
            doctorComboBox.SelectedItem    = data.DoctorList.FirstOrDefault(x => x.EmployeeID == booking.Staff_ID);
        }