How to show Appointments?

Oct 8, 2010 at 9:07 AM

Hi All.

How do we show available appointments in week  view? can anyone suggest me?

I have refereed this code and came to know that there is one Method called PopulateContent in ucWeek.cs file, i have put some code in this method but I'm not able to display appointments, please help.

Thanks

Dhaval Panchal

Oct 13, 2010 at 6:30 PM
Edited Oct 14, 2010 at 2:52 AM

I have the same problem. 

I created an appointment in a specific day and it works. But when I switch to week view  the appointment is not there.

 

Any ideas?

 

Edit: 

We found that th method CalculateX for an appointment panel has issues. The coordinates are out of the visible area.

Coordinator
Nov 1, 2010 at 1:14 PM

There are known issues with the Week View in displaying the appointments.  Some of these issues have been corrected in the newer versions of the control.  If the newer versions still have the same issues let me know and I will attempt to look at.  I have not had time recently to keep up this site and work on the control library; however, I will be getting back into it soon.  Another thing that might help is that the newer versions of the control have been updated to only show single day appointments.  If the appointment is longer than 1 day then it will not show because there was an attempt to display longer appointments at the top in a "gnat chart" style graph.  Hope this helps, if not let me know and I will try to spend some time on it to get it working.

 

Thanks,

Apr 14, 2011 at 3:46 PM
mistermaik wrote:

I have the same problem. 

I created an appointment in a specific day and it works. But when I switch to week view  the appointment is not there.

 

Any ideas?

 

Edit: 

We found that th method CalculateX for an appointment panel has issues. The coordinates are out of the visible area.

About "CalculateX".

I was busy with it the whole day and made same modifications, and they worked!

The main idea is - intersecting group of appointents, and every of them should be sorted, for example, by start time and should have a position id.

 

So, in AppointmentItemsPanel.cs file I modified "ArrangeOverride" function.

When enumerating Appointments:

..............................

              x = CalendarViewModel.TimeSlotWidth;

                    switch (CalendarViewModel.CurrentDateView)
                    {
                        case DateView.Day:

                            // - my addition...
                            if (count > 1)
                            {
                                // - get the actual position of item in a intersecting group
                                //   sorted by StartDate...
                                int actual_pos = 0;
                                CalculateItemsAcualPosInGroup(item, out actual_pos);

                                x += ChildSize.Width * actual_pos;                           
                            }
                            break;

                        case DateView.WorkWeek:
                        case DateView.FullWeek:
                            x += CalculateX((AppointmentVM)item.DataContext, finalSize.Width, count, position);
                            break;
                    }

                    y = CalculateY((AppointmentVM)item.DataContext);

.............................................

As for "CalculateItemsAcualPosInGroup", the code is following:

  private void CalculateItemsAcualPosInGroup(ucAppointment item, out int actual_pos)
        {
            actual_pos = 0;

            AppointmentVM vm = (AppointmentVM)item.DataContext;

            List<ucAppointment> apps = this.Children.Select(c => c as ucAppointment).Where(c => c.GetType() == typeof(ucAppointment)).ToList();

            var orderdApps = apps.OrderBy(a => (a.DataContext as AppointmentVM).StartDate);

            foreach (ucAppointment app in orderdApps)
            {
                AppointmentVM avm = (AppointmentVM)app.DataContext;

                if ( TimeIntersection(avm.StartTime, avm.EndTime, vm.StartTime, vm.EndTime))
                {
                    if (avm == vm)
                        break;

                    actual_pos++;
                }
            }
        }

 

It works, I hope :)

Thanks for the control!

 

Oct 9, 2012 at 3:04 PM
Edited Oct 9, 2012 at 3:09 PM

Hi,

I created the Appointments from Day View/ any view but it didn't reflected in the Week view and the Appointment item is saved in the AppointmentsOptions.xml.

As mentioned by Narat the calculation of X values done in ArrangeOverride() function in AppointmentItemsPanel.cs is giving the size which is out of visible area, due to which the Appointments are not displayed in the Week View except the First Day of the Week i.e. either Sunday/Monday.

The above code i Checked and didn't resolve the issue.

So i took the X values calculation from AppointmentItemsExtPanel.cs and it solved the issue and now the Week View is working fine.

Solution :

-------------------------------------

ArrangeOverride() has been modified like below

----------------------------------------------------------------------------------------------------------------

 protected override Size ArrangeOverride(Size finalSize)

{

for (int i = 0; i < this.Children.Count; i++)

{

double y = 0;

double x = 0;

Size ChildSize = new Size();

UIElement child = (UIElement)this.Children[i];

if (child.GetType() == typeof(ucAppointment))

{

ucAppointment item = (ucAppointment)child;

int count = 1;

int position = 0;

CalculateItemsInSlot(item, out count, out position);

ChildSize = CalculateHeightWidth(finalSize, (AppointmentVM)item.DataContext, count);

x = CalendarViewModel.TimeSlotWidth;

switch (CalendarViewModel.CurrentDateView)

{

case DateView.Day:

x += ChildSize.Width * position;

break;

case DateView.WorkWeek:

case DateView.FullWeek:

/* 

* Modified Start - Copy the X value Calculation from AppointmentItemsExtPanel.cs

 * Copy the CalculateX() function also from AppointmentItemsExtPanel.cs

 */ 

// x += CalculateX((AppointmentVM)item.DataContext, finalSize.Width, count, position);

x += CalculateX((AppointmentVM)item.DataContext, finalSize.Width); 

/*Modified End - Copy the X value Calculation from AppointmentItemsExtPanel.cs */

break;

}

y = CalculateY((AppointmentVM)item.DataContext);

}

child.Arrange(new Rect(x, y, ChildSize.Width, ChildSize.Height));

}

return base.ArrangeOverride(finalSize);

}

----------------------------------------------------------------------------------------------------------------- 

--------------------------------------------

CalculateX() has been copied as it is.

--------------------------------------- 

private double CalculateX(AppointmentVM vm, double width)

DateTime _MondaysDate = CalendarViewModel.CurrentDate.AddDays((int)System.DayOfWeek.Monday - (int)CalendarViewModel.CurrentDate.DayOfWeek);

long DateDiff = FunctionExtensions.DateDiff(DateInterval.Day, _MondaysDate.Date, vm.StartDate.Date);

if (CalendarViewModel.CurrentDateView == DateView.FullWeek)

DateDiff += 1;

return (double)DateDiff * CalendarViewModel.DayItemWidth;

  }

--------------------------------------------------------------------------------------------------------------------

 

I hope this helps.

Oct 15, 2012 at 11:27 AM

Hi,

Could you please help me resolve the attached bugs.

Please find the bugs details in the doc <Calendar_UI_Bugs.doc> in Discussion section(Title: 'Calendar Bugs').



Many Thanks,
Rabison.