Esempio n. 1
0
        private void ButtonNextAddRental_Click(object sender, EventArgs e)
        {
            try
            {
                _rentalController.SetAddRentalData(_customer, _employee,
                                                   dateTimePickerStartDateAddRental.Value, dateTimePickerEndDateAddRental.Value,
                                                   (int)numericUpDownDurationAddRental.Value);

                _rentalController.CheckRentalDuration((int)numericUpDownDurationAddRental.Value);

                DateTime startdate = dateTimePickerStartDateAddRental.Value;
                DateTime endDate   = dateTimePickerEndDateAddRental.Value;

                SelectLockerForm selectLockerForm = new SelectLockerForm(startdate, endDate);
                selectLockerForm.ShowDialog();

                if (!selectLockerForm.IsSelected())
                {
                    return;
                }

                _rentalController.SetAddRentalLockerData(selectLockerForm.SelectedLocker);

                // Get data of the selected locker
                _locker     = selectLockerForm.SelectedLocker;
                _cabinet    = Cabinet.Get(_locker.CabinetId);
                _lockerType = LockerType.Get(_cabinet.LockerTypeId);

                PayRentalLoadRentalData();

                // Show Pay Rental
                this.Controls.Remove(panelAddRental);
                this.Controls.Add(panelPayRental);

                // Hide OK button and show only Confrim Button
                buttonOKPayRental.Hide();
            }
            catch (InvalidUserInputException exception)
            {
                exception.ShowErrorMessage();
            }
        }