Пример #1
0
        private void populatePatients()
        {
            Stack <Patient> patients = DbAdapter.getPatients();

            this.patientsTable = new DataTable();
            patientsTable.Columns.Add(new DataColumn("Id"));
            patientsTable.Columns.Add(new DataColumn("Imie"));
            patientsTable.Columns.Add(new DataColumn("Nazwisko"));
            patientsTable.Columns.Add(new DataColumn("Choroba"));
            patientsTable.Columns.Add(new DataColumn("Czy zakaźna?"));


            foreach (var patient in patients)
            {
                patientsTable.Rows.Add(
                    patient.id,
                    patient.name,
                    patient.surname,
                    patient.illness,
                    patient.infectious
                    );
            }

            dataGridViewPatients.DataSource          = this.patientsTable;
            dataGridViewPatients.ReadOnly            = true;
            dataGridViewPatients.AutoGenerateColumns = true;
            dataGridViewPatients.AutoResizeColumns();
            dataGridViewPatients.Refresh();
        }
Пример #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                var newReservation = new Reservation(
                    null,
                    this.dataGridViewPatientRooms.SelectedRows[0].Cells[0].Value.ToString(),
                    this.dataGridViewPatientRooms.SelectedRows[0].Cells[1].Value.ToString(),
                    this.dataGridViewPatientRooms.SelectedRows[0].Cells[2].Value.ToString(),
                    this.dataGridViewPatients.SelectedRows[0].Cells[0].Value.ToString(),
                    this.dataGridViewPatients.SelectedRows[0].Cells[1].Value.ToString(),
                    this.dataGridViewPatients.SelectedRows[0].Cells[2].Value.ToString(),
                    this.dataGridViewPatients.SelectedRows[0].Cells[3].Value.ToString(),
                    this.dateTimePickerCheckInDate.Value.ToString(),
                    this.dateTimePickerCheckOutDate.Value.ToString());


                DialogResult dialogResult = MessageBox.Show("Czy na pewno chcesz dodać rezerwację z następującymi danymi? \n \n" + newReservation.ToString(), "Dodawanie rezerwacji", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    DbAdapter.addReservation(newReservation);
                    Navigator.navigateToChild(new PatientRoomReservations(), this);
                }
                else if (dialogResult == DialogResult.No)
                {
                    // nothing
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Wystąpił błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void ReservePatientRoom_Load(object sender, EventArgs e)
        {
            this.populatePatientRooms();
            this.populatePatients();
            var equipement = DbAdapter.getEquipement();

            foreach (var eq in equipement)
            {
                this.checkedListBoxEquipment.Items.Add(eq);
            }
            this.populateAutoComplete(this.patientsTable, new List <TextBox>()
            {
                this.textBoxId, this.textBoxFirstName, this.textBoxSurname, this.textBoxIllness
            });
            this.populateAutoComplete(this.roomsTable, new List <TextBox>()
            {
                this.textBoxRoomNr, this.textBoxDepartment
            });


            this.populateRoomsOccupancy();
            this.dateTimePickerCheckInDate.Value  = System.DateTime.Now;
            this.dateTimePickerCheckOutDate.Value = DateTime.Now;

            this.dateTimePickerCheckInDate.MinDate  = DateTime.Now;
            this.dateTimePickerCheckOutDate.MinDate = DateTime.Now;
            this.buttonSave.Enabled = false;
            this.Refresh();
        }
Пример #4
0
        private void populateRoomsOccupancy()
        {
            Stack <RoomOccupancyDTO> roomsOccupancy = DbAdapter.getPatientRoomsOccupancy(
                this.dateTimePickerCheckInDate.Value,
                this.dateTimePickerCheckOutDate.Value);

            this.roomsOccupancyTable = new DataTable();
            this.roomsOccupancyTable.Columns.Add(new DataColumn("Numer sali"));
            this.roomsOccupancyTable.Columns.Add(new DataColumn("Oddział"));
            this.roomsOccupancyTable.Columns.Add(new DataColumn("Budynek"));
            this.roomsOccupancyTable.Columns.Add(new DataColumn("Rezerwacja od"));
            this.roomsOccupancyTable.Columns.Add(new DataColumn("Rezerwacja do"));


            foreach (var roomOccupancy in roomsOccupancy)
            {
                this.roomsOccupancyTable.Rows.Add(
                    roomOccupancy.room_number,
                    roomOccupancy.department,
                    roomOccupancy.building,
                    roomOccupancy.date_from,
                    roomOccupancy.date_to
                    );
            }
        }
Пример #5
0
        private void populatePatientRooms()
        {
            Stack <PatientRoom> rooms = DbAdapter.getPatientRooms();

            this.roomsTable = new DataTable();
            this.roomsTable.Columns.Add(new DataColumn("Numer sali"));
            this.roomsTable.Columns.Add(new DataColumn("Oddział"));
            this.roomsTable.Columns.Add(new DataColumn("Budynek"));
            this.roomsTable.Columns.Add(new DataColumn("Sprzęt"));


            foreach (var room in rooms)
            {
                roomsTable.Rows.Add(
                    room.room_number,
                    room.department,
                    room.building,
                    null
                    );
            }

            // Filter table with data



            dataGridViewPatientRooms.DataSource          = this.roomsTable;
            dataGridViewPatientRooms.ReadOnly            = true;
            dataGridViewPatientRooms.AutoGenerateColumns = true;
            dataGridViewPatientRooms.AutoResizeColumns();
            dataGridViewPatientRooms.Refresh();
        }
Пример #6
0
        public ReserveIsolationRoom()
        {
            InitializeComponent();
            var equipement = DbAdapter.getEquipement();

            foreach (var eq in equipement)
            {
                this.checkedListBox1.Items.Add(eq);
            }
        }
Пример #7
0
        public static int login(string login, string haslo)
        {
            try
            {
                currentUser = DbAdapter.getUser(login, haslo);

                Console.WriteLine(currentUser.name);
                if (currentUser == null)
                {
                    // Nie znaleziono u¿ytkownika
                    return(0);
                }
                Navigator.navigateRoot();
                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Пример #8
0
        private void populateReservations()
        {
            Stack <Reservation> reservations = DbAdapter.getReservations();

            this.reservationsTable = new DataTable();
            reservationsTable.Columns.Add(new DataColumn("Numer Rezerwacji"));
            reservationsTable.Columns.Add(new DataColumn("Numer sali"));
            reservationsTable.Columns.Add(new DataColumn("Oddział"));
            reservationsTable.Columns.Add(new DataColumn("Budynek"));
            reservationsTable.Columns.Add(new DataColumn("Id pacjenta"));
            reservationsTable.Columns.Add(new DataColumn("Imie pacjenta"));
            reservationsTable.Columns.Add(new DataColumn("Nazwisko pacjenta"));
            reservationsTable.Columns.Add(new DataColumn("Choroba"));
            reservationsTable.Columns.Add(new DataColumn("Data od"));
            reservationsTable.Columns.Add(new DataColumn("Data do"));



            foreach (var reservation in reservations)
            {
                reservationsTable.Rows.Add(
                    reservation.reservation_id,
                    reservation.room_number,
                    reservation.department,
                    reservation.building,
                    reservation.sick_id,
                    reservation.name,
                    reservation.surname,
                    reservation.illness,
                    reservation.date_from.Replace(" 00:00:00", ""),
                    reservation.date_to.Replace(" 00:00:00", "")
                    );;
            }

            dataGridViewAllPatientRoomReservations.DataSource          = this.reservationsTable;
            dataGridViewAllPatientRoomReservations.ReadOnly            = true;
            dataGridViewAllPatientRoomReservations.AutoGenerateColumns = true;
            dataGridViewAllPatientRoomReservations.AutoResizeColumns();
            dataGridViewAllPatientRoomReservations.Refresh();
        }
Пример #9
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try {
                var          index        = dataGridViewAllPatientRoomReservations.SelectedRows[0].Cells[0].Value.ToString();
                DialogResult dialogResult = MessageBox.Show("Czy na pewno chcesz usunąć zaznaczoną rezerwację?", "Usuwanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.Yes)
                {
                    DbAdapter.deleteReservation(index);
                }
                else if (dialogResult == DialogResult.No)
                {
                }
            }
            catch (Exception eee)
            {
                Console.WriteLine(eee);
            }



            populateReservations();
        }