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)); } } } }
private void button_click(object sender, RoutedEventArgs e) { Issue_Detail issueDetail = dataGrid.SelectedItem as Issue_Detail; issueDetail.return_date = DateTime.Now; DateTime dateDue = (DateTime)issueDetail.due_date; DateTime returnDate = (DateTime)dp_returndate.SelectedDate; if (returnDate > dateDue) { double noOfDays = (returnDate - dateDue).TotalDays; MessageBox.Show("Delayed return of a book"); total += noOfDays * finePerDay; lbl_fine.Content = total; } bool result = issueContoller.bookReturnedUpdate(issueDetail); if (result) { int memberid = Int32.Parse(txt_memberid.Text.Trim()); List <Issue_Detail> issueDetails = issueContoller.getReturnBookDetail(memberid); if (issueDetails.Count > 0) { dataGrid.ItemsSource = issueContoller.getReturnBookDetail(memberid); Console.WriteLine("Returned book count " + issueDetails.Count); } else { MessageBox.Show("No books to return for the current user"); } } else { MessageBox.Show("Faild to Update "); } }
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; } }