Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsAdding Event CodeAdding Event Code
Previous
 
Next
New Post
3/19/2013 8:44 AM
 
Not at the moment!! I am allowing any registered user to add an event using a start date and time, finish date and time, event name, short description and customfield1 for location.

Eventually Ill work out a better way for location but I need the KISS theory for my users for which we will hopefully have thousands in my small city subscribed to site.

Anymore than these fields and they will be easily confused

Mark Cooney
Programmer
Ely, Cambridgeshire
07767150058
CambsCreative
mark@cambscreative.co.uk

Visit Ely City Website
 
New Post
3/19/2013 9:05 AM
 
Ok, so have added a new section to add recurmasterid but am getting an error object not reference error. Full code below, any ideas?

Dim ev As New Modules.Events.EventInfo
With ev
.EventID = -1
.ModuleID = 474
.EventTimeBegin = "2013-03-23 09:00:00.000"
.Duration = 100
.EventName = "Marks Test Event"
.EventDesc = "My program tester"
.Importance = EventInfo.Priority.Medium
.Reminder = "You requested reminding about the following Event:
" & _
"
[event:title]

on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT] [event:timezone]
" & _
"to [NOTALLDAYEVENT][event:enddate][/NOTALLDAYEVENT][ALLDAYEVENT][event:enddate|D][/ALLDAYEVENT]
[event:description]"
.Notify = "Event Reminder: [event:title] on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT]"
.CreatedByID = UserId
.Approved = False
.PortalID = PortalId
.Signups = False
.MaxEnrollment = 0
.EnrollRoleID = 0
.EnrollFee = 0
.EnrollType = "FREE"
.PayPalAccount = "host@paypal.com"
.Cancelled = False
.ImageURL = ""
.ImageType = ""
.ImageWidth = 0
.ImageHeight = 0
.ImageDisplay = False
.SendReminder = True
.ReminderTime = 24
.ReminderTimeMeasurement = "h"
.ReminderFrom = "info@elycity.co.uk"
.SearchSubmitted = True
.CustomField1 = ""
.CustomField2 = ""
.LastUpdatedAt = Now()
.OriginalDateBegin = "2013-03-23 09:00:00.000"
.LastUpdatedID = UserId
.OwnerID = UserId
.EnrollListView = False
.NewEventEmailSent = True
.DisplayEndDate = True
.AllDayEvent = False
.DetailPage = False
.DetailURL = ""
.DetailNewWin = False
.CreatedDate = Now()
.AllowAnonEnroll = False
.ContentItemID = 0
.JournalItem = True
.Summary = ""
.Sequence = 1


Dim eli As New EventLocationController
.Location = eli.EventsLocationGet(1, PortalId).Location

Dim eci As New EventCategoryController
.Category = eci.EventCategoryGet(1, PortalId).Category

Dim ri As New EventRecurMasterInfo
With ri
.ModuleID = ModuleId
.PortalID = PortalId
.RRULE = ""
.DTSTART = ev.EventTimeBegin
.Duration = ev.Duration & "M"
.Until = ev.EventTimeBegin
.EventName = ev.EventName
.EventDesc = ev.EventDesc
.Importance = ev.Importance
.Reminder = ev.Reminder
.Notify = ev.Notify
.Approved = ev.Approved
.Signups = ev.Signups
.MaxEnrollment = ev.MaxEnrollment
.EnrollRoleID = ev.EnrollRoleID
.EnrollFee = ev.EnrollFee
.EnrollType = ev.EnrollType
.PayPalAccount = ev.PayPalAccount
.ImageURL = ev.ImageURL
.ImageType = ev.ImageType
.ImageWidth = ev.ImageWidth
.ImageHeight = ev.ImageHeight
.ImageDisplay = ev.ImageDisplay
.Location = ev.Location
.Category = ev.Category
.SendReminder = ev.SendReminder
.ReminderTime = ev.ReminderTime
.ReminderTimeMeasurement = ev.ReminderTimeMeasurement
.ReminderFrom = ev.ReminderFrom
.CustomField1 = ev.CustomField1
.CustomField2 = ev.CustomField2
.EnrollListView = ev.EnrollListView
.DisplayEndDate = ev.DisplayEndDate
.AllDayEvent = ev.AllDayEvent
.OwnerID = ev.OwnerID
.CultureName = "en-gb"
.CreatedByID = ev.CreatedByID
.CreatedDate = ev.CreatedDate
.UpdatedByID = ev.LastUpdatedID
.UpdatedDate = ev.LastUpdatedAt
.DetailPage = ev.DetailPage
.DetailURL = ev.DetailURL
.DetailNewWin = ev.DetailNewWin
.EventTimeZoneId = TimeZone.CurrentTimeZone.StandardName
.AllowAnonEnroll = ev.AllowAnonEnroll
.ContentItemID = ev.ContentItemID
.SocialGroupID = 0
.SocialUserID = 0
.Summary = ev.Summary
End With

Dim rc As New EventRecurMasterController
.RecurMasterID = rc.EventsRecurMasterSave(ri).RecurMasterID

End With

Dim a As New Modules.Events.EventController
a.EventsSave(ev, False)

Mark Cooney
Programmer
Ely, Cambridgeshire
07767150058
CambsCreative
mark@cambscreative.co.uk

Visit Ely City Website
 
New Post
3/19/2013 9:14 AM
 
Sorted, amended a few things:

Dim ev As New Modules.Events.EventInfo
With ev
.EventID = -1
.ModuleID = 474
.EventTimeBegin = "2013-03-23 09:00:00.000"
.Duration = 100
.EventName = "Marks Test Event"
.EventDesc = "My program tester"
.Importance = EventInfo.Priority.Medium
.Reminder = "You requested reminding about the following Event:
" & _
"
[event:title]

on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT] [event:timezone]
" & _
"to [NOTALLDAYEVENT][event:enddate][/NOTALLDAYEVENT][ALLDAYEVENT][event:enddate|D][/ALLDAYEVENT]
[event:description]"
.Notify = "Event Reminder: [event:title] on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT]"
.CreatedByID = UserId
.Approved = False
.PortalID = PortalId
.Signups = False
.MaxEnrollment = 0
.EnrollRoleID = 0
.EnrollFee = 0
.EnrollType = "FREE"
.PayPalAccount = "host@paypal.com"
.Cancelled = False
.ImageURL = ""
.ImageType = ""
.ImageWidth = 0
.ImageHeight = 0
.ImageDisplay = False
.SendReminder = True
.ReminderTime = 24
.ReminderTimeMeasurement = "h"
.ReminderFrom = "info@elycity.co.uk"
.SearchSubmitted = False
.CustomField1 = ""
.CustomField2 = ""
.OriginalDateBegin = "2013-03-23 09:00:00.000"
.LastUpdatedID = UserId
.OwnerID = UserId
.EnrollListView = False
.NewEventEmailSent = False
.DisplayEndDate = True
.AllDayEvent = False
.DetailPage = False
.DetailURL = ""
.DetailNewWin = False
.AllowAnonEnroll = False
.ContentItemID = 0
.JournalItem = True
.Summary = Nothing


Dim eli As New EventLocationController
.Location = eli.EventsLocationGet(1, PortalId).Location

Dim eci As New EventCategoryController
.Category = eci.EventCategoryGet(1, PortalId).Category

Dim ri As New EventRecurMasterInfo
With ri
.RecurMasterID = -1
.ModuleID = ModuleId
.PortalID = PortalId
.RRULE = ""
.DTSTART = ev.EventTimeBegin
.Duration = CType(ev.Duration, String) + "M"
.Until = ev.EventTimeBegin
.EventName = ev.EventName
.EventDesc = ev.EventDesc
.Importance = CType(ev.Importance, EventRecurMasterInfo.Priority)
.Reminder = ev.Reminder
.Notify = ev.Notify
.Approved = ev.Approved
.Signups = ev.Signups
.MaxEnrollment = ev.MaxEnrollment
.EnrollRoleID = ev.EnrollRoleID
.EnrollFee = ev.EnrollFee
.EnrollType = ev.EnrollType
.PayPalAccount = ev.PayPalAccount
.ImageURL = ev.ImageURL
.ImageType = ev.ImageType
.ImageWidth = ev.ImageWidth
.ImageHeight = ev.ImageHeight
.ImageDisplay = ev.ImageDisplay
.Location = ev.Location
.Category = ev.Category
.SendReminder = ev.SendReminder
.ReminderTime = ev.ReminderTime
.ReminderTimeMeasurement = ev.ReminderTimeMeasurement
.ReminderFrom = ev.ReminderFrom
.CustomField1 = ev.CustomField1
.CustomField2 = ev.CustomField2
.EnrollListView = ev.EnrollListView
.DisplayEndDate = ev.DisplayEndDate
.AllDayEvent = ev.AllDayEvent
.OwnerID = ev.OwnerID
.CreatedByID = ev.CreatedByID
.UpdatedByID = ev.LastUpdatedID
.DetailPage = ev.DetailPage
.DetailURL = ev.DetailURL
.DetailNewWin = ev.DetailNewWin
.EventTimeZoneId = TimeZone.CurrentTimeZone.StandardName
.AllowAnonEnroll = ev.AllowAnonEnroll
.ContentItemID = ev.ContentItemID
.SocialGroupID = 0
.SocialUserID = 0
.Summary = ev.Summary
.CultureName = "en-GB"
End With

Dim rc As New EventRecurMasterController
.RecurMasterID = rc.EventsRecurMasterSave(ri).RecurMasterID

End With

Dim a As New Modules.Events.EventController
a.EventsSave(ev, False)

Mark Cooney
Programmer
Ely, Cambridgeshire
07767150058
CambsCreative
mark@cambscreative.co.uk

Visit Ely City Website
 
New Post
3/19/2013 9:35 AM
 
A point to note for anyone using this code. Only works on upto 6.1.1 of Events module, will fall over on 6.0.4

Mark Cooney
Programmer
Ely, Cambridgeshire
07767150058
CambsCreative
mark@cambscreative.co.uk

Visit Ely City Website
 
New Post
3/19/2013 10:28 AM
 
You want to ensure that all EventTimeZoneIDs are the same (unless you enable per event timezones). Your current code allows different events in different timezones - bear in mind your users may travel. (Having said that, not sure where TimeZone.CurrentTimeZone gets it's data from, whether it is server or user based).

DNN MVP
Events - Get the latest version - Upgrade now!!
Feedback 6.4.2 - Now available - Give it a go!
Find us on Codeplex - DNN Events, DNN Feedback
Requirements/Bugs - Please submit them on Codeplex
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsEventsEventsAdding Event CodeAdding Event Code


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out