コード例 #1
0
        public override void SetTimeSlot(int userId, DateTime startTime, DateTime endTime)
        {
            if (!User.GetInstance(EnumRole.Interviewer).IsUserExists(userId))
            {
                throw new Exception("No user exists with given id, please re enter user id");
            }
            if (endTime <= startTime)
            {
                throw new Exception("Start date must be smaller than end date!");
            }

            if (startTime.Year != endTime.Year || startTime.DayOfYear != endTime.DayOfYear)
            {
                throw new Exception("Day of start date and end date must be the same!");
            }

            if (startTime.Minute > 0 || endTime.Minute > 0)
            {
                throw new Exception("Start and end times must be beginning of hours.");
            }

            if (startTime < DateTime.Today || endTime < DateTime.Today)
            {
                throw new Exception("Start/end date cannot be earlier than today!");
            }

            AvailableTimeSlotsDataRepository.SetTimeSlot(userId, startTime, endTime);
        }
コード例 #2
0
ファイル: TimeSlot.cs プロジェクト: seymabati/interview
        internal void QueryAvailabilities(int candidateIdValue, string interwieverIDValues)
        {
            if (!User.GetInstance(EnumRole.Candidate).IsUserExists(candidateIdValue))
            {
                throw new Exception("Candidate user id is wrong, no such user exists!");
            }

            if (!User.IsInterviewerUsersExists(interwieverIDValues))
            {
                throw new Exception("Interviewer user id is wrong, no such user exists!");
            }

            int[] ids = Util.GetIds(interwieverIDValues);
            AvailableTimeSlotsDataRepository.QueryAvailabilities(candidateIdValue, ids);
        }