Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
            {
                MessageBox.Show("Proszę wybrać pojazd z listy dostępnych!");
                return;
            }

            if (!checkBox2.Checked)
            {
                MessageBox.Show("Potwiedź chęć zarezerwowania pojazdu!");
                return;
            }

            var newRes = new REZERWACJE();

            newRes.DataRez          = DateTime.Now;
            newRes.DataWypoz        = GetStartReservationTime();
            newRes.DataZwrotu       = GetEndReservationTime();
            newRes.KLIENCI_idKlient = _currentClient.idKlient;
            newRes.POJAZDY_idPojazd = (int)dataGridView1.SelectedRows[0].Cells["idPojazd"].Value;

            if (ReservationService.Add(newRes))
            {
                MessageBox.Show("Pomyślnie zarezerwowano pojazd.");
                TimeRangeChange(null, null);
            }
            else
            {
                MessageBox.Show("Błąd rezerwacji pojazdu!");
            }

            checkBox2.Checked = false;
        }
Beispiel #2
0
        private void ShowSelectedReservationOnEditScreen(int id)
        {
            var reservation = ReservationService.GetReservation(id);

            _currentEditReservation = reservation;
            ShowReservationOnDetailsScreen(_currentEditReservation);
            SzegolyRezerwacjiPanel.BringToFront();
        }
Beispiel #3
0
        private void ShowReservationOnDetailsScreen(REZERWACJE reservation)
        {
            //Podstawowe informacje
            textBox17.Text = reservation.DataRez.ToString();
            textBox32.Text = reservation.DataWypoz.ToString();
            textBox33.Text = reservation.DataZwrotu.ToString();
            textBox34.Text = reservation.DataZdania?.ToString();
            textBox35.Text = ReservationListGrid.GetTextStatus(reservation.Wypozycz);

            //Dane klienta
            groupBox10.Visible = false;
            textBox36.Text     = reservation.KLIENCI.Imie + " " + reservation.KLIENCI.Nazwisko;
            textBox37.Text     = reservation.KLIENCI.Plec == 0 ? "Mężczyzna" : "Kobieta";
            textBox38.Text     = reservation.KLIENCI.Adres;
            textBox39.Text     = reservation.KLIENCI.NrDowOsob;
            textBox40.Text     = reservation.KLIENCI.Telefon;
            textBox41.Text     = reservation.KLIENCI.Login;

            //Pojazd
            if (reservation.POJAZDY.ZDJECIA.Count > 0)
            {
                pictureBox11.Image = PhotoService.ByteArrayToImage(reservation.POJAZDY.ZDJECIA.First().Zdjecie);
            }
            else
            {
                pictureBox11.Image = Properties.Resources.no_car_image;
            }

            textBox42.Text    = VehicleListGrid.GetTextType(reservation.POJAZDY.Rodzaj);
            textBox43.Text    = reservation.POJAZDY.MARKI.Nazwa;
            textBox44.Text    = reservation.POJAZDY.Kolor;
            textBox45.Text    = reservation.POJAZDY.DataProd.ToString("d");
            textBox46.Text    = reservation.POJAZDY.Przebieg.ToString() + " km";
            textBox47.Text    = reservation.POJAZDY.ZaGodz.ToString("C");
            richTextBox3.Text = reservation.POJAZDY.Opis;

            //Opinie
            comboBox2.SelectedIndex = 0;
            richTextBox2.Text       = "";
            var isNoOpinion = reservation.OPINIA.Count == 0 && reservation.Wypozycz == 2 ? true : false;

            button1.Enabled      = isNoOpinion;
            richTextBox4.Enabled = isNoOpinion;
            comboBox2.Enabled    = isNoOpinion;
            if (!isNoOpinion && reservation.OPINIA.Count > 0)
            {
                var opinia = reservation.OPINIA.First();
                richTextBox4.Text       = opinia.Opis;
                comboBox2.SelectedIndex = opinia.Ocena - 1;
            }

            //Realizacja
            textBox23.Text = reservation.PRACOWNICY?.ToString();
            textBox24.Text = reservation.PRACOWNICY1?.ToString();
        }
Beispiel #4
0
        private void LoadReservationOnDetailsScreen(REZERWACJE reservation)
        {
            //Podstawowe informacje
            textBox10.Text = reservation.DataRez.ToString("dd.MM.yyyy HH:mm");
            textBox32.Text = reservation.DataWypoz.ToString("dd.MM.yyyy HH:mm");
            textBox33.Text = reservation.DataZwrotu.ToString("dd.MM.yyyy HH:mm");
            textBox34.Text = reservation.DataZdania?.ToString("dd.MM.yyyy HH:mm");
            textBox35.Text = ReservationListGrid.GetTextStatus(reservation.Wypozycz);

            //Dane klienta
            textBox36.Text = reservation.KLIENCI.Imie + " " + reservation.KLIENCI.Nazwisko;
            textBox37.Text = reservation.KLIENCI.Plec == 0 ? "Mężczyzna" : "Kobieta";
            textBox38.Text = reservation.KLIENCI.Adres;
            textBox39.Text = reservation.KLIENCI.NrDowOsob;
            textBox40.Text = reservation.KLIENCI.Telefon;
            textBox41.Text = reservation.KLIENCI.Login;

            //Pojazd
            if (reservation.POJAZDY.ZDJECIA.Count > 0)
            {
                pictureBox11.Image = PhotoService.ByteArrayToImage(reservation.POJAZDY.ZDJECIA.First().Zdjecie);
            }
            else
            {
                pictureBox11.Image = Properties.Resources.no_car_image;
            }

            textBox42.Text    = VehicleListGrid.GetTextType(reservation.POJAZDY.Rodzaj);
            textBox43.Text    = reservation.POJAZDY.MARKI.Nazwa;
            textBox44.Text    = reservation.POJAZDY.Kolor;
            textBox45.Text    = reservation.POJAZDY.DataProd.ToString("d");
            textBox46.Text    = reservation.POJAZDY.Przebieg.ToString() + " km";
            textBox47.Text    = reservation.POJAZDY.ZaGodz.ToString("C");
            richTextBox3.Text = reservation.POJAZDY.Opis;

            //Wydaj
            textBox50.Text            = DateTime.Now.ToString("dd.MM.yyyy HH:mm");
            checkBox6.Enabled         = reservation.Wypozycz == 0 ? true : false;
            checkBox6.Checked         = false;
            wydajPojazdButton.Enabled = reservation.Wypozycz == 0 ? true : false;

            //Odbierz
            textBox49.Text              = DateTime.Now.ToString("dd.MM.yyyy HH:mm");
            checkBox3.Enabled           = reservation.Wypozycz == 1 ? true : false;
            checkBox3.Checked           = false;
            odbierzPojazdButton.Enabled = reservation.Wypozycz == 1 ? true : false;
        }