private void btnTeslimAl_Click(object sender, EventArgs e)
        {
            EBorrowedBooks returnBook = new EBorrowedBooks();

            returnBook = (EBorrowedBooks)dataGridView1.SelectedRows[0].DataBoundItem;
            DialogResult result = MessageBox.Show("'" + returnBook.bookName + "'" + " " + "isimli kitabı teslim almak istediğinizden emin misiniz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                returnBook.IsReturned   = false;
                returnBook.DateOfReturn = DateTime.Now;
                bool sonuc = BLLBorrowedBooks.Update(returnBook);
                if (sonuc)
                {
                    MessageBox.Show("Harika! Kitap Teslim Alındı!");
                    txtIsbnNo.Clear();
                }
                else
                {
                    MessageBox.Show("Bir hata oluştu!");
                }
            }

            List <EBorrowedBooks> kiralist = BLLBorrowedBooks.GetAll();

            kiralist = (from k in kiralist
                        where k.IsReturned == true
                        select k).ToList <EBorrowedBooks>();
            dataGridView1.DataSource = kiralist;
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (Request.QueryString["ID"] != null)
            {
                EBorrowedBooks returnBook = new EBorrowedBooks();
                returnBook.ID           = int.Parse(Request.QueryString["ID"]);
                returnBook              = BLLBorrowedBooks.GetIdOnly(returnBook.ID);
                returnBook.DateOfReturn = DateTime.Now;
                returnBook.IsReturned   = false;


                bool sonuc = BLLBorrowedBooks.Update(returnBook);
                if (sonuc)
                {
                    Response.Write("<script>alert('Harika! Kitap Teslim Alındı!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('Bir hata oluştu!')</script>");
                }
            }

            List <EBorrowedBooks> bookList = BLLBorrowedBooks.GetAll();

            if (bookList != null && bookList.Count > 0)
            {
                bookList = (from l in bookList
                            where l.IsReturned == true
                            select l).ToList <EBorrowedBooks>();
            }
            else
            {
                Response.Write("<script>alert('Teslim alınacak kitap bulunamadı!')</script>");
            }
            rptKitaplar.DataSource = bookList;
            rptKitaplar.DataBind();
        }