示例#1
0
        }//End verify ISBN method

        //Reads and writes up to line where ISBN is matched then skips write of that line and continues read and write to updatedBook file
        public void deleteBookFromFile(string ISBN)
        {
            isEndOfFile = false;
            currentBookFile.rewindFile();
            while (!isEndOfFile)
            {
                string readString = currentBookFile.getNextRecord(ref isEndOfFile);
                if (readString == null)
                {
                    break;
                }//End if
                Book = new BookClass();
                Book.createBookObject(readString);
                string[] tempArray = Book.returnBookAttributeArray();
                if (!Book.bookMatch(ISBN))
                {
                    updatedBookFile.writeNextRecord(readString);
                }//End if
                else
                {
                    readString = currentBookFile.getNextRecord(ref isEndOfFile);
                    updatedBookFile.writeNextRecord(readString);
                }//End else
            }//End while
            updatedBookFile.closeFile();
        }//End delete from book file method
示例#2
0
        private void btnSearchOK_Click(object sender, EventArgs e)
        {
            string    updatedBookFile = "updatedBookFile.txt";
            BookClass Book            = new BookClass();

            string[] bookKeywords;
            Book.keywordSplitter(txtKeywordSearch.Text, out bookKeywords);

            string[] readLines = File.ReadAllLines(updatedBookFile);
            Boolean  success   = false;

            for (int i = 0; i < readLines.Length; i++)
            {
                foreach (string element in bookKeywords)
                {
                    if (readLines[i].Contains(element))
                    {
                        MessageBox.Show(readLines[i], "We have found a book with your keyword!");
                        success = true;
                        break;
                    }
                }
            }
            if (success == false)
            {
                MessageBox.Show("We did not find your book with the entered keyword.", "Book Not Found");
            }
            txtKeywordSearch.Text = "";
            txtKeywordSearch.Focus();
        }
示例#3
0
 public ActionResult Create(string bookTitle, string bookAuthor)
 {
     if (BookClass.CheckBookExistByTitle(bookTitle) == false && AuthorClass.CheckAuthorExistByName(bookAuthor) == false)
     {
         BookClass.Save(bookTitle);
         AuthorClass.Save(bookAuthor);
         int bookId   = BookClass.GetBookByTitle(bookTitle).GetId();
         int authorId = (AuthorClass.GetAuthorByName(bookAuthor)).GetId();
         JoinBookAuthorClass.Save(authorId, bookId);
         int initial = 1;
         CopiesClass.Save(bookId, initial, initial);
         return(RedirectToAction("New"));
     }
     else if (BookClass.CheckBookExistByTitle(bookTitle) == true && AuthorClass.CheckAuthorExistByName(bookAuthor) == true)
     {
         int bookId      = BookClass.GetBookByTitle(bookTitle).GetId();
         int amount      = CopiesClass.GetAmountByBookId(bookId);
         int totalAmount = CopiesClass.GetTotalByBookId(bookId);
         totalAmount++;
         amount++;
         CopiesClass.Update(bookId, amount);
         CopiesClass.UpdateTotal(bookId, totalAmount);
         return(RedirectToAction("New"));
     }
     else
     {
         BookClass.Save(bookTitle);
         int bookId   = BookClass.GetBookByTitle(bookTitle).GetId();
         int authorId = (AuthorClass.GetAuthorByName(bookAuthor)).GetId();
         JoinBookAuthorClass.Save(authorId, bookId);
         int initial = 1;
         CopiesClass.Save(bookId, initial, initial);
         return(RedirectToAction("New"));
     }
 }
示例#4
0
        }   // end writeEntireEmploeeList

        //Compares ISBN input to ISBN from current book file
        public bool verifyISBN(string ISBN)
        {
            isEndOfFile = false;
            currentBookFile.rewindFile();
            while (!isEndOfFile)
            {
                string readString = currentBookFile.getNextRecord(ref isEndOfFile);
                if (readString == null)
                {
                    break;
                }//End if
                /*String[] tempArray = readString.Split('*');
                for (int i = 0; i < tempArray.Length; i++)
                {
                    string newString = tempArray[i].Trim();
                    tempArray[i] = newString;
                }
                */
                Book = new BookClass();
                Book.createBookObject(readString);
                //Book.createBookAttributes();
                string[] tempArray = Book.returnBookAttributeArray();

                if (tempArray[0].Equals(ISBN))
                {
                    return true;
                }//End if
            }//End while
            return false;
        }//End verify ISBN method
        private void OnNewContentCommandExecute()
        {
            BookClass bookClass = Books.FirstOrDefault(h => h.DateBook == Data);

            if (bookClass != null)
            {
                bookManager.Delete(bookClass);
                Books.Remove(bookClass);
                bookManager.Add(bookManager.Create(Headline, Content, Data, CategoryClassesList));
                bookManager.Save();
                Books.Clear();
                Books.Add(bookManager.Create(Headline, Content, Data, CategoryClassesList));
            }
            else
            {
                if (Content is null || Headline is null)
                {
                    return;
                }
                bookManager.Add(bookManager.Create(Headline, Content, Data, CategoryClassesList));
                bookManager.Save();
                Books.Clear();
                Books.Add(bookManager.Create(Headline, Content, Data, CategoryClassesList));
            }
        }
示例#6
0
        }//End delete from book file method

        //Reads and writes books to updatedBook File and creates a book class with the attribute changes then writes out that obj and the rest of the currentBook file
        public void modifyBookFromFile(string ISBN, string author, string title, decimal price, int onHand, DateTime date)
        {
            isEndOfFile = false;
            currentBookFile.rewindFile();
            while (!isEndOfFile)
            {
                string readString = currentBookFile.getNextRecord(ref isEndOfFile);
                if (readString == null)
                {
                    break;
                }//End if
                Book = new BookClass();
                Book.createBookObject(readString);
                string[] tempArray = Book.returnBookAttributeArray();
                if (!Book.bookMatch(ISBN))
                {
                    updatedBookFile.writeNextRecord(readString);
                }//End if
                else
                {
                    this.Book = new BookClass(ISBN, title, author, price, onHand, date);
                    updatedBookFile.writeNextRecord(this.Book.createBookWrite());
                    MessageBox.Show(this.Book.displayBookRecord(), "Updated Book Record");
                }//End else
            }//End while
            updatedBookFile.closeFile();
        }//End modify book from file method
示例#7
0
        public ActionResult Create(string patronName, string bookTitle)
        {
            int check = 1;

            if (BookClass.CheckBookExistByTitle(bookTitle) == false)
            {
                check = 0;
            }
            else
            {
                if (PatronClass.CheckPatronExistByName(patronName) == false)
                {
                    PatronClass.Save(patronName);
                    int bookId   = BookClass.GetBookByTitle(bookTitle).GetId();
                    int patronId = PatronClass.GetPatronIdByName(patronName);
                    JoinPatronBookClass.SavePatronCopy(patronId, bookId);
                    int amount = CopiesClass.GetAmountByBookId(bookId);
                    amount--;
                    CopiesClass.Update(bookId, amount);
                }
                else
                {
                    int bookId   = BookClass.GetBookByTitle(bookTitle).GetId();
                    int patronId = PatronClass.GetPatronIdByName(patronName);
                    JoinPatronBookClass.SavePatronCopy(patronId, bookId);
                    int amount = CopiesClass.GetAmountByBookId(bookId);
                    amount--;
                    CopiesClass.Update(bookId, amount);
                }
            }
            return(View("New", check));
        }
示例#8
0
        static void Main(string[] args)
        {
            #region Class Approach
            BookClass b1 = new BookClass("Test Book", "Bob");
            BookClass b2 = new BookClass("Test Book 2", "Bob");

            var json = JsonSerializer.Serialize(b1);

            var equals = b1 == b2;

            Console.WriteLine($"is Equal?{equals}");
            Console.WriteLine(json);

            var b3 = JsonSerializer.Deserialize <BookClass>(json);

            var secondEquals = b3 == b1;

            Console.WriteLine($"is second Equal?{secondEquals}");

            (string bookName, string authorName) = b1;

            #endregion

            #region Record Approach

            var b4 = new BookRecord("Test Book 3", "Bob");
            var b5 = new BookRecord("Test Book 4", "Bob");

            var json2 = JsonSerializer.Serialize(b4);

            Console.WriteLine(json2);

            var b6 = JsonSerializer.Deserialize <BookRecord>(json2);

            var seprateRecordEquality = b4 == b5; //False

            var recordEquality = b4 == b6;        //True

            var b7 = b4;

            b4.AuthorName = "Peter";

            var sameRecordChangeCheck = b7 == b4; //True


            b4 = b4 with {
                AuthorName = "Peter"
            };                                                   //Record immutability ! A New Record is

            (string authorNameTuple, string bookNameTuple) = b4; // Test Book 3 , Peter

            var immutabilityEquality = b6 == b4;                 //False

            Console.WriteLine(b4.ToString());                    // Test Book 3 , Peter

            #endregion
        }
    }
示例#9
0
 public Book(BookClass bookClass, string title, List <Author> author, string publisher, string dataOfPublication)
 {
     this.bookClass    = bookClass;
     Title             = title;
     Author            = author;
     Publisher         = publisher;
     DateOfPublication = dataOfPublication;
     ID = CorrelationIdGenerator.GetNextId();
 }
示例#10
0
 private void Delete_Library_Click(object sender, EventArgs e)
 {
     if (dgv_Library.Rows.Count > 0)
     {
         BookClass book = dgv_Library.Rows[0].Tag as BookClass;
         DbModel.init().Books.Remove(book);
         DbModel.init().SaveChanges();
         updatData();
     }
 }
示例#11
0
        public void Edit(BookClass entity)
        {
            Guid guid  = entity.Id;
            int  index = bookMemoryClass.collectionClasses.IndexOf(bookMemoryClass.collectionClasses.FirstOrDefault(c => c.Id == guid));

            bookMemoryClass.collectionClasses.RemoveAt(index);
            BookClass bookClassEdit = entity;

            bookMemoryClass.collectionClasses.Add(bookClassEdit);
        }
        public IHttpActionResult GetBookClass(int id)
        {
            BookClass bookclass = db.bookClass.FirstOrDefault(b => b.classID == id);

            if (bookclass == null)
            {
                return(NotFound());
            }

            return(Ok(bookclass));
        }
示例#13
0
        public ActionResult ShowAuthor(int id)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object> {
            };
            List <BookClass> books  = BookClass.GetBooksByAuthorId(id);
            AuthorClass      author = AuthorClass.GetAuthorById(id);

            dictionary.Add("books", books);
            dictionary.Add("author", author);
            return(View(dictionary));
        }
示例#14
0
        public ActionResult SearchAuthor(string authorNameSearch)
        {
            AuthorClass author = AuthorClass.GetAuthorByName(authorNameSearch);
            int         id     = author.GetId();
            Dictionary <string, object> dictionary = new Dictionary <string, object> {
            };
            List <BookClass> books = BookClass.GetBooksByAuthorId(id);

            dictionary.Add("books", books);
            dictionary.Add("author", author);
            return(View("ShowAuthor", dictionary));
        }
        public IHttpActionResult DeleteBookClass(int id)
        {
            BookClass bookclass = db.bookClass.FirstOrDefault(b => b.classID == id);

            if (bookclass == null)
            {
                return(NotFound());
            }

            db.bookClass.Remove(bookclass);
            db.SaveChanges();
            return(Ok(bookclass));
        }
        public IHttpActionResult PostBookClass(BookClass bookclass)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.bookClass.Add(bookclass);
            db.SaveChanges();

            //return CreatedAtRoute("DefaultApi", new { id = bookclass.classID }, bookclass);
            return(Ok());
        }
        // PUT api/Classification/5
        /// <summary>
        /// PUT Method to update a specific record in BookClass Table
        /// </summary>
        /// <param name="obj">
        /// The new BookClass data
        /// </param>
        /// <returns>
        /// The Status of the PUT Method (OK or NOT)
        /// </returns>
        public IHttpActionResult PutBookClass(BookClass obj)
        {
            BookClass bookclass = db.bookClass.FirstOrDefault(b => b.classID == obj.classID);

            if (bookclass == null)
            {
                return(NotFound());
            }

            bookclass.className = obj.className;
            db.SaveChanges();

            return(Ok());
        }
示例#18
0
        public ActionResult ShowBook(int id)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object> {
            };
            BookClass   newBook   = BookClass.GetBookById(id);
            AuthorClass newAuthor = AuthorClass.GetAuthorByBookId(id);
            int         amount    = CopiesClass.GetAmountByBookId(id);
            int         total     = CopiesClass.GetTotalByBookId(id);
            CopiesClass copies    = new CopiesClass(id, amount, total);

            dictionary.Add("book", newBook);
            dictionary.Add("author", newAuthor);
            dictionary.Add("copies", copies);

            return(View("ShowBook", dictionary));
        }
示例#19
0
        public void Test1()
        {
            //Arrange
            var BookCopy = new BookClass("");

            BookCopy.AddGrade(50.5);
            BookCopy.AddGrade(75);
            BookCopy.AddGrade(100);

            //Act
            var Result = BookCopy.GetStatistics();

            Assert.Equal(50, Result.Low);
            Assert.Equal(100, Result.High);
            Assert.Equal(75, Result.Average);
        }
示例#20
0
        public async Task <IActionResult> Edit(int id, BookClass obj)
        {
            if (id != obj.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _Context.Update(obj);
                await _Context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(obj));
        }
示例#21
0
        public async Task <IActionResult> Create(BookClass obj)
        {
            if (!ModelState.IsValid)
            {
                return(View(obj));
            }
            else
            {
                _Context.Books.Add(obj);
                await _Context.SaveChangesAsync();

                //return RedirectToAction("Index","Default");
            }

            return(RedirectToAction(nameof(Index), "Default"));
        }
示例#22
0
        public BookClass GetBook()
        {
            BookClass book = new BookClass
            {
                name_book       = tb_bookname.Text,
                classnum        = (int)NUD_Class.Value,
                publishing_year = (Int16)NUD_Year.Value,
                type            = cb_type.SelectedItem as TypeClass,
                publisher       = cb_publisher.SelectedItem as PublisherClass
            };

            foreach (AuthorClass author in lb_author.Items) //перебор авторов и заполнение CheckBox
            {
                book.Authors.Add(author);
            }
            return(book);
        }
示例#23
0
    protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
    {
        BookClass bk = new BookClass();

        Label l = (Label)e.Item.FindControl("lblisbn");

        bk.ISBN = l.Text;
        TextBox tb1 = (TextBox)e.Item.FindControl("txtbookTitle");

        bk.bookTitle = tb1.Text;
        TextBox tb2 = (TextBox)e.Item.FindControl("txtAuthorName");

        bk.authorName = tb2.Text;
        TextBox tb3 = (TextBox)e.Item.FindControl("txtPublication");

        bk.publication = tb3.Text;
        TextBox tb4 = (TextBox)e.Item.FindControl("txtEdition");

        bk.edition = int.Parse(tb4.Text);
        TextBox tb5 = (TextBox)e.Item.FindControl("txtCategory");

        bk.category = tb5.Text;
        TextBox tb6 = (TextBox)e.Item.FindControl("txtbookURL");

        bk.bookURL = tb6.Text;
        TextBox tb7 = (TextBox)e.Item.FindControl("txtPrice");

        bk.price = int.Parse(tb7.Text);
        TextBox tb8 = (TextBox)e.Item.FindControl("txtquantity");

        bk.quantity = int.Parse(tb8.Text);
        TextBox tb9 = (TextBox)e.Item.FindControl("txtPages");

        bk.pages = int.Parse(tb9.Text);
        TextBox tb10 = (TextBox)e.Item.FindControl("txtKeywords");

        bk.keywords = tb10.Text;
        TextBox tb12 = (TextBox)e.Item.FindControl("txtDescription");

        bk.description = tb12.Text;
        DBABookDAL c = new DBABookDAL();

        c.UpdateBook(bk);
        DataList1.EditItemIndex = -1;
        DataList1.DataBind();
    }
        private void OnRemoveEntryCommandExecute()
        {
            BookClass bookClass = Books.FirstOrDefault(h => h.DateBook == Data);

            if (bookClass is null)
            {
                return;
            }
            bookManager.Delete(bookClass);
            bookManager.Save();
            Headline = null;
            Content  = null;
            CategoryClassesList.Clear();
            Data = new DateTime();
            Books.Clear();
            Books = new ObservableCollection <BookClass>(bookManager.GetAll());
            Books = new ObservableCollection <BookClass>(Books.OrderBy(x => x.DateBook));
        }
示例#25
0
        }//End modify book from file method

        //Reads and writes all books to updatedBook file and then adds a new book
        public void addNewBook(string ISBN, string title, string author, decimal price, int onHand, DateTime date)
        {
            isEndOfFile = false;
            currentBookFile.rewindFile();
            while (!isEndOfFile)
            {
                string readString = currentBookFile.getNextRecord(ref isEndOfFile);
                if (readString == null)
                {
                    break;
                }//End if
                updatedBookFile.writeNextRecord(readString);
            }//End while
            Book = new BookClass(ISBN, title, author, price, onHand, date);
            updatedBookFile.writeNextRecord(Book.createBookWrite());
            MessageBox.Show(Book.displayBookRecord(), "New Book Record");
            updatedBookFile.closeFile();
        }//End addNewBook method
示例#26
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DBABookDAL ba = new DBABookDAL();

        BookClass bk = new BookClass();

        bk.ISBN        = txtISBN.Text.ToString();
        bk.bookTitle   = txtBookTitle.Text.ToString();
        bk.authorName  = txtAuthorFirst.Text.ToString();
        bk.description = txtDescription.Text.ToString();
        bk.publication = txtPub.Text.ToString();
        bk.edition     = int.Parse(txtEdition.Text);
        bk.category    = txtCategory.Text.ToString();
        bk.bookURL     = txtBookUrl.Text.ToString();
        bk.price       = int.Parse(txtPrice.Text);
        bk.pages       = int.Parse(txtPages.Text);
        bk.keywords    = txtKeywords.Text.ToString();

        ba.Insert(bk);
    }
示例#27
0
        private void btnAddOK_Click(object sender, EventArgs e)
        {
            int    i = 0;
            string updatedBookFile = "updatedBookFile.txt";

            BookClass     Book     = new BookClass();
            BookListClass BookList = new BookListClass();

            string bookTitle  = txtBookTitleAdd.Text;
            string bookAuthor = txtBookAuthorAdd.Text;

            string[] bookKeywords;
            Book.keywordSplitter(txtBookKeywordAdd.Text, out bookKeywords);
            string[] writtenArray = new string[100];
            string   concatWrite  = "";

            concatWrite += (bookTitle + " ");
            concatWrite += (bookAuthor + " ");
            foreach (string element in bookKeywords)
            {
                concatWrite += (element + " ");
            }

            try
            {
                using (StreamWriter w = File.AppendText(updatedBookFile))
                {
                    w.WriteLine(concatWrite + "\n");
                    MessageBox.Show("Book has been added to the list!", "Book Added");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }

            txtBookTitleAdd.Text   = "";
            txtBookAuthorAdd.Text  = "";
            txtBookKeywordAdd.Text = "";
            txtBookTitleAdd.Focus();
        }
示例#28
0
        public AddBookForm(BookClass bookEdit)
        {
            this.bookEdited = bookEdit;
            InitializeComponent();
            UpdateCombo();

            if (bookEdit.classnum == null)
            {
                NUD_Class.Enabled   = false;
                cb_NoUchLit.Checked = true;
            }
            else
            {
                cb_NoUchLit.Checked = true;
                NUD_Class.Value     = (decimal)bookEdit.classnum;
            }

            tb_bookname.Text          = bookEdit.name_book;
            NUD_Year.Value            = bookEdit.publishing_year;
            cb_type.SelectedItem      = bookEdit.type;
            cb_publisher.SelectedItem = bookEdit.publisher;
            lb_author.Items.AddRange(bookEdit.Authors.ToArray());
        }
示例#29
0
 public FictionBook(BookClass bookClass, string title, List <Author> author, string publisher, string dataOfPublication) : base(bookClass, title, author, publisher, dataOfPublication)
 {
 }
示例#30
0
        private void bt_import_Purchase_Click(object sender, EventArgs e)
        {
            if (ofd_load_Purchase.ShowDialog() == DialogResult.OK)//Вызываем диалог выбора файла и проверяем, что полльзователь выбрал файл
            {
                DataTable table;
                if (ExcelClass.loadExcel(ofd_load_Purchase.FileName, out table))//Если загрузка данных(ИмяФайла,ТаблицаСРезультатом) прошел успешно
                {
                    PurchaseListClass purchaseList = new PurchaseListClass {
                        datePurchase = DateTime.Now
                    };
                    foreach (DataRow row in table.Rows)//перебираем полученные строки
                    {
                        StringBuilder builder = new StringBuilder();
                        //Проверка на наличие такого типа литературы с такими данными
                        string    typename = row["Тип"].ToString();
                        TypeClass type     = DbModel.init().Types.Where(t =>
                                                                        t.type == typename).FirstOrDefault();

                        //Если книга не существует, то выдается сообщение об ошибке
                        if (type == null)
                        {
                            type = new TypeClass {
                                type = Convert.ToString(typename)
                            };
                        }

                        //проверка на наличие авторов в базе
                        List <AuthorClass> authors = new List <AuthorClass>();
                        //разделение авторов сначала на двух разных, а затем каждого на инициалы
                        string   FIO_Authors  = Convert.ToString(row["Автор"]);
                        string[] split_Author = FIO_Authors.Split(',');
                        //перебираем инициаллы
                        foreach (string strF_IO in split_Author)
                        {
                            string[]    F_I_O = strF_IO.Split(' ', '.');
                            AuthorClass author = null;
                            string      fam = F_I_O[0], name = F_I_O[1], otch = F_I_O[2];
                            //сравниваем инициалы на наличие соотношениий в базе. Инициалы И.О. сверяются с первыми бууквами значений.
                            author = DbModel.init().Authors.Where(a => a.family_name.StartsWith(fam) && a.first_name.StartsWith(name) && a.middle_name.StartsWith(otch)).FirstOrDefault();
                            //если такой автор в базе найден, то.....

                            if (author != null)
                            {
                                //в класс (таблицу) автора добавляется новой значение
                                authors.Add(author);
                            }
                            else
                            {
                                //если данные не найдены, то открывается форма "AddAvtor" для того, чтобы пользователь расшифровал значение.
                                //От формы данные добавляются в базу
                                AddAvtorForm addAvtor = new AddAvtorForm(fam, name, otch);
                                if (addAvtor.ShowDialog() != DialogResult.OK)
                                {
                                    builder.AppendLine(String.Format("Fio author {0} not found!", strF_IO));
                                }
                                else
                                {
                                    author = addAvtor.GetAuthor();
                                    authors.Add(author);
                                }
                            }
                        }



                        //Проверка на наличие издательства с такими данными. !!!!!!!!!Действия схожи с данными об авторах!!!!!!!
                        List <PublisherClass> publishers = new List <PublisherClass>();
                        string         publicher_str = Convert.ToString(row["Издательство"]);
                        string[]       split_publisher = publicher_str.Split(':');
                        PublisherClass publisher = null;
                        string         publisher_name = split_publisher[1], publisher_city = split_publisher[0];
                        publisher = DbModel.init().Publishers.Where(p =>
                                                                    p.city.StartsWith(publisher_city) && p.name.StartsWith(publisher_name)).FirstOrDefault();
                        if (publisher != null)
                        {
                            publishers.Add(publisher);
                        }
                        else
                        {
                            AddPublisherForm addPublisher = new AddPublisherForm(publisher_city, publisher_name);
                            if (addPublisher.ShowDialog() != DialogResult.OK)
                            {
                                builder.AppendLine(String.Format("Издательство не найдено!", publicher_str));
                            }
                            else
                            {
                                publisher = addPublisher.GetPublisher();
                                publishers.Add(publisher);
                            }
                        }


                        //Проверка на наличие данной литературы
                        BookClass book     = null;
                        string    bookname = row["Название"].ToString();
                        int?      bookclassnum = null;
                        try
                        {
                            bookclassnum = Convert.ToInt32(row["Класс"]);
                        }
                        catch { }
                        book = DbModel.init().Books.Include(b => b.publisher).Include(b => b.type).Include(b => b.Authors)
                               .Where(b =>
                                      b.classnum == bookclassnum &&
                                      b.name_book == bookname &&
                                      b.publisher.idPublisher == publisher.idPublisher &&
                                      b.type.idType == type.idType
                                      ).FirstOrDefault();

                        if (book == null)
                        {
                            AddBookForm addBook = new AddBookForm(bookclassnum, bookname, publisher, type, authors);
                            if (addBook.ShowDialog() != DialogResult.OK)
                            {
                                builder.AppendLine(String.Format("Литература не найдена!", bookname));
                            }
                            book = addBook.GetBook();
                        }

                        int Litheraturecount = Convert.ToInt32(row["Количество"]);
                        purchaseList.purchaseAccountings.Add(
                            new PurchaseAccountingClass
                        {
                            count = Litheraturecount,
                            price = Convert.ToDecimal(row["Цена"]),
                            literatureTurnover = LiteratureTurnoverClass.addNewLitherature(book, Litheraturecount)
                        }
                            );
                    }
                    AddPurchaseForm addPurchase = new AddPurchaseForm(purchaseList);
                    addPurchase.ShowDialog();
                    MessageBox.Show("Boooozhe! ONO RABOTAET!");
                }
            }
        }