Esempio n. 1
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (txtBookName.Text != "" && txtWriterName.Text != "")
            {
                using (BookCenterDBEntities1 dbEntities = new BookCenterDBEntities1())
                {
                    TBLBookList bookList = new TBLBookList();
                    bookList.Name        = txtBookName.Text;
                    bookList.WriterName  = txtWriterName.Text;
                    bookList.Publisher   = txtPublisher.Text;
                    bookList.Category    = txtCategory.Text;
                    bookList.Stock       = int.Parse(txtStock.Text);
                    bookList.ReleaseDate = DateTime.Parse(mtxtReleaseDate.Text);
                    bookList.Images      = "book.png";
                    dbEntities.TBLBookList.Add(bookList);
                    dbEntities.SaveChanges();
                    MessageBox.Show("Kayıt Gerçekleştirildi.");
                    ClearBookCells();
                    UpdateHomePage();
                }
            }
            else
            {
                MessageBox.Show("Boş Kayıt Girilemez.");
            }

            complateData();
        }
Esempio n. 2
0
        private void btnGüncelle_Click(object sender, EventArgs e)
        {
            using (BookCenterDBEntities1 dbEntities = new BookCenterDBEntities1())
            {
                if (BookID != 0)
                {
                    TBLBookList valueChangeBookList = dbEntities.TBLBookList.Find(BookID);
                    valueChangeBookList.Name        = txtBookName.Text;
                    valueChangeBookList.Publisher   = txtPublisher.Text;
                    valueChangeBookList.Category    = txtCategory.Text;
                    valueChangeBookList.Stock       = int.Parse(txtStock.Text);
                    valueChangeBookList.ReleaseDate = DateTime.Parse(mtxtReleaseDate.Text);
                    dbEntities.SaveChanges();
                    MessageBox.Show("İşlem başarılı.");
                    ClearBookCells();
                    UpdateHomePage();
                }
                else
                {
                    MessageBox.Show("Veri Seçiniz.");
                }
            }

            complateData();
        }
Esempio n. 3
0
 private void btnSil_Click(object sender, EventArgs e)
 {
     using (BookCenterDBEntities1 db = new BookCenterDBEntities1())
     {
         if (BookID != 0)
         {
             TBLBookList deleteBook = db.TBLBookList.Find(BookID);
             db.TBLBookList.Remove(deleteBook);
             db.SaveChanges();
             BookID = 0;
             MessageBox.Show("İşlem Başarılı.");
             ClearBookCells();
             UpdateHomePage();
         }
         else
         {
             MessageBox.Show("Veri Seçmediniz.");
         }
     }
     complateData();
 }