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

            linkedModel.ReturnFormular(frm);
            notify("Книга возвращена в библиотеку.");
        }
示例#3
0
文件: Model.cs 项目: anastasiamva/ddd
        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);
        }
示例#4
0
文件: Model.cs 项目: anastasiamva/ddd
 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);
     }
 }
示例#5
0
 public void RemoveFormular(Formular frm)
 {
     formularList.Remove(frm);
 }
示例#6
0
 public void AddFormular(Formular frm)
 {
     formularList.Add(frm);
 }
示例#7
0
 public void RemoveFormular(Formular takenFormular)
 {
     FormularsHave.Remove(takenFormular);
     Quote++;
 }
示例#8
0
 public void AddFormular(Formular frm)
 {
     FormularsHave.Add(frm);
     Quote--;
 }