Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Display Available Spaces in Event Calendar View modes: 
User avatar
Member
Member
ewanm - 2/8/2012 5:09:35 AM
   
Display Available Spaces in Event Calendar
Hi there,

I am looking to implement the EventCalendar web part and require to display the remaining available spaces at an event as well as the event capacity. Is this possible?

I can modify the transformation to display the data but where can I pick the data up.

Ewanm

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 2/8/2012 11:30:15 AM
   
RE:Display Available Spaces in Event Calendar
You'll need to create a custom method that you can use in your transformations. This can be any class with static methods in your project. Something like this will work

public class BookingEventMethods
{
public static int GetAttendeeCount(object BookingEventNodeID)
object qResult = null;

using(SqlCommand cmd = new SqlCommand("Select Count(AttendeeID) as NumAttendees from Events_Attendee WHERE AttendeeEventNodeID = @NodeID",GetYourConnectionString())
{
cmd.Parameters.AddWithValue("NodeID",BookingEventNodeID);
qResult = cmd.ExecuteScalar();
}
return ValidationHelper.GetInteger(qResult,0);
}


Then you can do something like this in your transformation:

Remaining Capacity: <%# ((int)Eval("EventCapacity") - BookingEventMethods.GetAttendeeCount(Eval("NodeID"))).ToString() %>

User avatar
Member
Member
kentico_michal - 2/9/2012 3:01:02 AM
   
RE:Display Available Spaces in Event Calendar
Hello,

You can create a custom transformation method as mentioned in the previous post and use the following method to get the count of event attendees:

int actualCount = EventAttendeeInfoProvider.GetEventAttendeesCount(eventNodeID);

Best regards,
Michal Legen

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 2/9/2012 10:03:06 AM
   
RE:Display Available Spaces in Event Calendar
Thanks for that nice addition Michal. I didn't know about that method.

User avatar
Member
Member
ewanm - 2/9/2012 6:04:01 AM
   
RE:Display Available Spaces in Event Calendar
Hi,

Thanks for the reply, I'm a novice at this so could you talk me through how to implement this. How would I create a custom method. Could you even point me to the correct documentation as I have searched and cannot find help.

Regards and thanks again,

Ewanm

User avatar
Member
Member
kentico_michal - 2/9/2012 6:55:47 AM
   
RE:Display Available Spaces in Event Calendar
Hello,

Sure, you can find more information how to create a custom transformation method here:
Adding custom functions to transformations.

Best regards,
Michal Legen