MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Way to add calendar events to the repository? (Zatvorena) (Mono Support )

14504 put(a) pogledan, 4 odgovor(a) 18.4.2012. 16:08:23Kreirao(la) Jeremy
Jeremy

Jeremy

18.4.2012. 16:08:23

Can anyone tell me the function to call to save a new event to the calendar event repository?

I have been able to create a new calendar using

repository.CreateCalendar(ownerId, name, slug)<BR>

I am having trouble finding a similar function to create an event that will save into the repository.

I can populate an event like this:

var newEvent = repository.GetNewCalendarEvent(authorId, calendarId);
newEvent.Title =
"Some title";
newEvent.Description = "Some
description";
newEvent.AllDay =
true;
newEvent.StartTime =
currentDay;
newEvent.EndTime = currentDay.AddDays(1);

What is the correct way to save a populated event back into the repository?

Ovaj sadržaj još nije ocijenjen. 
322 Reputacija 36 Ukupno objava
pajo

pajo

18.4.2012. 16:34:49
Hi Jeremy,

You're on right track. GetNewCalendarEvent will give you only in-memory instance of new event and it will not save it in database. Also this method will ensure newEvent has all required fields and it's attached to calendar. Sometimes you don't want to save new event to persistent storage at the time of creation, you may need to validate it before saving it. To save it to database you need to use generic SaveEntity method, you just need to add this code after populating your event

repository.SaveEntity(newEvent);

If you don't have create or save method for entity you can use generic SaveEntity on any repository to save it to persistent storage.
Ocjena 5,00, 1 glas(ova). 
629 Reputacija 83 Ukupno objava
Jeremy

Jeremy

18.4.2012. 23:03:51
Thank you. That was the missing piece of the puzzle. I have been able to save the new event back into the repository now and have seen it in the database table.
Ovaj sadržaj još nije ocijenjen. 
322 Reputacija 36 Ukupno objava
Leonardo

Leonardo

17.1.2014. 16:35:43
Hello. Can anyone tell me how to save recurring events on the calendar. Thanks in advance ...
Ovaj sadržaj još nije ocijenjen. 
20 Reputacija 2 Ukupno objava