时隙和预约C# [英] Time Slots and Appointment Reservation C#
本文介绍了时隙和预约C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我有一个医院应用程序,病人可以在线登录并预订一个时间段去看特定的医生.我该如何为每个医生安排15分钟的时间段,而当一个病人预订一个时间段时,另一个病人就不能预订该时间段?
干杯,
Dear all,
I have a hospital application where a patient can log on online and book a time slot to see a specific doctor. How can I make time slots of 15 minutes for each doctor and when a patient book a time slot it can''t be booked by another patient?
Cheers,
推荐答案
你好
使用完整DateTime
例如:
您有预订列表.
Hello
Use FullDateTime
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;
}
这篇关于时隙和预约C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文