Zura Chikhladze
Top achievements
Rank 1
Zura Chikhladze
asked on 15 Jul 2013, 12:28 PM
Hi,
I have this issue and Please help me to solve it. I have the radscheduler on the page. The problems is that when employees see the
radscheduler to track the appointments they changed the time for few appointments which caused a serious trouble :). I realize that it can be readonly set to 'true' but this is not what i looking for.
Now, what i want to implement is the following: when a new appointment is entered a person should not be able to edit other already entered appointments and ONLY edit/delete his/her entered appointment. Thank you.
I have this issue and Please help me to solve it. I have the radscheduler on the page. The problems is that when employees see the
radscheduler to track the appointments they changed the time for few appointments which caused a serious trouble :). I realize that it can be readonly set to 'true' but this is not what i looking for.
Now, what i want to implement is the following: when a new appointment is entered a person should not be able to edit other already entered appointments and ONLY edit/delete his/her entered appointment. Thank you.
5 Answers, 1 is accepted
0
Hello,
An easy and conveninet way of achieving such functionality would be using the OnClientAppointmentEditing and OnClientAppointmentDeleting client-side events. In such cases you are able to cancel the edit or delete execution using the following line of code args.set_cancel(true). In order to have the username associated with the current appointment you can add that username as attribute to the appointment at the time of creation.
Here you may find more information about the RadScheduler client-side events.
Regards,
Boyan Dimitrov
Telerik
An easy and conveninet way of achieving such functionality would be using the OnClientAppointmentEditing and OnClientAppointmentDeleting client-side events. In such cases you are able to cancel the edit or delete execution using the following line of code args.set_cancel(true). In order to have the username associated with the current appointment you can add that username as attribute to the appointment at the time of creation.
Here you may find more information about the RadScheduler client-side events.
Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Zura Chikhladze
Top achievements
Rank 1
answered on 18 Jul 2013, 09:33 AM
Thank you Boyan for the replay. Could you please show me how it can be implemented using OnClientAppointmentEditing and OnClientAppointmentDeleting client-side events. Thank you so much. I have been stuck with this issue for couple of days and cannot deploy the scheduler.
here my code:
here my code:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
CustomAttributeNames
=
"EndTime,StartTime"
OnClientFormCreated
=
"InsertSubject"
CssClass
=
"testing"
OnClientAppointmentResizing
=
"pereventResize"
OnClientAppointmentMoveStart
=
"PreventDragDrop"
runat
=
"server"
DataEndField
=
"EndTime"
DataKeyField
=
"Id"
DataSourceID
=
"SqlDataSource1"
DataStartField
=
"StartTime"
DataSubjectField
=
"Subject"
Skin
=
"Office2010Blue"
StartEditingInAdvancedForm
=
"false"
DayEndTime
=
"20:00:00"
DayStartTime
=
"09:00:00"
FirstDayOfWeek
=
"Monday"
Height
=
"750px"
LastDayOfWeek
=
"Sunday"
OnAppointmentInsert
=
"RadScheduler1_AppointmentInsert"
OnAppointmentUpdate
=
"RadScheduler1_AppointmentUpdate"
WorkDayEndTime
=
"20:00:00"
WorkDayStartTime
=
"09:00:00"
AllowDelete
=
"false"
DataDescriptionField
=
"Description"
DataRecurrenceField
=
"RecData"
DataRecurrenceParentKeyField
=
"RecParrent"
EnableDescriptionField
=
"True"
>
<
AdvancedForm
Modal
=
"true"
/>
<
ResourceTypes
>
<
telerik:ResourceType
DataSourceID
=
"SqlDataSource2"
ForeignKeyField
=
"MeetingRoomID"
KeyField
=
"ID"
Name
=
"Floor"
TextField
=
"MeetingRoomFloor"
/>
</
ResourceTypes
>
<
AppointmentTemplate
>
<
div
>
<
h2
>
<%#Eval("Subject") %>
</
h2
>
<
p
>
<%#Eval("Description") %></
p
>
</
div
>
</
AppointmentTemplate
>
</
telerik:RadScheduler
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:CompanyInfoEventsConnectionString %>"
DeleteCommand="DELETE FROM [Event] WHERE [Id] = @Id" InsertCommand="INSERT INTO [Event] ([Subject], [StartTime], [EndTime], [Description], [RecParrent], [RecData], [MeetingRoomID]) VALUES (@Subject, @StartTime, @EndTime, @Description, @RecParrent, @RecData, @MeetingRoomID)"
SelectCommand="SELECT * FROM [Event]"
UpdateCommand="UPDATE [Event] SET [Subject] = @Subject, [StartTime] = @StartTime, [EndTime] = @EndTime, [Description] = @Description, [RecParrent] = @RecParrent, [RecData] = @RecData, [MeetingRoomID] = @MeetingRoomID WHERE [Id] = @Id">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"Id"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecParrent"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecData"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"MeetingRoomID"
Type
=
"Int32"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecParrent"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecData"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"MeetingRoomID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Id"
Type
=
"Int32"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:CompanyInfoEventsConnectionString %>"
DeleteCommand="DELETE FROM [MeetRoomFloor] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [MeetRoomFloor] ([MeetingRoomFloor]) VALUES (@MeetingRoomFloor)"
SelectCommand="SELECT * FROM [MeetRoomFloor]"
UpdateCommand="UPDATE [MeetRoomFloor] SET [MeetingRoomFloor] = @MeetingRoomFloor WHERE [ID] = @ID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"MeetingRoomFloor"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"MeetingRoomFloor"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
0
Hello,
The following code snippet will insert an appointment with attribute "user" and value "telerik_user" for sample purposes. That way you can access the username of the user who inserted the appointment and perform validation whether that same user is trying to edit or delete the appointment. If the current user is different it will cancel the action.
//markup code
//code behind
//JavaScript
Regards,
Boyan Dimitrov
Telerik
The following code snippet will insert an appointment with attribute "user" and value "telerik_user" for sample purposes. That way you can access the username of the user who inserted the appointment and perform validation whether that same user is trying to edit or delete the appointment. If the current user is different it will cancel the action.
//markup code
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
OnAppointmentInsert
=
"RadScheduler1_AppointmentInsert"
OnClientAppointmentEditing
=
"ClientAppointmentEditing"
OnClientAppointmentDeleting
=
"ClientAppointmentDeleting"
>
....
</
telerik:RadScheduler
>
protected
void
RadScheduler1_AppointmentInsert(
object
sender, AppointmentInsertEventArgs e)
{
//here you add the username as attribute
e.Appointment.Attributes.Add(
"user"
,
"telerik_user"
);
}
function
ClientAppointmentEditing(sender, args) {
var
appointment = args.get_appointment();
if
(appointment.get_attributes().getAttribute(
"user"
) !=
"telerik_user"
) {
args.set_cancel(
true
);
}
}
function
ClientAppointmentDeleting(sender, args) {
var
appointment = args.get_appointment();
if
(appointment.get_attributes().getAttribute(
"user"
) !=
"telerik_user"
) {
args.set_cancel(
true
);
}
}
Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Zura Chikhladze
Top achievements
Rank 1
answered on 22 Jul 2013, 11:16 AM
Boyan
thank you for the reply. i implemented the code you showed, but now when i click on the entered meeting i cannot edit or delete it. i was wondering how can i validate the user who is trying to edit/change the appointment? by means of popup or how?
thank you so much.
thank you for the reply. i implemented the code you showed, but now when i click on the entered meeting i cannot edit or delete it. i was wondering how can i validate the user who is trying to edit/change the appointment? by means of popup or how?
thank you so much.
0
Hello,
One convenient way would be to keep the current logged user credentials stored in the Session variable. That way you will be able to access this information at any time including the moments when user tries to delete/edit a specific appointment. More information about Session variable could be found here.
As you suggested a pop up form will work as well. That way you can implement a custom login form to show up when user tries to edit or delete an appointment and validate the user input data.
Regards,
Boyan Dimitrov
Telerik
One convenient way would be to keep the current logged user credentials stored in the Session variable. That way you will be able to access this information at any time including the moments when user tries to delete/edit a specific appointment. More information about Session variable could be found here.
As you suggested a pop up form will work as well. That way you can implement a custom login form to show up when user tries to edit or delete an appointment and validate the user input data.
Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.