Exemple #1
0
 public void ReturnFormular(Formular frm)
 {
     frm.BookLink.RemoveFormular(frm);
     frm.ReaderLink.RemoveFormular(frm);
     linkedFC.RemoveFormular(frm);
     OnChangingBookList?.Invoke(null, null);
     OnChangingTicket?.Invoke(null, null);
 }
Exemple #2
0
        private void buttonReturnBook_Click(object sender, EventArgs e)
        {
            if (selectedFormularItemIndex < 0)
            {
                notify("Чтобы отметить возврат книги, вам необходимо выбрать книгу.");
                return;
            }
            Formular frm = selectedTicket.FormularsHave[selectedFormularItemIndex];

            linkedModel.ReturnFormular(frm);
            notify("Книга возвращена в библиотеку.");
        }
Exemple #3
0
        public void AddFormular(Book b, ReadersTicket rt)
        {
            if (b.FreeExemplarsCount == 0)
            {
                throw new ReturningException("У этой книги больше нет свободных экземпляров.");
            }
            if (rt.Quote == 0)
            {
                throw new ReturningException("У этого читателя закончилась квота, он не может брать больше книг.");
            }
            Formular frm = new Formular(b, rt, DateTime.Now, rt.GiveDays);

            linkedFC.AddFormular(frm);
            b.AddFormular(frm);
            rt.AddFormular(frm);
            OnChangingBookList?.Invoke(null, null);
            OnChangingTicket?.Invoke(null, null);
        }
Exemple #4
0
 private void buildFormularsFromData()
 {
     foreach (Tuple <int, int, DateTime> tup in linkedFC.LoadDataFromFile(filenameFormulars))
     {
         Book b = linkedBC.GetBookByID(tup.Item1);
         if (b == null)
         {
             throw new WrongIDException("Loading formulars: no such book in catalog", tup.Item1);
         }
         ReadersTicket rt = linkedTC.GetTicketByID(tup.Item2);
         if (rt == null)
         {
             throw new WrongIDException("Loading formulars: no such ticket in catalog", tup.Item2);
         }
         Formular frm = new Formular(b, rt, tup.Item3);
         b.AddFormular(frm);
         rt.AddFormular(frm);
         linkedFC.AddFormular(frm);
     }
 }
Exemple #5
0
 public void RemoveFormular(Formular frm)
 {
     formularList.Remove(frm);
 }
Exemple #6
0
 public void AddFormular(Formular frm)
 {
     formularList.Add(frm);
 }
Exemple #7
0
 public void RemoveFormular(Formular takenFormular)
 {
     FormularsHave.Remove(takenFormular);
     Quote++;
 }
Exemple #8
0
 public void AddFormular(Formular frm)
 {
     FormularsHave.Add(frm);
     Quote--;
 }