private async void AddButton_Click(object sender, EventArgs e)
        {
            string bookname = txtBookName.Text.Trim();
            string bookaut  = txtBookAutor.Text.Trim();
            string booktype = txtBooktype.Text.Trim();
            int    count    = 0;

            int.TryParse(txtBookcount.Text, out count);
            bookcount = count;

            if (checkbook(bookname, booktype, bookaut, bookcount))
            {
                BOOK libbook = new BOOK();
                libbook.BOOKNAME  = bookname;
                libbook.AUTHOR    = bookaut;
                libbook.BOOKTYPE  = booktype;
                libbook.BOOKCOUNT = bookcount;

                Dblib.BOOKS.Add(libbook);
                await Dblib.SaveChangesAsync();

                FilldgvBook();
                clearfields();
            }
        }
 //inputlarin datagridden doldurulmasi
 private void dgvBooks_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     bookid            = (int)dgvBooks.Rows[e.RowIndex].Cells[0].Value;
     book              = Dblib.BOOKS.Find(bookid);
     txtBookName.Text  = book.BOOKNAME;
     txtBookAutor.Text = book.AUTHOR;
     txtBooktype.Text  = book.BOOKTYPE;
     txtBookcount.Text = book.BOOKCOUNT.ToString();
 }
        //kitablarin silinmesi
        private async void Delete_Click(object sender, EventArgs e)
        {
            book         = Dblib.BOOKS.Find(bookid);
            book.DELETED = true;
            await Dblib.SaveChangesAsync();

            FilldgvBook();
            clearfields();
        }
        //kitablarin yenilenmesi
        private async void Update_Click(object sender, EventArgs e)
        {
            book           = Dblib.BOOKS.Find(bookid);
            book.BOOKNAME  = txtBookName.Text.Trim();
            book.AUTHOR    = txtBookAutor.Text.Trim();
            book.BOOKCOUNT = int.Parse(txtBookcount.Text);
            book.BOOKTYPE  = txtBooktype.Text.Trim();
            await Dblib.SaveChangesAsync();

            FilldgvBook();
            clearfields();
        }
Example #5
0
        static void Main(string[] args)
        {
            string nameAuthor      = "Zak Cody";
            string nameBook        = "Trust";
            string publishingHouse = "home";
            string country         = "Italia";
            int    startYear       = 2000;
            string name            = "Trust";
            string genre           = "Fantasy";

            Author author = new Author(nameAuthor, publishingHouse, nameBook);

            PublishingHouse publishing = new PublishingHouse(startYear, country);

            BOOK book = new BOOK(genre, name);

            Console.WriteLine(publishing.ToString());

            Console.WriteLine(author.ToString());

            Console.WriteLine(book.ToString());
        }
Example #6
0
 private void Allbooks_SelectedValueChanged(object sender, EventArgs e)
 {
     realBooks = (Allbooks.SelectedItem as RealBooks).id;
     books     = DBlib.BOOKS.Find(realBooks);
 }