This is a migrated thread and some comments may be shown as answers.

Access the username

3 Answers 50 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Zura Chikhladze
Top achievements
Rank 1
Zura Chikhladze asked on 22 Jul 2013, 01:01 PM
Hello,

i was wondering how can i 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? by means of popup or how? can you please show me. 
Thank you. 

Here is the 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("Nick", "Kapanadze");
   }
 
function ClientAppointmentEditing(sender, args) {
    var appointment = args.get_appointment();
    if (appointment.get_attributes().getAttribute("Nick") != "Kapanadze") {
        args.set_cancel(true);
    }
      
}
  
function ClientAppointmentDeleting(sender, args) {
    var appointment = args.get_appointment();
    if (appointment.get_attributes().getAttribute("Nick") != "Kapanadze") {
        args.set_cancel(true);
    }
}

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 25 Jul 2013, 05:41 AM
Hello Zura,

 
You can apply both popups and message somewhere on the page as for example it is done in this on-line demo.
Another way is with pop up by using the client events of RadScheduler as it is done in this on-line demo.

Hope this will be helpful.

Regards,
Plamen
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 25 Jul 2013, 07:30 AM
Hello Plamen,

Thank u 4 ur support. Here is the case i am looking 4:

say we have 10 admins (A - J people) who are managing (edit/delete/update) appointments

1. say A inserts the appointment
2. B now tries to update the A entered appointment. When clicked on the A entered appointment, popup shows up asking B to enter username. If B fails to enter A's username the appointment entered by A cannot be changed(edit/delete/update), if B enters correct A username the change can be possible. the same rule applies for the other admins, i.e. A cannot change C, C cannot change F etc.



otherwise all appointments are locked (READONLY) from change. only people who can enter correct username can change appointment already entered by other admins (i.e have sufficient permission level to alter appointments)

Can you please help me to implement this case. I have been stuck with this issue for couple of weeks and cannot deploy the radscheduler. Maybe we can somehow apply to this case the permission levels you sent me in other mail. 


0
Plamen
Telerik team
answered on 30 Jul 2013, 08:47 AM
Hi Zura,

 
One way to achieve such scenario is to set the custom attribute to the each appointment when you create it and then check it with a prompt in the OnClientAppointmentEditing event as in the code below:

<script type="text/javascript">
           function OnClientAppointmentEditing(sender,args) {
              
               var person = prompt("Please enter the name of the appointment user!");
               if (person != null && person != "") {
                   if (person!=args.get_appointment().get_attributes().getAttribute("Location")) {
                       args.set_cancel(true);
                       alert("you can not update this appointment");
                   }
                   
               }
           }
 
       </script>
 
   <telerik:RadScheduler runat="server" ID="RadScheduler1"
        OnClientAppointmentEditing="OnClientAppointmentEditing"
        EnableCustomAttributeEditing="true" CustomAttributeNames="Location">         
   </telerik:RadScheduler>

Hope this will be helpful.Regards,
Plamen
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.
Tags
Scheduler
Asked by
Zura Chikhladze
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Zura Chikhladze
Top achievements
Rank 1
Share this question
or