none
comparison for two datetime RRS feed

  • Question

  •   start = dateTimePicker1.Value;
                end = dateTimePicker2.Value;
                AvailabilityOptions myOptions = new AvailabilityOptions();
                myOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusyMerged;
                // Return a set of free/busy times.
                GetUserAvailabilityResults freeBusyResults = service.GetUserAvailability(attendees,
                                                                                     new TimeWindow(DateTime.Now, DateTime.Now.AddDays(1)),
                                                                                    AvailabilityData.FreeBusy, myOptions);
                int i = 0;
                bool flag = true;
                foreach (AttendeeAvailability availability in freeBusyResults.AttendeesAvailability)
                {
                    /*    foreach (CalendarEvent calendarItem in availability.CalendarEvents)
                        {
    
                            if (DateTime.Compare(calendarItem.StartTime, start) < 0 && DateTime.Compare(calendarItem.EndTime, end) > 0)
                            {
                                flag = false;
                                break;
                            }
                         }
                        if (flag)
                        {
                            textBox2.Text += ("Availability information for:" + attendees[i].SmtpAddress + "\r\n" + "The meeting room state is free" + "\r\n" + "\r\n");
                        }
                        flag = true;
                    */
    
    
                    foreach (CalendarEvent calendarItem in availability.CalendarEvents)
                    {
                        if (calendarItem.StartTime.CompareTo(start) < 0 && calendarItem.EndTime.CompareTo(end) > 0)
                            textBox2.Text += ("EndTime:" + calendarItem.EndTime + "\n\r");
                    }
                    i++;
                }

    I have  a question in if{} blocks,is there anyting wrong for if judgement? The process don't work with if blocks.

    Monday, June 16, 2014 11:41 AM

Answers