且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

时隙和预约C#

更新时间:2023-02-26 20:04:07

你好

使用完整DateTime

例如:
您有预订列表.
Hello

Use Full DateTime

For example:
You have a List of Reservation.
List<reservation> ReservationList;


这是预订类:


This is the Reservation class:

public class Reservation
{
   public Doctor Doctor {get; set;}
   public DateTime GettingTime {get; set;}
   public DateTime ExpiredTime {get; set;}
}





public bool IsReserved(Doctor doctor, DateTime startDateTime, DateTime expiredDatetime, List<reservation> list)
{
   return (list.Where(r=>r.Doctor == doctor && startDateTime>=r.GettingTime && startDateTime<=r.ExpiredTime && expiredDatetime<r.GettingTime).Count()==0) true:false;
}