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

How to make a resource and all connected timeslots invisible

4 Answers 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Martin Gartmann
Top achievements
Rank 2
Martin Gartmann asked on 09 Dec 2008, 10:18 AM
Dear Staff,

i would like to do the following task.

I have severall rooms (defined at Design Time) and i want to show/hide this rooms depending on the current users rights. These rights are stored i a seperate database table (None/View/Edit).

i found that it is posible to hide a resource header and to disable a timeslot depening on resource text, but when i hide the header the needed space in radscheduler is still occupied.

Any suggestion how to simply hide a resource ? 

another possible way would be to create the resource at design time.

Kind Regards

Martin

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Dec 2008, 05:10 PM
Hi Martin,

The Defining Resources example uses a select parameter for the appointment's data source to filter appointments based on the selected user. You can use similar approach with a select paremeter for your Room resource data source to filter resources based on the curent users' rights. Please, let me know if there is more to your case which prevents you from using the suggested approach.



Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Martin Gartmann
Top achievements
Rank 2
answered on 09 Dec 2008, 07:19 PM
Hi Peter,

i guess i am on a good way in the meanwhile.

What i want to do is, to read in all appointments for the current day, show them i an dayview and group then by a resource (Rooms) , so that the appointments are visible side by side. These steps are already working.

But depending on the users right i want to disable or hide one or more off these rooms in dayview groupby.

Just disabling a rooms in dayview is currently not very clear.

Kind Regards

Martin


0
Peter
Telerik team
answered on 12 Dec 2008, 10:18 AM
Hello Martin,

This functionality can be implemented in a number of ways. One simple way to achieve this is to dynamically set the SelectCommand of your Resource datasource in Page Load based on the current user priviliges. I have attached a simple demo for reference. Try setting userRights to "partial" and "full" and observe the effect.

 protected void Page_Load(object sender, EventArgs e)  
    {  
        string userRights = "full";  
       AccessDataSource2.SelectCommand = "SELECT [ID], [GroupName], [Rights] FROM [Group] WHERE ([Rights] ='" + userRights +"')";  
    } 

Also review the Group table in the AccessDataSource.


Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Martin Gartmann
Top achievements
Rank 2
answered on 12 Dec 2008, 12:38 PM
Hello Peter,

infact many ways are possible. I solved my problem in the following way:

1. On login some permissions connected o a user are stored to Session Variables
2. on Page load of the user control the resources are set from code behind, instead of defining at design time

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
 
        ' 1 - none , 2 - view , 3 - edit  
 
        If Not IsPostBack Then  
 
            Dim resType As New ResourceType("Spektrometer")  
            resType.ForeignKeyField = "RoomID" 
            rsAll.ResourceTypes.Add(resType)  
 
            If Session("myDPX200") > 1 Then  
                rsAll.Resources.Add(New Resource("Spektrometer", 1, "DPX-200"))  
            End If  
 
            If Session("myDPX250") > 1 Then  
                rsAll.Resources.Add(New Resource("Spektrometer", 2, "DPX-250"))  
            End If  
 
            If Session("myDRX400") > 1 Then  
                rsAll.Resources.Add(New Resource("Spektrometer", 3, "DRX-400"))  
            End If  
 
            If Session("myDSX400") > 1 Then  
                rsAll.Resources.Add(New Resource("Spektrometer", 4, "DSX-400"))  
            End If  
 
            If Session("myDRX600") > 1 Then  
                rsAll.Resources.Add(New Resource("Spektrometer", 5, "DRX-600"))  
            End If  
 
        End If  
    End Sub 

3. Right on appointments are set during each AppintmentCreated  (code not fully complete yet ... ;-) )

  Protected Sub rdsAppUser_AppointmentCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentCreatedEventArgs) Handles rdsAppUser.AppointmentCreated  
 
        ' wenn ein Appointment bereits bekommen hat oder in der Vergangenheit liegt,   
        ' ist ein Löschen nicht mehr erlaubt  
 
        If e.Appointment.Start < Now Or Session("UID") <> e.Appointment.Attributes("UserID") Then  
            e.Appointment.AllowDelete = False 
            e.Appointment.AllowEdit = False 
        End If  
 
        If e.Appointment.Start > Now Then  
            If Session("UID") = e.Appointment.Attributes("UserID") Then  
                e.Appointment.AllowDelete = True 
                e.Appointment.AllowEdit = True 
            End If  
 
        End If  
 
        ' wenn der momentane Nutzer den Termin nicht eingetragen hat,  
        ' ist ein Löschen oder Ändern ebenfalls nicbt erlaubt  
 
    End Sub 

Thank your for your suggestion.

Have a nice weekend

Martin

Tags
Scheduler
Asked by
Martin Gartmann
Top achievements
Rank 2
Answers by
Peter
Telerik team
Martin Gartmann
Top achievements
Rank 2
Share this question
or