Exemple #1
0
        protected void btnAra_Click(object sender, EventArgs e)
        {
            List <EBooks> bookList            = BLLBooks.GetAll();
            int           selectedAuthorID    = int.Parse(cmbKitapYazari.SelectedValue.ToString());
            int           selectedShelfID     = int.Parse(cmbRafNo.SelectedValue.ToString());
            int           selectedCategoryID  = int.Parse(cmbTur.SelectedValue.ToString());
            int           selectedPublisherID = int.Parse(cmbYayinEvi.SelectedValue.ToString());


            if (bookList != null && bookList.Count > 0)
            {
                if (chbYazar.Checked == true)
                {
                    bookList = (from l in bookList
                                where l.Author.ID == selectedAuthorID
                                select l).ToList <EBooks>();
                }

                if (chbYayinevi.Checked == true)
                {
                    bookList = (from l in bookList
                                where l.Publisher.ID == selectedPublisherID
                                select l).ToList <EBooks>();
                }

                if (chbTur.Checked == true)
                {
                    bookList = (from l in bookList
                                where l.Category.ID == selectedCategoryID
                                select l).ToList <EBooks>();
                }

                if (chbRaf.Checked == true)
                {
                    bookList = (from l in bookList
                                where l.Shelf.ID == selectedShelfID
                                select l).ToList <EBooks>();
                }

                if (bookList.Count > 0)
                {
                    rptKitaplar.DataSource = bookList;
                    rptKitaplar.DataBind();
                }
                else
                {
                    Response.Write("<script>alert('Aradığınız kriterlere uygun kitap bulunmamaktadır !')</script>");
                    rptKitaplar.DataSource = bookList;
                    rptKitaplar.DataBind();;
                }
            }
        }
Exemple #2
0
        private void txtISBNNo_TextChanged(object sender, EventArgs e)
        {
            string searchText = txtISBNNo.Text;

            List <EBooks> booklist = BLLBooks.GetAll();

            booklist = (from l in booklist
                        where l.ISBNNO.Trim().ToLower().Contains(searchText.Trim().ToLower())
                        select l).ToList <EBooks>();

            dataGridView1.DataSource = booklist;
            txtKitap.Clear();
            txtYazar.Clear();
        }
Exemple #3
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (cmbEmployees.SelectedIndex != -1 & cmbMembers.SelectedIndex != -1 & cmbVerilenKitap.SelectedIndex != -1)
            {
                EBorrowedBooks borrowedBook = new EBorrowedBooks();
                borrowedBook.Book         = new EBooks();
                borrowedBook.Member       = new EMembers();
                borrowedBook.Employee     = new EEmployees();
                borrowedBook.Book.ID      = Convert.ToInt32(cmbVerilenKitap.SelectedValue);
                borrowedBook.Employee.ID  = Convert.ToInt32(cmbEmployees.SelectedValue);
                borrowedBook.Member.ID    = Convert.ToInt32(cmbMembers.SelectedValue);
                borrowedBook.DateOfBorrow = DateTime.Now;
                borrowedBook.ExpireDate   = dtpExpireDate.Value;


                if (borrowedBook.DateOfBorrow <= borrowedBook.ExpireDate)
                {
                    if (BLLBorrowedBooks.InsertBorrowedBook(borrowedBook))
                    {
                        MessageBox.Show("Kayıt işleminiz başarıyla gerçekleşmiştir.");
                        List <EBooks> bookList = BLLBooks.GetBookNames();
                        if (bookList != null && bookList.Count > 0)
                        {
                            bookList = (from l in bookList
                                        where l.IsReturned == false
                                        select l).ToList <EBooks>();
                        }
                        cmbVerilenKitap.DataSource = bookList;
                    }
                    else
                    {
                        MessageBox.Show("Hata Oluştu!");
                    }
                }
                else
                {
                    MessageBox.Show("Kitap Teslim Tarihi, alınan tarihten eski olamaz!");
                }

                cmbEmployees.SelectedIndex    = -1;
                cmbMembers.SelectedIndex      = -1;
                cmbVerilenKitap.SelectedIndex = -1;
            }
            else
            {
                MessageBox.Show("Eksik bilgi girdiniz. Lütfen kontrol ediniz!");
            }
        }
        protected void btnGuncelle_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtKitapAdi.Text) & !string.IsNullOrEmpty(txtISBNNo.Text) & !string.IsNullOrEmpty(dtpBasimTarihi.Text))
            {
                DateTime dtpBasimTar = Convert.ToDateTime(dtpBasimTarihi.Text);
                if (dtpBasimTar <= DateTime.Now)
                {
                    EBooks guncellenecek = new EBooks();
                    guncellenecek.Author    = new EAuthors();
                    guncellenecek.Shelf     = new EShelf();
                    guncellenecek.Category  = new ECategories();
                    guncellenecek.Publisher = new EPublisher();

                    guncellenecek.ID           = int.Parse(Request.QueryString["bookID"]);
                    guncellenecek.Shelf.ID     = Convert.ToInt32(cmbRafNo.SelectedValue);
                    guncellenecek.Category.ID  = Convert.ToInt32(cmbTur.SelectedValue);
                    guncellenecek.Publisher.ID = Convert.ToInt32(cmbYayinEvi.SelectedValue);
                    guncellenecek.Author.ID    = Convert.ToInt32(cmbKitapYazari.SelectedValue);

                    guncellenecek.Name   = txtKitapAdi.Text;
                    guncellenecek.ISBNNO = txtISBNNo.Text;

                    guncellenecek.DateOfPublish = DateTime.Parse(dtpBasimTarihi.Text);

                    bool sonuc = BLLBooks.Update(guncellenecek);
                    if (sonuc)
                    {
                        Response.Write("<script>alert('Harika! Güncellendi!');</script>");
                        Response.Redirect("Kitaplar.aspx?scs=1");
                    }
                    else
                    {
                        Response.Write("<script>alert('Hay Aksi! Hata Oluştu!')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Basım Tarihi Bugünün Tarihinden Büyük Olamaz!')</script>");
                    dtpBasimTarihi.Text = String.Empty;
                }
            }
            else
            {
                Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>");
            }
        }
Exemple #5
0
        protected override void OnPreRender(EventArgs e)
        {
            List <EBooks> bookList = BLLBooks.GetBookNames();

            if (bookList != null && bookList.Count > 0)
            {
                bookList = (from l in bookList
                            where l.IsReturned == false
                            select l).ToList <EBooks>();
            }

            cmbVerilenKitap.DataSource     = bookList;
            cmbVerilenKitap.DataTextField  = "Name";
            cmbVerilenKitap.DataValueField = "ID";
            cmbVerilenKitap.ClearSelection();
            cmbVerilenKitap.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                cmbKitapYazari.DataSource     = BLLAuthors.GetAll();
                cmbKitapYazari.DataTextField  = "FullName";
                cmbKitapYazari.DataValueField = "ID";
                cmbKitapYazari.DataBind();

                cmbTur.DataSource     = BLLCategories.GetAll();
                cmbTur.DataTextField  = "Name";
                cmbTur.DataValueField = "ID";
                cmbTur.DataBind();

                cmbRafNo.DataSource     = BLLShelf.GetAll();
                cmbRafNo.DataTextField  = "ShelfNo";
                cmbRafNo.DataValueField = "ID";
                cmbRafNo.DataBind();

                cmbYayinEvi.DataSource     = BLLPublisher.GetAll();
                cmbYayinEvi.DataTextField  = "Name";
                cmbYayinEvi.DataValueField = "ID";
                cmbYayinEvi.DataBind();

                int bookID = Convert.ToInt32(Request.QueryString["bookID"].ToString());


                EBooks book = new EBooks();
                book.Author    = new EAuthors();
                book.Shelf     = new EShelf();
                book.Category  = new ECategories();
                book.Publisher = new EPublisher();

                book             = BLLBooks.GetIdOnly(bookID);
                txtKitapAdi.Text = book.Name;
                txtISBNNo.Text   = book.ISBNNO;

                cmbRafNo.SelectedValue       = book.Shelf.ID.ToString();
                cmbKitapYazari.SelectedValue = book.Author.ID.ToString();
                cmbTur.SelectedValue         = book.Category.ID.ToString();
                cmbYayinEvi.SelectedValue    = book.Publisher.ID.ToString();

                dtpBasimTarihi.Text = book.DateOfPublish.ToString();
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = BLLBooks.GetAll();


            cmbKitapYazari.DataSource    = BLLAuthors.GetAll();
            cmbKitapYazari.DisplayMember = "FullName";
            cmbKitapYazari.ValueMember   = "ID";

            cmbTur.DataSource    = BLLCategories.GetAll();
            cmbTur.DisplayMember = "Name";
            cmbTur.ValueMember   = "ID";

            cmbRafNo.DataSource    = BLLShelf.GetAll();
            cmbRafNo.DisplayMember = "ShelfNo";
            cmbRafNo.ValueMember   = "ID";

            cmbYayinEvi.DataSource    = BLLPublisher.GetAll();
            cmbYayinEvi.DisplayMember = "Name";
            cmbYayinEvi.ValueMember   = "ID";
        }
Exemple #8
0
        private void Form2_Load(object sender, EventArgs e)
        {
            List <EBooks> bookList = BLLBooks.GetBookNames();

            if (bookList != null && bookList.Count > 0)
            {
                bookList = (from l in bookList
                            where l.IsReturned == false
                            select l).ToList <EBooks>();
            }
            cmbVerilenKitap.DataSource    = bookList;
            cmbVerilenKitap.DisplayMember = "Name";
            cmbVerilenKitap.ValueMember   = "ID";

            cmbMembers.DataSource    = BLLMembers.GetMemberNames();
            cmbMembers.DisplayMember = "FullName";
            cmbMembers.ValueMember   = "ID";

            cmbEmployees.DataSource    = BLLEmployees.GetEmployeeNames();
            cmbEmployees.DisplayMember = "FullName";
            cmbEmployees.ValueMember   = "ID";
        }
Exemple #9
0
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtKitapAdi.Text) & !string.IsNullOrEmpty(dtpBasimTarihi.Text) & !string.IsNullOrEmpty(txtISBNNo.Text))
            {
                DateTime dtpBasimTar = Convert.ToDateTime(dtpBasimTarihi.Text);
                if (dtpBasimTar <= DateTime.Now)
                {
                    List <EBooks> bookList = BLLBooks.GetAll();

                    bookList = (from l in bookList
                                where l.ISBNNO.Trim().ToLower().Equals(txtISBNNo.Text.Trim().ToLower())
                                select l).ToList();
                    if (bookList.Count == 0)
                    {
                        EBooks book = new EBooks();
                        book.Author = new EAuthors();
                        book.Shelf  = new EShelf();

                        book.Name      = txtKitapAdi.Text;
                        book.Author.ID = Convert.ToInt32(cmbKitapYazari.SelectedValue);
                        book.Shelf.ID  = Convert.ToInt32(cmbRafNo.SelectedValue);
                        book.ISBNNO    = txtISBNNo.Text;

                        string[] basimTarArr = dtpBasimTarihi.Text.Split(new string[] { "." }, StringSplitOptions.None);
                        book.DateOfPublish = new DateTime(int.Parse(basimTarArr[2]), int.Parse(basimTarArr[1]), int.Parse(basimTarArr[0]));

                        EBookCategory bookCategory = new EBookCategory();
                        bookCategory.CategoryID = Convert.ToInt32(cmbTur.SelectedValue);
                        bookCategory.BookID     = BLLBooks.InsertNewBook(book);

                        EBookPublisher bookPublisher = new EBookPublisher();
                        bookPublisher.PublisherID = Convert.ToInt32(cmbYayinEvi.SelectedValue);
                        bookPublisher.BookID      = bookCategory.BookID;

                        if (BLLBookCategory.InsertNewBookCategory(bookCategory) & BLLBookPublisher.InsertNewBookPublisher(bookPublisher))
                        {
                            Response.Write("<script>alert('Kitap kayıt işleminiz başarıyla gerçekleşmiştir.')</script>");
                        }
                        else
                        {
                            Response.Write("<script>alert('Hata Oluştu!')</script>");
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('Girmiş olduğunuz ISBN Numaralı kitap zaten kayıtlı!')</script>");
                    }


                    txtKitapAdi.Text    = String.Empty;
                    txtISBNNo.Text      = String.Empty;
                    dtpBasimTarihi.Text = String.Empty;
                    cmbKitapYazari.ClearSelection();
                    cmbRafNo.ClearSelection();
                    cmbTur.ClearSelection();
                    cmbYayinEvi.ClearSelection();
                    txtKitapAdi.Focus();
                }
                else
                {
                    Response.Write("<script>alert('Basım Tarihi Bugünün Tarihinden Büyük Olamaz!')</script>");
                    dtpBasimTarihi.Text = String.Empty;
                }
            }
            else
            {
                Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>");
            }
        }
Exemple #10
0
 private void Kitap_Listesi_Load(object sender, EventArgs e)
 {
     dataGridView1.AutoGenerateColumns = false;
     dataGridView1.DataSource          = BLLBooks.GetAll();
 }