private void CtrlCalendarScheduleMonth_Load(
            object sender,
            EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            ultraCalendarInfo1.SaveSettings = false;
            _ds = new DataSet();
            var aOutlookClass = new OutlookClass();
            ATable = aOutlookClass.GetAllCalendarItems();
            _ds.Tables.Add(ATable);
            // Set the BindingContextControl so the component will use the same context that other controls on the form use.
            ultraCalendarInfo1.DataBindingsForAppointments.BindingContextControl = this;
            // Set the BindingContextControl so the component will use the same context that other controls on the form use.
            ultraCalendarInfo1.DataBindingsForOwners.BindingContextControl = this;
            if (ATable != null)
            {
                GlobalSettings.CalendarData = ATable;
                foreach (DataRow row in _ds.Tables[0].Rows)
                {
                    var startTime = (DateTime) row["StartTime"];
                    var endTime = (DateTime) row["Endtime"];
                    var startDateTime = (DateTime) row["StartDate"];
                    startDateTime = startDateTime.AddHours(startTime.Hour);
                    startDateTime = startDateTime.AddMinutes(startTime.Minute);
                    var endtDateTime = (DateTime) row["EndDate"];
                    endtDateTime = endtDateTime.AddHours(endTime.Hour);
                    endtDateTime = endtDateTime.AddMinutes(endTime.Minute);

                    var appointment = new Appointment
                        (
                        (DateTime) row["StartDate"],
                        (DateTime) row["EndDate"])
                                      {
                                          StartDateTime = startDateTime,
                                          EndDateTime = endtDateTime,
                                          Subject = row["Subject"].ToString(),
                                          AllDayEvent = (bool) row["AllDayEvent"],
                                          Location = row["Location"].ToString(),
                                          Description = row["Body"].ToString()
                                      };

                    ultraCalendarInfo1.Appointments.Add(appointment);
                }
            }

            ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "StartDate";
            ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "EndDate";
            ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "Subject";

            ultraMonthViewSingle1.CalendarInfo = ultraCalendarInfo1;

            DateTime datetimeToShow = DateTime.Now;
            Day activeDate = ultraCalendarInfo1.GetDay
                (
                    datetimeToShow,
                    true);
            ultraCalendarInfo1.ActiveDay = activeDate;

            // // Click the drop down button visible on the right corner of the control's Owner header for the list of Owners.
            //// ultraMonthViewSingle1.OwnerNavigationStyle = OwnerNavigationStyle.DropDown;

            // // TODO: Set the ViewStyle for UltraCalendarLook and assign it to ultraMonthViewSingle
            // // Styling through AppStylist is a better way of styling the controls.
            // // See Program.cs file for AppStyling code
            // // this.ultraCalendarLook1.ViewStyle = Infragistics.Win.UltraWinSchedule.ViewStyle.Office2007;
            ultraMonthViewSingle1.CalendarLook = ultraCalendarLook1;
            Cursor = Cursors.Default;
        }
        private void CtrlCalendarScheduleDay_Load(
            object sender,
            EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            ultraCalendarInfo1.Appointments.Clear();
            ultraCalendarInfo1.SaveSettings = false;
            _ds = new DataSet();
            var aOutlookClass = new OutlookClass();
            DataTable aTable = aOutlookClass.GetAllCalendarItems();
            _ds.Tables.Add(aTable);
            // Set the BindingContextControl so the component will use the same context that other controls on the form use.
            ultraCalendarInfo1.DataBindingsForAppointments.BindingContextControl = this;
            // Set the BindingContextControl so the component will use the same context that other controls on the form use.
            ultraCalendarInfo1.DataBindingsForOwners.BindingContextControl = this;
            if (aTable != null)
            {
                foreach (DataRow row in _ds.Tables[0].Rows)
                {
                    if ((DateTime) row["StartDate"] != Aday.Date)
                    {
                        continue;
                    }
                    var startTime = (DateTime) row["StartTime"];
                    var endTime = (DateTime) row["Endtime"];
                    var startDateTime = (DateTime) row["StartDate"];
                    startDateTime = startDateTime.AddHours(startTime.Hour);
                    startDateTime = startDateTime.AddMinutes(startTime.Minute);
                    var endtDateTime = (DateTime) row["EndDate"];
                    endtDateTime = endtDateTime.AddHours(endTime.Hour);
                    endtDateTime = endtDateTime.AddMinutes(endTime.Minute);

                    var appointment = new Appointment
                        (
                        (DateTime) row["StartDate"],
                        (DateTime) row["EndDate"])
                                      {
                                          StartDateTime = startDateTime,
                                          EndDateTime = endtDateTime,
                                          Subject = row["Subject"].ToString(),
                                          AllDayEvent = (bool) row["AllDayEvent"],
                                          Location = row["Location"].ToString(),
                                          Description = row["Body"].ToString()
                                      };

                    ultraCalendarInfo1.Appointments.Add(appointment);
                }
            }
            //ultraCalendarInfo1.DataBindingsForAppointments.DataSource = ultraCalendarInfo1.Appointments;
            // TODO:2. Set the properties for AppointmentsDataBinding and OwnersDataBinding objects
            ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "StartTime";
            ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "EndTime";
            ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "Subject";
            ultraCalendarInfo1.DataBindingsForAppointments.OwnerKeyMember = "OwnerKey";
            ultraCalendarInfo1.DataBindingsForOwners.KeyMember = "OwnerKey";
            ultraCalendarInfo1.DataBindingsForOwners.NameMember = "Name";
            //Ensure Day Selected Is Day Shown
            ultraCalendarInfo1.ActiveDay = Aday;
            ultraDayView1.CalendarInfo = ultraCalendarInfo1;
            Cursor = Cursors.Default;

            //// Show July 2nd 2010 as the active day in UltraDayView
            //var activeday = Aday;
            //this.ultraCalendarInfo1.ActiveDay = activeday;

            #region Grouping

            // TODO: You can change the grouping style to see the alternative grouping style.
            ultraDayView1.GroupingStyle = DayViewGroupingStyle.DateWithinOwner;

            #endregion

            #region Styling UltraDayView

            // TODO: Set the ViewStyle for UltraCalendarLook and assign it to UltraDayView
            // Styling through AppStylist is a better way of styling the controls.
            // See Program.cs file for AppStyling code.
            // this.ultraCalendarLook1.ViewStyle = ViewStyle.Office2007;
            // this.ultraDayView1.CalendarLook = this.ultraCalendarLook1;

            #endregion
        }