Hi I'm setting up a RadScheduler to handle appointments from a SQL DB.
My interface includes, for each appointment, a lot of additional datas so i decided to use AdvancedEditTemplate and AdvancedInsertTemplate to build the appointment interface. Everything went fine till I put a RadSchedulerRecurrenceEditor in the interface to handle Recurring Events.
The problem is here described:
- If I open a simple appointment (no recurrences) and add a recurrence the event get saved correctly.
- if I open an event with recurrences and try to modify the recurrence the event does not get saved...in the sense that the recurrences does not get saved and remain the previous scheduling.
The problem seems to be that when i click the LB_Save LinkButton that triggers the Command "Update" (which is handled by the
Scheduler.aspx.vb
My interface includes, for each appointment, a lot of additional datas so i decided to use AdvancedEditTemplate and AdvancedInsertTemplate to build the appointment interface. Everything went fine till I put a RadSchedulerRecurrenceEditor in the interface to handle Recurring Events.
The problem is here described:
- If I open a simple appointment (no recurrences) and add a recurrence the event get saved correctly.
- if I open an event with recurrences and try to modify the recurrence the event does not get saved...in the sense that the recurrences does not get saved and remain the previous scheduling.
The problem seems to be that when i click the LB_Save LinkButton that triggers the Command "Update" (which is handled by the
RadScheduler.AppointmentCommand) the event FormCreated gets triggered first and the RadSchedulerRecurrenceEditor.RecurrenceRuleText gets reloaded before it gets Updated....so basically i save again the RecurrenceRule that is already saved. What is strange is that if the Appointment does not contain any RecurrenceRule the new RecurrenceRule gets saved correctly.
I'm out of good ideas on this one. Follows the code.
Scheduler.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Scheduler.aspx.vb" Inherits="Admin_Scheduler" %>
<%@ Register src="Header.ascx" tagname="Header" tagprefix="uc" %>
<%@ Register src="Left.ascx" tagname="Left" tagprefix="uc" %>
<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>CecchiPoint</
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager"
runat
=
"server"
/>
<
link
type
=
"text/css"
href
=
"../Resources/StyleBase.css"
rel
=
"Stylesheet"
/>
<
telerik:RadScriptBlock
runat
=
"server"
>
<
script
type
=
"text/javascript"
language
=
"javascript"
>
function Move(sender, eventArgs) {
var Start = eventArgs.get_newStartTime().format("yyyy/MM/dd HH:mm");
var apt = eventArgs.get_appointment();
var IdReservation = apt.get_id();
$find("<%=RadAjaxManager.ClientID %>").ajaxRequest('Move|' + Start + '|' + IdReservation);
}
function Resize(sender, eventArgs) {
var Time = eventArgs.get_newTime().format("yyyy/MM/dd HH:mm");
var apt = eventArgs.get_appointment();
var IdReservation = apt.get_id();
$find("<%=RadAjaxManager.ClientID %>").ajaxRequest('Resize|' + Time + '|' + IdReservation);
}
</
script
>
</
telerik:RadScriptBlock
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
EnableScriptLocalization
=
"true"
EnableScriptGlobalization
=
"true"
></
telerik:RadScriptManager
>
<
div
id
=
"DIV_Main"
>
<
div
id
=
"DIV_Header"
class
=
"Titolo1"
>
<
uc:Header
runat
=
"server"
Title
=
"Servizio prenotazioni"
/>
</
div
>
<
div
id
=
"DIV_Left"
>
<
uc:Left
ID
=
"Left"
runat
=
"server"
/>
</
div
>
<
div
id
=
"DIV_Filter"
>
<
telerik:RadToolBar
runat
=
"server"
Width
=
"100%"
Height
=
"32px"
ID
=
"RadToolBar_Filter"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Filtro prenotazioni: "
Enabled
=
"false"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Value
=
"Spazi"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"Ck_Spazi"
Text
=
"Spazi"
TextAlign
=
"Right"
AutoPostBack
=
"true"
Checked
=
"true"
/>
</
ItemTemplate
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Value
=
"Mezzi"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"Ck_Mezzi"
Text
=
"Mezzi"
TextAlign
=
"Right"
AutoPostBack
=
"true"
Checked
=
"true"
/>
</
ItemTemplate
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Value
=
"Servizi"
>
<
ItemTemplate
>
<
asp:CheckBox
runat
=
"server"
ID
=
"Ck_Servizi"
Text
=
"Servizi"
TextAlign
=
"Right"
AutoPostBack
=
"true"
Checked
=
"true"
/>
</
ItemTemplate
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
div
>
<
div
id
=
"DIV_Body"
>
<
telerik:RadAjaxManager
runat
=
"server"
ID
=
"RadAjaxManager"
DefaultLoadingPanelID
=
"LP"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadScheduler"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadScheduler"
UpdatePanelHeight
=
"100%"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxManager"
UpdatePanelHeight
=
"100%"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"Ck_Spazi"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadScheduler"
UpdatePanelHeight
=
"100%"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxManager"
UpdatePanelHeight
=
"100%"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"Ck_Mezzi"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadScheduler"
UpdatePanelHeight
=
"100%"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxManager"
UpdatePanelHeight
=
"100%"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"Ck_Servizi"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadScheduler"
UpdatePanelHeight
=
"100%"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxManager"
UpdatePanelHeight
=
"100%"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"LP"
MinDisplayTime
=
"500"
Transparency
=
"0"
ZIndex
=
"80000"
Width
=
"100%"
Height
=
"100%"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadScheduler
ID
=
"RadScheduler"
runat
=
"server"
Width
=
"100%"
Height
=
"100%"
EnableDescriptionField
=
"True"
StartEditingInAdvancedForm
=
"true"
StartInsertingInAdvancedForm
=
"true"
SelectedView
=
"MonthView"
DayStartTime
=
"07:00"
DayEndTime
=
"20:00"
AppointmentStyleMode
=
"Default"
DataKeyField
=
"IdReservation"
DataStartField
=
"DateFrom"
DataEndField
=
"DateTo"
DataSubjectField
=
"Subject"
CustomAttributeNames
=
"Color"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentID"
OnClientAppointmentMoveEnd
=
"Move"
OnClientAppointmentResizeEnd
=
"Resize"
TimeSlotContextMenuSettings-EnableDefault
=
"true"
AppointmentContextMenuSettings-EnableDefault
=
"true"
>
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
ID
=
"SchedulerTimeSlotContextMenu"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Nuovo nolo"
Value
=
"CommandAddAppointment"
ImageUrl
=
"../Resources/Images/ico_ServiceAdd_16.png"
/>
<%--
<
telerik:RadMenuItem
Text
=
"New All Day Event"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<
telerik:RadMenuItem
Text
=
"New Recurring Appointment"
Value
=
"CommandAddRecurringAppointment"
/>
<
telerik:RadMenuItem
Text
=
"New Recurring Event"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>--%>
<
telerik:RadMenuItem
Text
=
"Vai a Oggi"
Value
=
"CommandGoToToday"
/>
<%--<
telerik:RadMenuItem
Text
=
"Show 24 hours..."
Value
=
"CommandShow24Hours"
/>--%>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
<
AdvancedInsertTemplate
>
<
div
style
=
"padding:2px;border:1px solid #C3C3C3;padding:4px;"
>
<
table
cellpadding
=
"0"
cellspacing
=
"0px"
width
=
"100%"
border
=
"0"
>
<%--<
tr
>
<
td
class
=
"CellLabel"
>Descrizione: (*)
<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"T_Subject"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"T_Subject"
Width
=
"90%"
></
telerik:RadTextBox
>
</
td
>
</
tr
>--%>
<
tr
>
<
td
class
=
"CellLabel"
>Da: (*)
<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"DTP_DateFrom"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadDateTimePicker
runat
=
"server"
ID
=
"DTP_DateFrom"
DateInput-Width
=
"80px"
TimeView-Interval
=
"00:15:00"
TimeView-Columns
=
"4"
></
telerik:RadDateTimePicker
>
A: (*)
<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"DTP_DateTo"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
<
telerik:RadDateTimePicker
runat
=
"server"
ID
=
"DTP_DateTo"
DateInput-Width
=
"80px"
TimeView-Interval
=
"00:15:00"
TimeView-Columns
=
"4"
></
telerik:RadDateTimePicker
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Nolo: (*)
<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"T_Service"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
div
style
=
"float:left;width:380px"
>
<
asp:HiddenField
runat
=
"server"
ID
=
"HF_IdService"
Value
=
""
/>
<
telerik:RadTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_Service"
Width
=
"350px"
></
telerik:RadTextBox
>
<
asp:HyperLink
runat
=
"server"
ID
=
"HL_Service"
>
<
asp:Image
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_View_16.png"
ImageAlign
=
"AbsMiddle"
/>
</
asp:HyperLink
>
</
div
>
<
div
style
=
"float:left"
><
asp:Panel
runat
=
"server"
ID
=
"P_ServiceColor"
Width
=
"30px"
Height
=
"20px"
></
asp:Panel
></
div
>
<
div
style
=
"clear:both"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Assegnatario: (*)
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator6"
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"T_Customer"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
asp:HiddenField
runat
=
"server"
ID
=
"HF_IdCustomer"
Value
=
""
/>
<
telerik:RadTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_Customer"
Width
=
"350px"
></
telerik:RadTextBox
>
<
asp:HyperLink
runat
=
"server"
ID
=
"HL_Customer"
>
<
asp:Image
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_View_16.png"
ImageAlign
=
"AbsMiddle"
/>
</
asp:HyperLink
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Valore del servizio: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_CostDue"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Costo riparazione: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"T_RepairCost"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Quota saldata: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_CostPaid"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Quota residua: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_CostRemaining"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Stato contabile:
<%--<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"CB_BillingStatus"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>--%>
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"CB_BillingStatus"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
"0"
/>
<
telerik:RadComboBoxItem
value
=
"1"
Text
=
"Nessun Saldo"
/>
<
telerik:RadComboBoxItem
value
=
"2"
Text
=
"Saldato parzialmente"
/>
<
telerik:RadComboBoxItem
Value
=
"3"
Text
=
"Saldato"
/>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Stato restituzione:
<%--<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"CB_Status"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>--%>
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"CB_Status"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
"0"
/>
<
telerik:RadComboBoxItem
value
=
"1"
Text
=
"Consegnato"
/>
<
telerik:RadComboBoxItem
value
=
"2"
Text
=
"Restituito parzialmente"
/>
<
telerik:RadComboBoxItem
Value
=
"3"
Text
=
"Restituito"
/>
<
telerik:RadComboBoxItem
Value
=
"4"
Text
=
"Restituito da riparare"
/>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
<
telerik:RadSchedulerRecurrenceEditor
ID
=
"RecurrenceEditor"
runat
=
"server"
></
telerik:RadSchedulerRecurrenceEditor
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
></
td
>
<
td
class
=
"CellData"
style
=
"height:60px;vertical-align:bottom"
>
<
div
style
=
"text-align:right;width:90%"
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LB_Save"
CssClass
=
"StyleSave"
CommandName
=
"Insert"
ValidationGroup
=
"VG0"
>
<
asp:Image
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_check_16.png"
ImageAlign
=
"AbsMiddle"
/>
<
span
>Salva</
span
>
</
asp:LinkButton
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LB_Close"
CssClass
=
"StyleClose"
CommandName
=
"Cancel"
ValidationGroup
=
"VG1"
>
<
asp:Image
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_close_16.png"
ImageAlign
=
"AbsMiddle"
/>
<
span
>Chiudi senza salvare</
span
>
</
asp:LinkButton
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
AdvancedInsertTemplate
>
<
AdvancedEditTemplate
>
<
telerik:RadToolBar
ID
=
"RadToolBar1"
runat
=
"server"
Width
=
"100%"
Height
=
"32px"
></
telerik:RadToolBar
>
<
div
style
=
"border:1px solid #C3C3C3;padding:4px;"
>
<
table
cellpadding
=
"0"
cellspacing
=
"0px"
width
=
"100%"
border
=
"0"
style
=
"margin-top:6px"
>
<
tr
>
<
td
class
=
"CellLabel"
>Da: (*)
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"DTP_DateFrom"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadDateTimePicker
runat
=
"server"
ID
=
"DTP_DateFrom"
DateInput-Width
=
"80px"
TimeView-Interval
=
"00:15:00"
TimeView-Columns
=
"4"
></
telerik:RadDateTimePicker
>
A: (*)
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"DTP_DateTo"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
<
telerik:RadDateTimePicker
runat
=
"server"
ID
=
"DTP_DateTo"
DateInput-Width
=
"80px"
TimeView-Interval
=
"00:15:00"
TimeView-Columns
=
"4"
></
telerik:RadDateTimePicker
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Nolo: (*)
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator3"
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"T_Service"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
div
style
=
"float:left;width:380px"
>
<
asp:HiddenField
runat
=
"server"
ID
=
"HF_IdService"
Value
=
""
/>
<
telerik:RadTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_Service"
Width
=
"350px"
></
telerik:RadTextBox
>
<
asp:HyperLink
runat
=
"server"
ID
=
"HL_Service"
>
<
asp:Image
ID
=
"Image2"
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_View_16.png"
ImageAlign
=
"AbsMiddle"
/>
</
asp:HyperLink
>
</
div
>
<
div
style
=
"float:left"
><
asp:Panel
runat
=
"server"
ID
=
"P_ServiceColor"
Width
=
"30px"
Height
=
"22px"
></
asp:Panel
></
div
>
<
div
style
=
"clear:both"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Assegnatario: (*)
<
asp:RequiredFieldValidator
ValidationGroup
=
"VG0"
runat
=
"server"
ControlToValidate
=
"T_Customer"
ErrorMessage
=
"*"
Display
=
"Dynamic"
></
asp:RequiredFieldValidator
>
</
td
>
<
td
class
=
"CellData"
>
<
asp:HiddenField
runat
=
"server"
ID
=
"HF_IdCustomer"
Value
=
""
/>
<
telerik:RadTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_Customer"
Width
=
"350px"
></
telerik:RadTextBox
>
<
asp:HyperLink
runat
=
"server"
ID
=
"HL_Customer"
>
<
asp:Image
ID
=
"Image3"
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_View_16.png"
ImageAlign
=
"AbsMiddle"
/>
</
asp:HyperLink
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Valore del servizio: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"T_CostDue"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
MinValue
=
"0"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Costo riparazione: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"T_RepairCost"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Quota saldata: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_CostPaid"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
<
asp:HyperLink
runat
=
"server"
ID
=
"HL_CostPaid"
>
<
asp:Image
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_View_16.png"
ImageAlign
=
"AbsMiddle"
/>
Gestisci pagamenti
</
asp:HyperLink
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Quota residua: </
td
>
<
td
class
=
"CellData"
>
<
telerik:RadNumericTextBox
ReadOnly
=
"true"
runat
=
"server"
ID
=
"T_CostRemaining"
Type
=
"Currency"
NumberFormat-DecimalDigits
=
"2"
EnabledStyle-HorizontalAlign
=
"Right"
Width
=
"80px"
></
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Stato contabile:
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"CB_BillingStatus"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
"0"
/>
<
telerik:RadComboBoxItem
value
=
"1"
Text
=
"Nessun Saldo"
/>
<
telerik:RadComboBoxItem
value
=
"2"
Text
=
"Saldato parzialmente"
/>
<
telerik:RadComboBoxItem
Value
=
"3"
Text
=
"Saldato"
/>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
>Stato restituzione:
</
td
>
<
td
class
=
"CellData"
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"CB_Status"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Value
=
"0"
/>
<
telerik:RadComboBoxItem
value
=
"1"
Text
=
"Consegnato"
/>
<
telerik:RadComboBoxItem
value
=
"2"
Text
=
"Restituito parzialmente"
/>
<
telerik:RadComboBoxItem
Value
=
"3"
Text
=
"Restituito"
/>
<
telerik:RadComboBoxItem
Value
=
"4"
Text
=
"Restituito da riparare"
/>
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
<
telerik:RadSchedulerRecurrenceEditor
ID
=
"RecurrenceEditor"
runat
=
"server"
></
telerik:RadSchedulerRecurrenceEditor
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"CellLabel"
></
td
>
<
td
class
=
"CellData"
style
=
"height:60px;vertical-align:bottom"
>
<
div
style
=
"text-align:right;width:500px"
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LB_Save"
CssClass
=
"StyleSave"
CommandName
=
"Update"
ValidationGroup
=
"VG0"
>
<
asp:Image
ID
=
"Image4"
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_check_16.png"
ImageAlign
=
"AbsMiddle"
/>
<
span
>Salva</
span
>
</
asp:LinkButton
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LB_Close"
CssClass
=
"StyleClose"
CommandName
=
"Cancel"
ValidationGroup
=
"VG1"
>
<
asp:Image
ID
=
"Image5"
runat
=
"server"
ImageUrl
=
"~/Resources/Images/ico_close_16.png"
ImageAlign
=
"AbsMiddle"
/>
<
span
>Chiudi senza salvare</
span
>
</
asp:LinkButton
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
AdvancedEditTemplate
>
</
telerik:RadScheduler
>
</
div
>
<
div
id
=
"DIV_Footer"
>
<
uc:Footer
ID
=
"Footer"
runat
=
"server"
/>
</
div
>
</
div
>
</
form
>
</
body
>
</
html
>
Scheduler.aspx.vb
Imports Telerik.Web.UI
Partial Class Admin_Scheduler
Inherits System.Web.UI.Page
'Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
' RadScheduler.Provider = New XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), True)
'End Sub
Private WithEvents Ck_Spazi As CheckBox = Nothing
Private WithEvents Ck_Mezzi As CheckBox = Nothing
Private WithEvents Ck_Servizi As CheckBox = Nothing
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Ck_Spazi = CType(RadToolBar_Filter.FindItemByValue("Spazi").FindControl("Ck_Spazi"), CheckBox)
Ck_Mezzi = CType(RadToolBar_Filter.FindItemByValue("Mezzi").FindControl("Ck_Mezzi"), CheckBox)
Ck_Servizi = CType(RadToolBar_Filter.FindItemByValue("Servizi").FindControl("Ck_Servizi"), CheckBox)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindScheduler()
End If
End Sub
Private Sub BindScheduler()
Dim oDaObReservation As New Cecchi.Elements.Reservation
RadScheduler.DataSource = oDaObReservation.GetReservationTab(Ck_Spazi.Checked, Ck_Mezzi.Checked, Ck_Servizi.Checked)
'RadScheduler.DataBind()
End Sub
Protected Sub RadScheduler_AppointmentCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentCommandEventArgs) Handles RadScheduler.AppointmentCommand
If e.CommandName = "Insert" Or e.CommandName = "Update" Then
Dim DTP_DateFrom As RadDateTimePicker = DirectCast(e.Container.FindControl("DTP_DateFrom"), RadDateTimePicker)
Dim DTP_DateTo As RadDateTimePicker = DirectCast(e.Container.FindControl("DTP_DateTo"), RadDateTimePicker)
Dim HF_IdService As HiddenField = DirectCast(e.Container.FindControl("HF_IdService"), HiddenField)
Dim T_Service As RadTextBox = DirectCast(e.Container.FindControl("T_Service"), RadTextBox)
Dim HF_IdCustomer As HiddenField = DirectCast(e.Container.FindControl("HF_IdCustomer"), HiddenField)
Dim T_CostDue As RadNumericTextBox = DirectCast(e.Container.FindControl("T_CostDue"), RadNumericTextBox)
Dim T_CostPaid As RadNumericTextBox = DirectCast(e.Container.FindControl("T_CostPaid"), RadNumericTextBox)
Dim CB_BillingStatus As RadComboBox = DirectCast(e.Container.FindControl("CB_BillingStatus"), RadComboBox)
Dim CB_Status As RadComboBox = DirectCast(e.Container.FindControl("CB_Status"), RadComboBox)
Dim T_RepairCost As RadNumericTextBox = DirectCast(e.Container.FindControl("T_RepairCost"), RadNumericTextBox)
Dim RecurrenceEditor As RadSchedulerRecurrenceEditor = DirectCast(e.Container.FindControl("RecurrenceEditor"), RadSchedulerRecurrenceEditor)
' Valuto il costo del servizio
Dim oDaObService As New Cecchi.Elements.DaObService
oDaObService.PK.Add("IdService", CInt(HF_IdService.Value))
Dim oService As Data.DataRow = oDaObService.Get
Dim CostDue As Decimal = 0
If oService IsNot Nothing Then
If oService("RentType") = 0 Then
' Costo orario
Dim Durata As TimeSpan = DTP_DateTo.SelectedDate - DTP_DateFrom.SelectedDate
'T_CostDue.Value = Durata.TotalHours * CDec(oService("FeePerHour"))
CostDue = Durata.TotalHours * CDec(oService("FeePerHour"))
ElseIf oService("RentType") = 1 Then
' Costo forfettario
'T_CostDue.Value = CDec(oService("FeeForfait"))
CostDue = CDec(oService("FeeForfait"))
End If
End If
Select Case e.CommandName
Case "Update"
Dim oDaObReservation As New Cecchi.Elements.Reservation
Dim oReservation = oDaObReservation.newDaObItem
oReservation("IdReservation") = New Guid(e.Container.Appointment.ID.ToString)
oReservation("DateFrom") = DTP_DateFrom.DbSelectedDate
oReservation("DateTo") = DTP_DateTo.DbSelectedDate
oReservation("Subject") = T_Service.Text
oReservation("IdService") = HF_IdService.Value
oReservation("IdCustomer") = HF_IdCustomer.Value
oReservation("CostDue") = IIf(T_CostDue.DbValue Is Nothing, 0, T_CostDue.DbValue)
oReservation("CostPaid") = IIf(T_CostPaid.DbValue Is Nothing, 0, T_CostPaid.DbValue)
oReservation("BillingStatus") = CB_BillingStatus.SelectedValue
oReservation("Status") = CB_Status.SelectedValue
oReservation("RepairCost") = IIf(T_RepairCost.DbValue Is Nothing, 0, T_RepairCost.DbValue)
RecurrenceEditor.StartDate = DTP_DateFrom.DbSelectedDate
RecurrenceEditor.EndDate = DTP_DateTo.DbSelectedDate
oReservation("RecurrenceRule") = RecurrenceEditor.RecurrenceRuleText
oReservation("RecurrenceParentID") = New Guid(e.Container.Appointment.ID.ToString)
oDaObReservation.Upd(oReservation)
BindScheduler()
Case "Insert"
Dim oDaObReservation As New Cecchi.Elements.Reservation
Dim oReservation = oDaObReservation.newDaObItem
oReservation("IdReservation") = Guid.NewGuid
oReservation("DateFrom") = DTP_DateFrom.DbSelectedDate
oReservation("DateTo") = DTP_DateTo.DbSelectedDate
oReservation("Subject") = T_Service.Text
oReservation("IdService") = HF_IdService.Value
oReservation("IdCustomer") = HF_IdCustomer.Value
oReservation("CostDue") = CostDue
oReservation("CostPaid") = IIf(T_CostPaid.DbValue Is Nothing, 0, T_CostPaid.DbValue)
oReservation("BillingStatus") = CB_BillingStatus.SelectedValue
oReservation("Status") = CB_Status.SelectedValue
oReservation("RepairCost") = IIf(T_RepairCost.DbValue Is Nothing, 0, T_RepairCost.DbValue)
oDaObReservation.Add(oReservation)
BindScheduler()
Dim Script As String = ""
Script += "var Calendar = $find('" & RadScheduler.ClientID & "');"
Script += "var Appointments = Calendar.get_appointments();"
Script += "var Appointment = Appointments.findByID('" & oReservation("IdReservation").ToString & "');"
Script += "Calendar.editAppointment(Appointment);"
RadAjaxManager.ResponseScripts.Add(Script)
End Select
End If
End Sub
Protected Sub RadScheduler_AppointmentDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler.AppointmentDataBound
e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml(e.Appointment.Attributes("Color"))
End Sub
Protected Sub RadScheduler_AppointmentDelete(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentDeleteEventArgs) Handles RadScheduler.AppointmentDelete
Dim oDaObReservation As New Cecchi.Elements.Reservation
oDaObReservation.PK.Add("IdReservation", New Guid(e.Appointment.ID.ToString))
oDaObReservation.Del()
BindScheduler()
End Sub
Protected Sub RadScheduler_AppointmentUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs) Handles RadScheduler.AppointmentUpdate
End Sub
'Protected Sub RadScheduler_AppointmentUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs) Handles RadScheduler.AppointmentUpdate
'' Gestisco Resize e Moove degli appuntamenti
'Dim oDaObReservation As New Cecchi.Elements.Reservation
'Dim oReservation = oDaObReservation.newDaObItem
'oReservation("IdReservation") = e.ModifiedAppointment.ID
'oReservation("DateFrom") = e.ModifiedAppointment.Start
'oReservation("DateTo") = e.ModifiedAppointment.End
'oDaObReservation.Upd(oReservation)
'BindScheduler()
' End Sub
Protected Sub RadScheduler_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler.FormCreated
Dim DTP_DateFrom As RadDateTimePicker = DirectCast(e.Container.FindControl("DTP_DateFrom"), RadDateTimePicker)
Dim DTP_DateTo As RadDateTimePicker = DirectCast(e.Container.FindControl("DTP_DateTo"), RadDateTimePicker)
Dim HF_IdService As HiddenField = DirectCast(e.Container.FindControl("HF_IdService"), HiddenField)
Dim T_Service As RadTextBox = DirectCast(e.Container.FindControl("T_Service"), RadTextBox)
Dim HF_IdCustomer As HiddenField = DirectCast(e.Container.FindControl("HF_IdCustomer"), HiddenField)
Dim T_Customer As RadTextBox = DirectCast(e.Container.FindControl("T_Customer"), RadTextBox)
Dim T_CostDue As RadNumericTextBox = DirectCast(e.Container.FindControl("T_CostDue"), RadNumericTextBox)
Dim T_CostPaid As RadNumericTextBox = DirectCast(e.Container.FindControl("T_CostPaid"), RadNumericTextBox)
Dim T_CostRemaining As RadNumericTextBox = DirectCast(e.Container.FindControl("T_CostRemaining"), RadNumericTextBox)
Dim CB_BillingStatus As RadComboBox = DirectCast(e.Container.FindControl("CB_BillingStatus"), RadComboBox)
Dim CB_Status As RadComboBox = DirectCast(e.Container.FindControl("CB_Status"), RadComboBox)
Dim T_RepairCost As RadNumericTextBox = DirectCast(e.Container.FindControl("T_RepairCost"), RadNumericTextBox)
Dim P_ServiceColor As Panel = DirectCast(e.Container.FindControl("P_ServiceColor"), Panel)
Dim RecurrenceEditor As RadSchedulerRecurrenceEditor = DirectCast(e.Container.FindControl("RecurrenceEditor"), RadSchedulerRecurrenceEditor)
Select Case e.Container.Mode
Case SchedulerFormMode.AdvancedEdit
Dim oDaObReservation As New Cecchi.Elements.Reservation
oDaObReservation.PK.Add("IdReservation", New Guid(e.Appointment.ID.ToString))
Dim oReservation As Data.DataRow = oDaObReservation.Get()
If oReservation IsNot Nothing Then
DTP_DateFrom.DbSelectedDate = oReservation("DateFrom")
DTP_DateTo.DbSelectedDate = oReservation("DateTo")
T_Service.Text = oReservation("Subject")
' Recupero i dati dell'Utente
Dim oDaObUser As New Cecchi.Elements.DaObUser
Dim oUser As Data.DataRow = oDaObUser.Get(oReservation("IdCustomer"))
If oUser IsNot Nothing Then
T_Customer.Text = oUser("RagioneSociale").ToString
End If
' Recupero il colore del Service
Dim oDaObService As New Cecchi.Elements.DaObService
oDaObService.PK.Add("IdService", oReservation("IdService"))
Dim oService As Data.DataRow = oDaObService.Get
If oService IsNot Nothing Then
P_ServiceColor.BackColor = System.Drawing.ColorTranslator.FromHtml(oService("Color"))
End If
HF_IdService.Value = oReservation("IdService").ToString
HF_IdCustomer.Value = oReservation("IdCustomer").ToString
T_CostDue.DbValue = oReservation("CostDue")
T_RepairCost.DbValue = oReservation("RepairCost")
T_CostPaid.DbValue = oReservation("CostPaid")
T_CostRemaining.DbValue = oReservation("CostDue") + oReservation("RepairCost") - oReservation("CostPaid")
CB_BillingStatus.SelectedValue = oReservation("BillingStatus")
CB_Status.SelectedValue = oReservation("Status")
RecurrenceEditor.RecurrenceRuleText = oReservation("RecurrenceRule").ToString
RecurrenceEditor.StartDate = oReservation("DateFrom")
RecurrenceEditor.EndDate = oReservation("DateTo")
Dim HL_Service As HyperLink = DirectCast(e.Container.FindControl("HL_Service"), HyperLink)
HL_Service.NavigateUrl = "javascript:var W=window.open('p_ServiceSearch.aspx','','width=500px,height=500px')"
Dim HL_Customer As HyperLink = DirectCast(e.Container.FindControl("HL_Customer"), HyperLink)
HL_Customer.NavigateUrl = "javascript:var W=window.open('p_CustomerSearch.aspx','','width=500px,height=500px')"
Dim HL_CostPaid As HyperLink = DirectCast(e.Container.FindControl("HL_CostPaid"), HyperLink)
HL_CostPaid.NavigateUrl = "javascript:var W=window.open('p_Sales.aspx?IdReservation=" & e.Appointment.ID.ToString & "','','width=500px,height=500px')"
End If
Case SchedulerFormMode.AdvancedInsert
DTP_DateFrom.SelectedDate = e.Appointment.Start
DTP_DateTo.SelectedDate = e.Appointment.Start.AddHours(1)
Dim HL_Service As HyperLink = DirectCast(e.Container.FindControl("HL_Service"), HyperLink)
HL_Service.NavigateUrl = "javascript:var W=window.open('p_ServiceSearch.aspx','','width=500px,height=500px')"
Dim HL_Customer As HyperLink = DirectCast(e.Container.FindControl("HL_Customer"), HyperLink)
HL_Customer.NavigateUrl = "javascript:var W=window.open('p_CustomerSearch.aspx','','width=500px,height=500px')"
End Select
End Sub
Protected Sub RadAjaxManager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager.AjaxRequest
Select Case e.Argument.Split("|")(0)
Case "Move"
Dim oDaObReservation As New Cecchi.Elements.Reservation
oDaObReservation.PK.Add("IdReservation", New Guid(e.Argument.Split("|")(2)))
Dim oReservation As Data.DataRow = oDaObReservation.Get
Dim Durata As TimeSpan = CDate(oReservation("DateTo")).Subtract(oReservation("DateFrom"))
oReservation("DateFrom") = CDate(e.Argument.Split("|")(1))
oReservation("DateTo") = CDate(oReservation("DateFrom")) + Durata
oDaObReservation.Upd(oReservation)
BindScheduler()
Case "Resize"
Dim oDaObReservation As New Cecchi.Elements.Reservation
oDaObReservation.PK.Add("IdReservation", New Guid(e.Argument.Split("|")(2)))
Dim oReservation As Data.DataRow = oDaObReservation.Get
Dim Gap As TimeSpan = CDate(e.Argument.Split("|")(1)).Subtract(oReservation("DateTo"))
Dim Durata As TimeSpan = CDate(e.Argument.Split("|")(1)).Subtract(oReservation("DateFrom"))
oReservation("DateTo") = CDate(oReservation("DateTo")) + Gap
' Valuto la variazione di costo
Dim oDaObService As New Cecchi.Elements.DaObService
oDaObService.PK.Add("IdService", oReservation("IdService"))
Dim oService As Data.DataRow = oDaObService.Get
If oService IsNot Nothing Then
If oService("RentType") = 0 Then
' Costo orario
'Dim Durata As TimeSpan = DTP_DateTo.SelectedDate - DTP_DateFrom.SelectedDate
oReservation("CostDue") = Durata.TotalHours * CDec(oService("FeePerHour"))
End If
End If
oDaObReservation.Upd(oReservation)
BindScheduler()
End Select
End Sub
Protected Sub Ck_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Ck_Spazi.CheckedChanged, Ck_Mezzi.CheckedChanged, Ck_Servizi.CheckedChanged
BindScheduler()
End Sub
End Class