private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            var           item   = dataGrid.SelectedItem;
            Book_Detail   bk     = new Book_Detail();
            Member_Detail member = new Member_Detail();
            Issue_Detail  issue  = new Issue_Detail();


            if (issue.GetType().Equals(item.GetType()) == true)
            {
                issue = (Issue_Detail)dataGrid.SelectedItem;
                bk    = bookController.findByBookID((int)issue.book_id);
                if (!bk.title.Equals(""))
                {
                    lbl_availablility_replace.Content  = bk.no_of_copies;
                    lbl_book_name_replace.Content      = bk.title;
                    lbl_book_publisher_replace.Content = bk.publisher;
                    lbl_cat_replace.Content            = bk.category;
                    lbl_isbn_replace.Content           = bk.isbn;

                    if (bk.image != null)
                    {
                        BitmapImage image = Convertor.ToImage(bk.image);
                        image_book_detail.Source = image;
                    }
                    else
                    {
                        image_book_detail.Source = new BitmapImage(new Uri(@"image/profile3.jpg", UriKind.Relative));
                    }
                }
            }
        }
        public Add_Book()
        {
            InitializeComponent();
            bk = new Book_Detail();

            bkcontoller.addBook(bk);

            txt_bookid.Text = "BKID" + bk.book_id.ToString();

            fillLanguages();
            fillBookType();
        }
示例#3
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            var           item   = data_book_grid.SelectedItem;
            Book_Detail   bk     = new Book_Detail();
            Member_Detail member = new Member_Detail();
            Issue_Detail  issue  = new Issue_Detail();

            if (bk.GetType().Equals(item.GetType()) == true)
            {
                bk = (Book_Detail)data_book_grid.SelectedItem;
                new View_Book_Details(bk.book_id).Show();
            }
            if (member.GetType().Equals(item.GetType()) == true)
            {
                member = (Member_Detail)data_book_grid.SelectedItem;
                new MemberQuickView(member.member_id).Show();
            }
            if (issue.GetType().Equals(item.GetType()) == true)
            {
                issue = (Issue_Detail)data_book_grid.SelectedItem;
            }
        }
        public View_Book_Details(int bookID)
        {
            InitializeComponent();
            bookController       = new BookController();
            bookDetail           = bookController.findByBookID(bookID);
            txt_bookid.Text      = bookDetail.book_id + "";
            txt_title.Text       = bookDetail.title;
            txt_author.Text      = bookDetail.author;
            txt_description.Text = bookDetail.description;
            txt_isbn.Text        = bookDetail.description;
            txt_price.Text       = bookDetail.price + "";
            txt_publisher.Text   = bookDetail.publisher;
            txt_year.Text        = bookDetail.year;

            if (bookDetail.image != null)
            {
                BitmapImage image = ToImage(bookDetail.image);
                image_view.Source = image;
            }
            else
            {
                image_view.Source = new BitmapImage(new Uri(@"image/book.png", UriKind.Relative));
            }
        }
        private void btn_check_book_Click(object sender, RoutedEventArgs e)
        {
            string bookID = txt_bookid.Text.Trim();

            if (!bookID.Equals("") || !bookID.Equals(null))
            {
                int num;

                Boolean parseNumberStatus = int.TryParse(bookID, out num);

                if (parseNumberStatus)
                {
                    Book_Detail bk_detail = new Book_Detail();

                    // int id = Util.StandardID_Generator.idExtractorGenerator(memID);
                    //  Console.Write("ID :" + id + "mem ID" + memID);
                    bk_detail = bkController.findByBookID(num);

                    currBook = bk_detail;
                    if (bk_detail != null)
                    {
                        if (bk_detail.no_of_copies == 0)
                        {
                            lbl_book_id_replace.Content        = bk_detail.book_id;
                            lbl_book_name_replace.Content      = bk_detail.title;
                            lbl_book_publisher_replace.Content = bk_detail.publisher;
                            lbl_isbn_replace.Content           = bk_detail.isbn;
                            lbl_availablility_replace.Content  = bk_detail.no_of_copies;
                            lbl_cat_replace.Content            = bk_detail.category;

                            if (bk_detail.image != null)
                            {
                                BitmapImage image = Convertor.ToImage(bk_detail.image);
                                image_book.Source = image;
                            }
                            else
                            {
                                image_book.Source = new BitmapImage(new Uri(@"image/profile3.jpg", UriKind.Relative));
                            }

                            MessageBox.Show("Sorry! Copies not available now");
                        }
                        else
                        {
                            lbl_book_id_replace.Content        = bk_detail.book_id;
                            lbl_book_name_replace.Content      = bk_detail.title;
                            lbl_book_publisher_replace.Content = bk_detail.publisher;
                            lbl_isbn_replace.Content           = bk_detail.isbn;
                            lbl_availablility_replace.Content  = bk_detail.no_of_copies;
                            lbl_cat_replace.Content            = bk_detail.category;

                            if (bk_detail.image != null)
                            {
                                BitmapImage image = Convertor.ToImage(bk_detail.image);
                                image_book.Source = image;
                            }
                            else
                            {
                                image_book.Source = new BitmapImage(new Uri(@"image/profile3.jpg", UriKind.Relative));
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No Book Found");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please insert member ID");
            }
        }