This is a migrated thread and some comments may be shown as answers.

Attaching Appointments to ResourceType

3 Answers 70 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Xpress
Top achievements
Rank 1
Xpress asked on 21 Mar 2012, 07:55 PM
I have an ObservableCollection that currently only has one ResourceType in it: Provider. I have 3 Providers in that ResourceType. I have a collection of Appointments that I have attached to the AppointmentSource.  When I did not have any ResourceType attached the appointments would appear in the scheduler just fine.  I have added the ResourceType and they are displaying correctly, but the appointments are not showing.  My collection of appointments is correctly populating still.  I have tried attaching the specific Provider I need to the Appointment's Resource, but I still cannot get them to show.  I am lost and would love any help that could be given.

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 26 Mar 2012, 12:53 PM
Hello,

When the ScheduleView is grouped by resources, the appointments should have a Resource assigned in order to be shown. I've attached a simple example to show how this works, please download the attachment and give it a try.

Kind regards,
Yana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Xpress
Top achievements
Rank 1
answered on 26 Mar 2012, 03:13 PM
Thanks for the example.  I did my best to follow the project you uploaded.  However, I am still not getting my appointments to show up under the resources.  If I don't have the resources, the appointments show up fine.  I'm going to throw out some code to see if you might be able to help more.

This is where I load my Provider data model which inherits Resource.

ProviderDataModel item = new ProviderDataModel();
item.ProviderID = (reader["ProviderID"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["ProviderID"]);
item.ProviderFirstName = (reader["ProviderFirstName"] == DBNull.Value) ? string.Empty : reader["ProviderFirstName"].ToString();
item.ProviderLastName = (reader["ProviderLastName"] == DBNull.Value) ? string.Empty : reader["ProviderLastName"].ToString();
item.ProviderMiddleInitial = (reader["ProviderMiddleInitial"] == DBNull.Value) ? string.Empty : reader["ProviderMiddleInitial"].ToString();
item.ProviderTitle = (reader["ProviderTitle"] == DBNull.Value) ? string.Empty : reader["ProviderTitle"].ToString();
item.DisplayName = item.LastFirstName;
item.ResourceName = item.ProviderID.ToString();
item.ResourceType = "Providers";
 
yield return item;

Once it is loaded I then add them all into a ResourceType

private void LoadResources()
{
    ResourceTypes = new ObservableCollection<ResourceType>();
    ResourceType providerResourceType = new ResourceType("Providers");
    foreach (ProviderDataModel provider in Providers)
    {
        providerResourceType.Resources.Add(provider);
    }
    ResourceTypes.Add(providerResourceType);
}

Once I have the ResourceTypes collection loaded I then load my appointments

public void LoadAppointments()
{
    if (SessionVariables.Instance.CurrentFacility != null)
    {
        Appointments = new ObservableCollection<AppointmentDataModel>(appointmentDA.LoadAppointments(SessionVariables.Instance.CurrentFacility.FacilityID, ApplicationVariables.ConnectionStrings.ApplicationConfigurationConnectionString));
        foreach (AppointmentDataModel appointment in Appointments)
        {
            appointment.Patient = Patients.Where(x => x.PatientID == appointment.Patient.PatientID).FirstOrDefault() ?? new PatientDataModel();
            appointment.AppointmentType = AppointmentTypes.Where(x => x.AppointmentTypeID == appointment.AppointmentType.AppointmentTypeID).FirstOrDefault() ?? new AppointmentTypeDataModel();
            ProviderDataModel tempProvider = Providers.Where(x => x.ProviderID == appointment.AppointmentProviderScheduledID).FirstOrDefault();
            if (tempProvider != null)
            {
                appointment.Resources.Add(tempProvider);
            }
        }
    }
}

I'm not at all sure what I'm doing wrong.  When I go through and check the properties of your example ResourceType collection and mine I can find no fundamental difference.  Thank you again for any help you can give.
0
Yana
Telerik team
answered on 27 Mar 2012, 11:33 AM
Hello,

We're not sure what could be the reason for this issue in your project.  Please check whether the Start and End of your appointments are in the VisibleRange of the ScheduleView,

We cannot help further without being able to reproduce and debug the problem locally. 

Regards,
Yana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
ScheduleView
Asked by
Xpress
Top achievements
Rank 1
Answers by
Yana
Telerik team
Xpress
Top achievements
Rank 1
Share this question
or