//Pos 1 / 2 cause only showing 2 weeks)
        public EventDate CreateEventDate(int Pos)
        {
            EventDate Clone = new EventDate();

            Clone.Event     = Event;
            Clone.StartTime = StartTime;
            Clone.StopTime  = StopTime;
            TimeSpan add   = new TimeSpan();
            DateTime today = DateTime.Today.Add(new TimeSpan(1, StartTime.Hour, StartTime.Minute, 0));

            // The (... + 7) % 7 ensures we end up with a value in the range [0, 6]
            int      daysUntilTargetDay = (((int)Day - (int)today.DayOfWeek + 7) % 7) + Pos * 7;
            DateTime nextDayOccurence   = today.AddDays(daysUntilTargetDay);

            Clone.Date = nextDayOccurence;
            return(Clone);
        }
Esempio n. 2
0
 public AppointmentRequest(ChatUserModel Owner, EventDate EventDate)
 {
     this.EventDate = EventDate;
     this.Owner     = Owner;
     State          = 0;
 }