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
No I do not.
heres how I get my all appointments for the month . code may be broken just copy and pasted and omitted some code. can't find anything better and this one is not that slow.
DateTime activeDate = Convert.ToDateTime(WebScheduleInfo1.ActiveDayUtc.ToShortDateString());
int months = DateTime.DaysInMonth(activeDate.Year, activeDate.Month);
//get all resource
//loop through all resources
{
WebScheduleInfo1.ActiveResourceName = employee;
//loop through all the days of the month
this.WebScheduleInfo1.DataBind();
ActivitiesSubsetCollection _coll = WebScheduleInfo1.GetAppointmentsForDate(WebScheduleInfo1.ActiveResource, dt);
//store your appointments in collection
}
jscatalina,
I am going to try your solution. I came up with one based on the data structures and reverse engineering the stored procedures provided by Infragistics. I think I can present your solution in a grid of activities for multiple people for a specific date!!! That is huge when the administrators of an office need to see all appointments for a specified date - and not have to poke through calendars for each individual in their command/office.
I am very concerned that my kluge will be very fragile since it does not act on the methods and properties documented by Infragistics.
By the way, It is not difficult to attach multiple resources to one activity. The Infragistics supplied tables seem to be designed for this (the ActivityResource table) but I think the api/user interface problems may have relegated that option to a future release. For example, if five folks are attached to a meeting (ie. five ActiveResources with the same Activity in the ActivityResource table) than what happens when someone clicks the Delete option. Maybe that guy is just stating he/she wants to bail from the meeting. Gets dicy.
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.
Regards.
Mike
Hi Mike,
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.
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.