Hello,
At the moment i have my scheduler working, all from the server side. Recurrence is working fine as well, but i also want to "edit this occurence only" option working.
To do this, i wanted to use the "OnRecurrenceExceptionCreated" to get it working.
However, it seems that i cannot retrieve the updated RecurrenceRule with the Exception in it.
I tried to make it work in the RadScheduler_AppointmentUpdate(the recurrencerule with exception) however, i cant determine in this void if there is an Recurrence exception created.
Beneath the three classes i use in combination with customized advanced templates accorinding to youre example in the following link:
advancedformtemplate
I supply them all, so someone else who wants to do it all server side, can find it a bit easier then i could :)
My Code at the moment
Scheduler.
Insert
Update
OnRecurrenceException
How to make this work asap?
At the moment i have my scheduler working, all from the server side. Recurrence is working fine as well, but i also want to "edit this occurence only" option working.
To do this, i wanted to use the "OnRecurrenceExceptionCreated" to get it working.
However, it seems that i cannot retrieve the updated RecurrenceRule with the Exception in it.
I tried to make it work in the RadScheduler_AppointmentUpdate(the recurrencerule with exception) however, i cant determine in this void if there is an Recurrence exception created.
Beneath the three classes i use in combination with customized advanced templates accorinding to youre example in the following link:
advancedformtemplate
I supply them all, so someone else who wants to do it all server side, can find it a bit easier then i could :)
My Code at the moment
Scheduler.
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
Width
=
"100%"
Height
=
"100%"
Enabled
=
"false"
DayStartTime
=
"08:00:00"
DayEndTime
=
"22:00:00"
WorkDayStartTime
=
"08:00:00"
WorkDayEndTime
=
"22:00:00"
FirstDayOfWeek
=
"Monday"
LastDayOfWeek
=
"Friday"
HoursPanelTimeFormat
=
"HH:mm"
ShowViewTabs
=
"true"
StartInsertingInAdvancedForm
=
"true"
StartEditingInAdvancedForm
=
"true"
ShowAllDayRow
=
"false"
Culture
=
"nl-NL"
OnDataBinding
=
"RadScheduler1_DataBinding"
OnAppointmentDataBound
=
"RadScheduler1_AppointmentDataBound"
OnClientFormCreated
=
"schedulerFormCreated"
CustomAttributeNames
=
"intSelectedProspectID,intSelectedLocID,RecurrenceRule,id_prospect,strLine1, strLine2, strLine3, strCSS, strBezichtingPand, strTelefoon1, strTelefoon2"
EnableDescriptionField
=
"true"
AppointmentStyleMode
=
"Default"
OnAppointmentUpdate
=
"RadScheduler1_AppointmentUpdate"
OnRecurrenceExceptionCreated
=
"RadScheduler1_OnRecurrenceExceptionCreated"
OnAppointmentInsert
=
"RadScheduler1_AppointmentInsert"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
OnFormCreated
=
"RadScheduler1_FormCreated"
>
<
AdvancedForm
Modal
=
"false"
/>
<
Reminders
Enabled
=
"false"
/>
<
AdvancedEditTemplate
>
<
scheduler:AdvancedForm
runat
=
"server"
ID
=
"AdvancedEditForm1"
Mode
=
"Edit"
Subject='<%# Bind("Subject") %>'
Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' UserID='<%# Bind("intPersoneelID") %>'
RoomID='<%# Bind("intKamerID") %>' AfspraakType='<%# Bind("intAfspraakTypeID") %>'
ProspectID='<%# Bind("id_prospect") %>' Locatie='<%# Bind("intLocatieID") %>' />
</
AdvancedEditTemplate
>
<
AdvancedInsertTemplate
>
<
scheduler:AdvancedForm
runat
=
"server"
ID
=
"AdvancedInsertForm1"
Mode
=
"Insert"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' UserID='<%# Bind("intPersoneelID") %>'
RoomID='<%# Bind("intKamerID") %>' AfspraakType='<%# Bind("intAfspraakTypeID") %>'
ProspectID='<%# Bind("id_prospect") %>' Locatie='<%# Bind("intLocatieID") %>' />
</
AdvancedInsertTemplate
>
<
AppointmentTemplate
>
<
div
class
=
"rsAptSubject"
>
<%# Eval("strLine1") %></
div
>
<
div
>
<%# Eval("strLine2") %></
div
>
<
div
>
<%# Eval("strLine3") %></
div
>
</
AppointmentTemplate
>
<
TimelineView
UserSelectable
=
"false"
/>
<
TimeSlotContextMenuSettings
EnableDefault
=
"true"
/>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
/>
</
telerik:RadScheduler
>
Insert
protected
void
RadScheduler1_AppointmentInsert(
object
sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
try
{
ArrayList paramList =
new
ArrayList();
paramList.Add(
new
SqlParameter(
"@afspraakdatum"
, Convert.ToDateTime(e.Appointment.Start.ToShortDateString() +
" "
+ e.Appointment.Start.ToShortTimeString())));
paramList.Add(
new
SqlParameter(
"@afspraakdatumEind"
, Convert.ToDateTime(e.Appointment.End.ToShortDateString() +
" "
+ e.Appointment.End.ToShortTimeString())));
paramList.Add(
new
SqlParameter(
"@intAfspraakTypeID"
, Supervisor.convInt32DBNULL(e.Appointment.Attributes[
"intAfspraakTypeID"
])));
paramList.Add(
new
SqlParameter(
"@strAfspraakOnderwerp"
, Supervisor.convStringDBNULL(e.Appointment.Subject)));
paramList.Add(
new
SqlParameter(
"@afspraakopmerkingen"
, Supervisor.convStringDBNULL(e.Appointment.Description)));
paramList.Add(
new
SqlParameter(
"@adviseur_id"
, Supervisor.convInt32DBNULL(e.Appointment.Attributes[
"intPersoneelID"
])));
paramList.Add(
new
SqlParameter(
"@fiat"
, fiat));
paramList.Add(
new
SqlParameter(
"@intKamerID"
, Supervisor.convInt32DBNULL(e.Appointment.Attributes[
"intKamerID"
])));
paramList.Add(
new
SqlParameter(
"@intLocatie"
, Supervisor.convInt32DBNULL(e.Appointment.Attributes[
"intLocatieID"
])));
paramList.Add(
new
SqlParameter(
"@id_prospect"
, Supervisor.convInt32DBNULL(e.Appointment.Attributes[
"id_prospect"
])));
paramList.Add(
new
SqlParameter(
"@RecurrenceRule"
, Supervisor.convStringDBNULL(e.Appointment.RecurrenceRule)));
paramList.Add(
new
SqlParameter(
"@RecurrenceParentKeyField"
, Supervisor.convStringDBNULL(e.Appointment.RecurrenceParentID)));
string
strSQL =
"exec sp_insAfspraakFromPlan4 @afspraakdatum, @afspraakdatumEind, @intAfspraakTypeID, @strAfspraakOnderwerp, @afspraakopmerkingen, @id_prospect, @adviseur_id, @fiat, @intKamerID, @intLocatie,@RecurrenceRule,@RecurrenceParentKeyField"
;
string
foutmelding = MSSQL_Comm.ExecuteNonQuery(strSQL, paramList,
"ConnWB"
);
if
(foutmelding.Length > 0)
{
e.Cancel =
true
;
Label Label1 =
new
Label();
Label1.Text = foutmelding;
//NOT WORKING YET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ScriptManager.RegisterClientScriptBlock(
this
, GetType(),
"LabelUpdated"
,
"$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');"
,
true
);
}
}
catch
(Exception ex)
{
e.Cancel =
true
;
Label Label1 =
new
Label();
Label1.Text = ex.Message;
//NOT WORKING YET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ScriptManager.RegisterClientScriptBlock(
this
, GetType(),
"LabelUpdated"
,
"$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');"
,
true
);
}
}
Update
protected
void
RadScheduler1_AppointmentUpdate(
object
sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)
{
try
{
ArrayList paramList =
new
ArrayList();
paramList.Add(
new
SqlParameter(
"@afspraakdatum"
, Convert.ToDateTime(e.ModifiedAppointment.Start.ToShortDateString() +
" "
+ e.ModifiedAppointment.Start.ToShortTimeString())));
paramList.Add(
new
SqlParameter(
"@afspraakdatumEind"
, Convert.ToDateTime(e.ModifiedAppointment.End.ToShortDateString() +
" "
+ e.ModifiedAppointment.End.ToShortTimeString())));
paramList.Add(
new
SqlParameter(
"@intAfspraakTypeID"
, Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes[
"intAfspraakTypeID"
])));
paramList.Add(
new
SqlParameter(
"@strAfspraakOnderwerp"
, Supervisor.convStringDBNULL(e.ModifiedAppointment.Subject)));
paramList.Add(
new
SqlParameter(
"@afspraakopmerkingen"
, Supervisor.convStringDBNULL(e.ModifiedAppointment.Description)));
paramList.Add(
new
SqlParameter(
"@adviseur_id"
, Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes[
"intPersoneelID"
])));
paramList.Add(
new
SqlParameter(
"@fiat"
, 1));
paramList.Add(
new
SqlParameter(
"@intKamerID"
, Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes[
"intKamerID"
])));
paramList.Add(
new
SqlParameter(
"@intLocatie"
, Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes[
"intLocatieID"
])));
paramList.Add(
new
SqlParameter(
"@id_prospect"
, Supervisor.convInt32DBNULL(e.ModifiedAppointment.Attributes[
"id_prospect"
])));
paramList.Add(
new
SqlParameter(
"@id"
, e.ModifiedAppointment.ID));
paramList.Add(
new
SqlParameter(
"@RecurrenceRule"
, Supervisor.convStringDBNULL(e.ModifiedAppointment.RecurrenceRule)));
paramList.Add(
new
SqlParameter(
"@RecurrenceParentKeyField"
, Supervisor.convStringDBNULL(e.ModifiedAppointment.RecurrenceParentID)));
string
strSQL =
"exec sp_updAfspraakFromPlan3 @afspraakdatum, @afspraakdatumEind, @intAfspraakTypeID, @strAfspraakOnderwerp, @afspraakopmerkingen, @id_prospect, @adviseur_id, @fiat, @intKamerID, @id, @RecurrenceRule, @RecurrenceParentKeyField"
;
string
foutmelding = MSSQL_Comm.ExecuteNonQuery(strSQL, paramList,
"ConnWB"
);
if
(foutmelding.Length > 0)
{
e.Cancel =
true
;
Label Label1 =
new
Label();
Label1.Text = foutmelding;
ScriptManager.RegisterClientScriptBlock(
this
, GetType(),
"LabelUpdated"
,
"$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');"
,
true
);
}
}
catch
(Exception ex)
{
e.Cancel =
true
;
Label Label1 =
new
Label();
Label1.Text = ex.Message;
ScriptManager.RegisterClientScriptBlock(
this
, GetType(),
"LabelUpdated"
,
"$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');"
,
true
);
}
}
OnRecurrenceException
protected
void
RadScheduler1_OnRecurrenceExceptionCreated(
object
sender, Telerik.Web.UI.RecurrenceExceptionCreatedEventArgs e)
{
int
intMasterOccurrenceID = Convert.ToInt32(e.OccurrenceAppointment.ID);
string
RecurrenceRule = e.Appointment.RecurrenceRule;
string
newRecurrenceRule =
"?????????????????????????????????????????????????????"
;
e.Cancel =
true
;
}
How to make this work asap?