Esempio n. 1
0
        private void btnShowResourceReservations_Click(object sender, EventArgs e)
        {
            BorrowedResources brform = new BorrowedResources();

            brform.Text = "Rezerwacje zasobu";
            List <Reservation> reservations = new List <Reservation>();

            Resource resource;

            if (lstViewBooksAndUsers.SelectedItems.Count > 0)
            {
                if (tagSet.TryGetValue(lstViewBooksAndUsers.SelectedItems[0].Tag.ToString(), out resource))
                {
                    reservations = dbContext.Reservations
                                   .Where(r => r.ResourceId == resource.Id)
                                   .Where(r => r.RealizationDate > DateTime.Now)
                                   .OrderBy(r => r.ReservationDate)
                                   .ToList();

                    foreach (Reservation res in reservations)
                    {
                        brform.addItem(res.Reader.User.Name + " " + res.Reader.User.Surname
                                       + " do " + res.RealizationDate.ToShortDateString());
                    }
                    brform.initialize();
                }
            }
            else
            {
                MessageBox.Show("Nie wybrano zasobu", "Błąd");
            }
        }
Esempio n. 2
0
        private void btnCheckBorrowedPositions_Click(object sender, EventArgs e)
        {
            BorrowedResources brform     = new BorrowedResources();
            List <Borrowing>  borrowings = dbContext.Borrowings
                                           .Where(b => b.ReaderId == userContext.Id)
                                           .Where(b => b.ReturnDate == null)
                                           .ToList();

            foreach (Borrowing bor in borrowings)
            {
                if (bor.Resource.Position is Game)
                {
                    brform.addItem(((Game)bor.Resource.Position).Name + " do " + bor.ReturnTerm.ToString());
                }
                else if (bor.Resource.Position is MagazineNumber)
                {
                    brform.addItem(((MagazineNumber)bor.Resource.Position).Magazine.Title + " do " + bor.ReturnTerm.ToString());
                }
                else if (bor.Resource.Position is BookEdition)
                {
                    brform.addItem(((BookEdition)bor.Resource.Position).Book.Title + " do " + bor.ReturnTerm.ToString());
                }
            }
            brform.initialize();
        }
Esempio n. 3
0
        private void btnShowApplications_Click(object sender, EventArgs e)
        {
            BorrowedResources brform = new BorrowedResources();

            brform.Text = "Złożone wnioski";
            List <ReaderApplication> applications = new List <ReaderApplication>();

            applications = dbContext.ReaderApplications
                           .Where(r => r.ReaderId == userContext.Id)
                           .OrderByDescending(r => r.ApplicationDate)
                           .ToList();

            foreach (ReaderApplication app in applications)
            {
                String status;
                switch (app.Status)
                {
                case "N":
                    status = "Nieobsłużony";
                    break;

                case "O":
                    status = "Odrzucony";
                    break;

                case "A":
                    status = "Zaakceptowany";
                    break;

                default:
                    status = "Nieobsłużony";
                    break;
                }
                brform.addItem(app.ApplicationDate.ToShortDateString() + " : " + status);
            }
            brform.initialize();
        }