Current location - Training Enrollment Network - Books and materials - C# is a book management system, which requires each user to borrow only 2 months and at most 3 books. How to set it?
C# is a book management system, which requires each user to borrow only 2 months and at most 3 books. How to set it?
If you know the borrowing date, you can calculate the return date, and when users borrow books, you can limit it. As for borrowing at most three books, you just add a judgment to judge whether the number of books submitted by users is greater than three, and if so, give a prompt;

DateTime DateNow = date time. Now; //Get the current system time;

Date time date = date time. parse(" 20 14- 10-0 1 "); //Borrowing time; If it is DateTime data, no conversion is needed;

//Judge whether the number of days minus the borrowing time from the current time is more than 60 days;

If (DateNow. Subtract (date). Duration (). Day & gt60)

{

MessageBox。 Show ("borrowing time exceeds 60 days");

}