示例#1
0
        private void Submit(object sender, RoutedEventArgs e)
        {
            Button sent = sender as Button;

            if (((String)sent.Name).Equals("cancelButton"))
            {
                NavigationService.GoBack();
                return;
            }

            // only update a rental if it was found in the lookup
            if (rentalFound)
            {
                rental.CheckinTime     = DateTime.Now;
                rental.Resource.Status = Resource.ResourceStatus.RETURNED;

                rentals.updateSingle(rental);
                resources.updateSingle(rental.Resource);

                infoWindow = new InformationWindow("Item Checkin");
                infoWindow.setInfoText("Rental was successfully checked in.");

                infoWindow.ShowDialog();
            }

            NavigationService.GoBack();
        }
示例#2
0
        private void resourceId_LostFocus(object sender, RoutedEventArgs e)
        {
            TextBox       sent = sender as TextBox;
            int           id   = -1;
            List <Rental> checkedOut;

            if (sent.Text == "")
            {
                return;
            }

            if (!int.TryParse(sent.Text, out id))
            {
                //display error message
                return;
            }

            checkedOut = rentals.getRentalByResourceId(id);

            if (checkedOut == null || checkedOut.Count < 1)
            {
                infoWindow = new InformationWindow("Rental not found");

                infoWindow.setInfoText("A rental associated to the resource with id " +
                                       id + " was not found");

                infoWindow.ShowDialog();
                return;
            }

            rentalFound = true;

            rental           = checkedOut[0];
            renterName.Text  = rental.Renter.FullName;
            renterEmail.Text = rental.Renter.CpEmail;

            returnButton.Focus();
        }