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/18/2013 10:42 PM
 

Hi all, have asked LOADS of time for assistance with this but got nowhere.

Have taken it on myself to try and make this work. So experimenting with SP EventsSave.

Here the SQL:

USE [dnndev]
GO

DECLARE @return_value int

EXEC @return_value = [dbo].[EventsSave]
        @EventID = 2,
@ModuleID = 474,
@EventTimeBegin = N'2013-03-23 09:00:00.000',
@PortalID = 0,
@Duration = 100,
@EventName = 'Marks Test Event',
@EventDesc = 'My program tester',
@CreatedByID = True,
@Approved = False,
@Signups = False,
@RecurMasterID = 1,
@Importance = 1,
@Notify='Event Reminder: [event:title] on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT]',
@MaxEnrollment = 0,
@EnrollRoleID = Null,
@EnrollFee = 0.00,
@EnrollType = 'FREE',
@PayPalAccount = 'host@paypal.com',
@Cancelled = False,
@DetailPage= False,
@DetailNewWin = False,
@DetailURL = null,
@imageURL = Null,
@ImageType = Null,
@ImageWidth = 0,
@ImageHeight = 0,
@ImageDisplay = False,
@Location = Null,
@Category = Null,
@Reminder = 'You requested reminding about the following Event:<br />
<br />
[event:title]<br />
<br />
on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT] [event:timezone]<br />
to [NOTALLDAYEVENT][event:enddate][/NOTALLDAYEVENT][ALLDAYEVENT][event:enddate|D][/ALLDAYEVENT]<br />
[event:description]',
@SendReminder = True,
@ReminderTime = 24,
@ReminderTimeMeasurement = 'h',
@ReminderFrom = 'info@elycity.co.uk',
@SearchSubmitted = False,
@CustomField1 = Null,
@CustomField2 = Null,
@EnrollListView = False,
@DisplayEndDate = True,
@AllDayEvent = 0,
@OwnerID = 1,
@LastUpdatedID = 1,
@OriginalDateBegin = N'2013-03-23 09:00:00.000',
@NewEventEmailSent = False,
@AllowAnonEnroll = False,
@ContentItemId = 0,
@JournalItem = True,
@Summary = '',
@SaveOnly = 0
SELECT 'Return Value' = @return_value

i am getting the following error: Msg 8114, Level 16, State 1, Procedure EventsSave, Line 0
Error converting data type nvarchar to int. 

Been through it with fine toothcomb and just cant see the problem, any ideas?

Oh and btw, this is the code I want to make it work in my module:

Dim ev As New Modules.Events.EventInfo
            ev.EventName = "Marks Test Event"
            Dim mydt As String = "23 March 2013 09:00"
            ev.EventTimeBegin = "2013-03-23 09:00:00.000"
            ev.PortalID = PortalId
            ev.Duration = 100
            ev.ModuleID = 474
            ev.EventDesc = "My program tester"
            ev.CreatedBy = UserId
            ev.Approved = False
            ev.PortalID = 0
            ev.Signups = False
            Dim a As New Modules.Events.EventController
            a.EventsSave(ev, True)

Any assistance would be GRATEFULLY received


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

Visit Ely City Website
 
New Post
3/18/2013 11:26 PM
 
After weeks of trying to figure it out, here it is:

Dim ev As New Modules.Events.EventInfo
ev.EventID = -1
ev.ModuleID = 474
ev.EventTimeBegin = "2013-03-23 09:00:00.000"
ev.Duration = 100
ev.EventName = "Marks Test Event"
ev.EventDesc = "My program tester"
ev.Importance = EventInfo.Priority.Medium
ev.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]"
ev.Notify = "Event Reminder: [event:title] on [NOTALLDAYEVENT][event:startdate][/NOTALLDAYEVENT][ALLDAYEVENT][event:startdate|D][/ALLDAYEVENT]"
ev.CreatedByID = UserId
ev.Approved = False
ev.PortalID = PortalId
ev.Signups = False
ev.MaxEnrollment = 0
ev.EnrollRoleID = 0
ev.EnrollFee = 0
ev.EnrollType = "FREE"
ev.PayPalAccount = "host@paypal.com"
ev.Cancelled = False
ev.ImageURL = ""
ev.ImageType = ""
ev.ImageWidth = 0
ev.ImageHeight = 0
ev.ImageDisplay = False
Dim eli As New EventLocationController
ev.Location = eli.EventsLocationGet(1, 0).Location
Dim eci As New EventCategoryController
ev.Category = eci.EventCategoryGet(1, 0).Category
ev.SendReminder = True
ev.ReminderTime = 24
ev.ReminderTimeMeasurement = "h"
ev.ReminderFrom = "info@elycity.co.uk"
ev.SearchSubmitted = True
ev.CustomField1 = ""
ev.CustomField2 = ""
ev.LastUpdatedAt = Now()
ev.OriginalDateBegin = "2013-03-23 09:00:00.000"
ev.LastUpdatedID = UserId
ev.OwnerID = UserId
ev.EnrollListView = False
ev.NewEventEmailSent = True
ev.DisplayEndDate = True
ev.AllDayEvent = False
ev.RecurMasterID = 1
ev.DetailPage = False
ev.DetailURL = ""
ev.DetailNewWin = False
ev.CreatedDate = Now()
ev.AllowAnonEnroll = False
ev.ContentItemID = 0
ev.JournalItem = True
ev.Summary = ""
ev.Sequence = 1



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

You have to make a Location and Category with this code as I couldn't figure out how to pass a Null into the 2 columns.

I'll be writing some better code and better form for adding events into the db now and will publish online soon

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

Visit Ely City Website
 
New Post
3/19/2013 5:00 AM
 

Good work, some comments:-

  • If you pass in -1 for Location and Category they get converted to null by the sproc.
  • Bear in mind that you should have an EventsRecurMaster record for every sequence of recurring events. You have set RecurMasterID to 1 here.
  • You don't need to populate LastUpdateAt or CreatedDate, they are output only fields, they are set by the sproc. Also note that these are set to a UTC date/time not as local date/time
  • You should set SearchSubmitted to False - so that the item gets indexed
  • You should set NewEventEmailSent to False - so that new event reminders are sent when configured to do so
  • Since you aren't creating the Journal entry, you should set JournalItem to False
  • You don't need to populate Sequence it is set by the sproc

Cheers
Roger


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
 
New Post
3/19/2013 8:04 AM
 
Thanks Roger

So with your comments a couple of questions regarding RecurMasterID.

At this moment in time, my users can only add 1 item with no recurring events so what should RecurMasterID be? I took that from an entry made by module.

I may want to add the ability to make recuring event. What the best way to do so?

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

Visit Ely City Website
 
New Post
3/19/2013 8:10 AM
 
You should first create a EventsRecurMaster using EventsRecurMasterSave call, which will return a RecurMasterID which you can then use for input to your EventsSave.

I'd hate to think what would happen if you linked all Events to a single RecurMaster and then tried to edit them via the standard interface.

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