private void DisplayBookCheckOutHistory(int bookId) { var dbOperations = new GenericDatContext(); var borrowers = dbOperations.GetCheckOutSummeryByBook(bookId); HistoryList.DataSource = borrowers; HistoryList.DataBind(); }
private void displayBorrowerDeails(int BookID) { var dbOperations = new GenericDatContext(); var borrower = dbOperations.GetCheckOutSummeryByBook(BookID).ToList().FirstOrDefault(); if (borrower != null) { lblName.Text = borrower.User.FirstName + borrower.User.LastName; lblMobile.Text = borrower.User.MobileNumber; lblReqReturnDate.Text = borrower.CheckOutDate.AddDays(21).ToShortTimeString(); lblReturnDate.Text = DateTime.Now.ToString(); var NumberOfDaysPassed = borrower.CheckOutDate.GetNumberOfDays(); var penaltyAmount = NumberOfDaysPassed.CalculatePenalty(); lblPenaltyAmount.Text = string.Format("{0:#,##0.00}", penaltyAmount); } else { Utilities.setPageMessage("Book is either already checked in or was not found.", Utilities.severity.error, Page.Master); } }
private void displayBooks() { var genericDatContext = new GenericDatContext(); try { var books = genericDatContext.GetBookList(); BooksList.DataSource = books; BooksList.DataBind(); } catch (Exception ex) { Utilities.setPageMessage(ex.Message, Utilities.severity.error, Page.Master); var applicationErrorDataContext = new ApplicationErrorDataContext(); var errorEntity = new ErrorEntity(); errorEntity.ErrorDateTime = DateTime.Now; errorEntity.ErrorDescription = ex.StackTrace; errorEntity.ErrorMessage = ex.Message; errorEntity.UserID = 0; applicationErrorDataContext.InsertApplicationError(errorEntity); } }