Hi Infragistics,
How to merge all resources and activities in unique WebSchedule?
Best regards
If you mean simultaneously displaying the Activities of multiple Resources together on one WebSchedule view, then no that isn't directly supported.
Some people have successfully created WebSchedule views that can appear like they have the Activities for several different Resources on them, by styling their Activities differently in the InitializeActivity event based on the Resource they want the end user to think owns the Activity. All Activities are still technically owned by a single, active Resource.
Hi Derek,
have you a complete c# example, but i have a lot problems with this.
Thanks
Hi Roger and jscatalina,
I'm trying to implement exactly the type of solution you've described, but as new-ish user of WebSchedule, I'm struggling to get this to work as a single view of all appointments. I'm trying to render an aggreagted view in a dayview or monthview, but it's not clear to me how to render that with a loop of different activeresource names. I see that jcatalina loops the resources, then loops the days, getting a collection of appointments for each day - but what then happens to that collection - in other words, the point in the example which is commented with " //store your appointments in collection" ?
How exactly do we get that collection to render in a single day or month view control?
Thanks in advance for any pointers you can give.
Mike
Mike,
My solution did not incorporate displaying the appointments in any of the schedule views. I placed those appointments in a grid of appointments that could be sorted and grouped. When the appointment count and resource count grows large a grid is probably the cleanest look - since there is only so much room on a calendar entry point.
Regardless, I think a potential solution was provided by Derek Harmon in his 2008/04/01 post. It was only a hint of an algorithm and he was unable to provide any source, but... His solution seemed to depend on restyling the schedule view as it was generated and spoofing other resources into a single resource on the fly. It should be possible - but, styling is not my style - yuk yuk
Again, if you are displaying multiple appointments from multiple clients (or office slugs) it might be better to use jscatalina's algorithm to fill a 'datatable' and display the information in a WebGrid. I don't mean to be presumptuous, but them little boxes filled with lots of appointments for lots of people can get a bit confusing. Maybe, on the other hand, you can generate a tabbed view and display each individuals appointments on a separate tab.
By the way, I would like to thank jscatalina for his/her algorithm. It did get me away from a non-standard use of Infragistics stored procedures. It was far more reliable than my solution. And, in the end, the code was understandable.
Ah! Now I see! I had incorrectly assumed that you were getting the collection of appointments and rendering them to a dayview control or similar.
Roger - and for anyone else who may like to use one possible method of preparing an aggregate view -
I thought you may be interested in the approach I eventually took to get the aggregated view working.
Instead of generating the copy appointment at rendering, which was going to be slow, I've taken the approach of creating, updating and deleting a mirror copy of each real appointment, with the active resource of the mirror appointment being a resource called "Aggregate".
For each page where webscheduleinfo is used to add, alter or delete an appointment, I've added handlers which also perform those operations on the mirror appointment, whenever the real appointment is affected in some way. The mirror appointment location field contains the name of the real resource. Then, when we render month or day views, we can see either the appointments for a single person, or the Aggregate view, in which the location shows us which real person (real resource) the apointment relates to.
The database required a single simple look up table adding, to link the id of the real appointment to the id of the mirror appointment. Then, the two are synchronised.
Of course, this information could just as easily be displayed in a grid, so we've put the aggregate monthview in a tab, with a grid view of the same data alongside in a separate tab, and the user can then choose which view they prefer. One limitation at the moment is we've prevented updates on the aggregate view: the users select the real resource to make any updates, which are then reflected in the aggregate
The scalability seems OK, and I've not found any particular problems so far.
The remaining task is to use styling (sorry Roger ! :-) ), as Derek originally suggested, to add colour coding to the aggregate view, for an easy to read display.
Regards.
Hi Mike,
WINSCHEDULE MERGE:
{
this.ultraDayView1.GroupingStyle = DayViewGroupingStyle.NoGrouping;
this.ultraMonthViewSingle1.OwnerDisplayStyle = OwnerDisplayStyle.Merged;
}
else
this.ultraDayView1.GroupingStyle = DayViewGroupingStyle.DateWithinOwner;
this.ultraMonthViewSingle1.OwnerDisplayStyle = OwnerDisplayStyle.Separate;
Lello Passannanti
Hi jurisquick,
I can't provide a complete example, because it's client work. But, I've included some detailed VB.Net snippets below, which I hope will help.
If you need translations to C#, I suggest you use http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx
Here are the snippets:
On the page where you use webscheduleinfo, in page load, add handlers for the activity added, updated and deleted event, like this:
'Add a handler for the customer activity added event AddHandler WebScheduleInfo1.ActivityAdded, AddressOf Me.AddCustomerActivity 'Add a handler for the customer activity deleted event AddHandler WebScheduleInfo1.ActivityDeleted, AddressOf Me.DeleteCustomerActivity 'Add a handler for the customer activity updated event AddHandler WebScheduleInfo1.ActivityUpdated, AddressOf Me.UpdateCustomerActivity
Then in each handler, add some additional logic to add/update/delete the mirror appointment, for example:
Private Sub AddCustomerActivity(ByVal s As Object, ByVal e As Infragistics.WebUI.WebSchedule.ActivityEventArgs)
'Capture the newly added activity Try
Dim cusappointment As Infragistics.WebUI.WebSchedule.Appointment cusappointment = e.Activity
Dim eventid as integer = e.datakey
Dim cusScheduleInfo As Infragistics.WebUI.WebSchedule.WebScheduleInfo cusScheduleInfo = cusappointment.ScheduleInfo cusScheduleInfo.DataBind()
AddMirrorActivity(WebScheduleInfoAgg, WebScheduleInfo1, SqlDataSourceAgg, WebScheduleSqlClientProviderAgg, eventid, ....)
.....
Catch etc. End Try
End Sub
Private Sub AddMirrorActivity(ByVal WebScheduleInfoAggregate As WebScheduleInfo, ByVal WebScheduleInfoReal As WebScheduleInfo, ByVal SqlDataSourceAggregate As SqlDataSource, ByVal WebScheduleSqlClientProviderAggregate As WebScheduleSqlClientProvider, ByVal AppointmentID As Integer ...)
Try
WebScheduleInfoAggregate.ActiveResourceName = "Aggregate"
SqlDataSourceAggregate.DataBind() WebScheduleInfoAggregate.DataBind(
Dim realappt As Appointment realappt = FindAppointment(AppointmentID, WebScheduleInfoReal)
If Not IsNothing(realappt) Then
'Now create a new mirror appointment for the Aggregate resource WebScheduleInfoAggregate.DataBind() Dim appt As New Appointment(WebScheduleInfoAggregate)
appt.EndDateTime = realappt.EndDateTime appt.Duration = realappt.Duration appt.AllDayEvent = realappt.AllDayEvent appt.Status = realappt.Status appt.Subject = realappt.Subject appt.StartDateTime = realappt.StartDateTime appt.Description = realappt.Description appt.ShowTimeAs = realappt.ShowTimeAs appt.ResourceKey = WebScheduleInfoAggregate.ActiveResource.DataKey
WebScheduleInfoAggregate.Activities.Add(appt) WebScheduleSqlClientProviderAggregate.AddActivity(appt, WebScheduleInfoAggregate.ActiveResource) SqlDataSourceAggregate.DataBind() WebScheduleInfoAggregate.DataBind()
Dim NewApptKey As Integer = appt.DataKey AddAppointmenttLink(Appointmentid, NewApptKey ...)
Catch etc.. End Try
Now replicate this approach for the update and delete handlers .....
In your page which displays the aggregate resource, bind the dayview to the aggregate resource, which will then contain only the "mirror" appointments.