Example #1
0
        public bool IsRoomFreeExaminations(DateTime newStartTime, DateTime newEndTime, int RoomId)
        {
            Controller.ExaminationController examinationController = new Controller.ExaminationController();
            List <Model.Examination>         examinations          = examinationController.GetAllExaminations();

            foreach (Examination examination in examinations)
            {
                //if(((ex.StartTime<=newTime1) && (ex.EndTime>newTime1)) || ((ex.StartTime<newTime2)&&(ex.EndTime>=newTime2)))
                int start1 = DateTime.Compare(examination.StartTime, newStartTime);
                int start2 = DateTime.Compare(examination.EndTime, newStartTime);
                int end1   = DateTime.Compare(examination.StartTime, newEndTime);
                int end2   = DateTime.Compare(examination.EndTime, newEndTime);

                if (((start1 <= 0 && start2 >= 0) || (end1 <= 0 && end2 >= 0) || (start1 >= 0 && end2 <= 0)) && (RoomId == examination.room.RoomId))
                {
                    return(false);
                }
            }
            return(true);
        }
 public DoctorHome()
 {
     InitializeComponent();
     ExaminationControl = new Controller.ExaminationController();
     LoadAll();
 }