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

dnn user integration

1 Answer 128 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 14 Feb 2009, 05:39 PM
I have been reading through the threads on use of RadScheduler in dnn. I have downloaded the example dnn module 080623_SchdulerDNNSample.zip and intend to play around with this. I did notice that this example uses an XML data source. I also see instructions in the help section on a tutorial for creating a dnn module using the scheduler as an example http://www.telerik.com/help/aspnet-ajax/how-to-create-dnn-module-telerik-ajax-controls3.html . This help section use a sql data provider which is my desired approach. I have a few questions though and some of them might be kind of dumb as I'm somewhat new to this environment :-)

The xml file in the xml data source example dnn module defines some example resources, users, and appointments. This seems self explanatory. The tutorial using the sql data source talks to creating a table to store appointments and defining the appropriate columns for managing appointments but doesn't mention any kind of setup for resources and users. Does anything additional have ot be done here?

Also, I am curious as to how the module could be linked to actual dnn users. What I really want is for "users" in the Rad Scheduler context to be "users" in the dnn context. That is can RadScheduler be configured to pick up registered dnn users as users for the purpous of RadScheduler and have it pick up the appropriate fields from the dnn user profile tables. To that end it would be ideal if it could also pick up selected users, maybe by roles, as resources.

My scenario here is that I want to set up an appointment system where I have a number of providers (essentialy resources) and clients of those providers (users). I want to be able to create appointments where I am scheduling an individual user with a provider. An example might be a doctors office, although the scenario is quite common. Since I also want these users to be able to login to the dnn site using the normal dnn mechanisms and view their private appointments, and also have appointment schedulers be able to login and have a role where they can schedule these appointments, it would be great if if I could somehow link the dnn users with RadScheduler. It seems like the control itself is more than capable of providing the functionality I need, although I'm not entirley sure yet about the concept of permissions and limiting views based on credentials etc. however, the abilit yto fully integrate with dnn users I'm really not sure about.

Does anyone have any experience or advice on how to best approach the scenario I'm trying to implement? It seems like this would be a very common thing but like most folks that have looked it doesn't seem as if there is a good dnn appointment soltuion out there.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 18 Feb 2009, 12:40 PM
Hi Jerry,

Thank you for these interesting questions.

Normally, you can add resource types to RadScheduler following this topic: Resource Type Collection Editor. In DNN, following this tutorial, you will need to create a foreign key field for the resource type. For example, modify stept 11 to include a foreign key field for a Users resource type:
 
CREATE TABLE [{objectQualifier}Appointments1]     
(     
  [ID]                    INT IDENTITY(1,1)   NOT NULL,  
  [ModuleId]              INT                 NOT NULL,     
  [Subject]               nvarchar(255)       NOT NULL,     
  [Start]                 datetime            NOT NULL,     
  [End]                   datetime            NOT NULL,     
  [UserID]                INT                 NULL,   
  [RecurrenceRule]        nvarchar(1024)      NULL,     
  [RecurrenceParentID]    INT                 NULL,     
 
  CONSTRAINT [PK_Appointments1] PRIMARY KEY CLUSTERED      
      ([ID]),     
 
  CONSTRAINT [FK_Appointments1_ParentAppointments1] FOREIGN KEY     
      ([RecurrenceParentID])     
  REFERENCES     
      [{objectQualifier}Appointments1] ([ID])     
)   
 
 


Then, after you complete the rest of the steps, you can continue adding a User resource type according to the Resource Type Collection Editor topic.

To create a data source for your User resource type, please follow steps 12 through 14 again from this tutorial. However, in step 14 you will need to selecte the Users data table (see the attached screenshot).  

After everything is complete, your code may look something like the following:
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End" DataKeyField="ID" 
    DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" 
    DataStartField="Start" DataSubjectField="Subject" HoursPanelTimeFormat="htt" 
    ValidationGroup="ctl00_RadScheduler1" DataSourceID="SqlDataSource1" > 
    <ResourceTypes> 
        <telerik:ResourceType DataSourceID="SqlDataSource2" ForeignKeyField="UserID" KeyField="UserID" 
            Name="User" TextField="Username" /> 
    </ResourceTypes> 
</telerik:RadScheduler> 
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
    SelectCommand="SELECT * FROM [Users]"></asp:SqlDataSource> 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
    DeleteCommand="DELETE FROM [Appointments1] WHERE ([ID] = @ID AND [ModuleId] = @ModuleId)" 
    InsertCommand="INSERT INTO [Appointments1] ([ModuleId], [Subject], [Start], [End], [UserID], [RecurrenceRule], [RecurrenceParentID]) VALUES (@ModuleId, @Subject, @Start, @End, @UserID, @RecurrenceRule, @RecurrenceParentID)" 
    SelectCommand="SELECT * FROM [Appointments1] WHERE ([ModuleId] = @ModuleId)" 
    UpdateCommand="UPDATE [Appointments1] SET [ModuleId] = @ModuleId, [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE [ID] = @ID">  
    <SelectParameters> 
        <asp:Parameter Name="ModuleId" Type="Int32" /> 
    </SelectParameters> 
    <DeleteParameters> 
         <asp:Parameter Name="ID" Type="Int32" /> 
         <asp:Parameter Name="ModuleId" Type="Int32" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="ModuleId" Type="Int32" /> 
        <asp:Parameter Name="Subject" Type="String" /> 
        <asp:Parameter DbType="DateTime" Name="Start" /> 
        <asp:Parameter DbType="DateTime" Name="End" /> 
        <asp:Parameter Name="UserID" Type="Int32" /> 
        <asp:Parameter Name="RecurrenceRule" Type="String" /> 
        <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> 
        <asp:Parameter Name="ID" Type="Int32" /> 
    </UpdateParameters> 
    <InsertParameters> 
        <asp:Parameter Name="ModuleId" Type="Int32" /> 
        <asp:Parameter Name="Subject" Type="String" /> 
        <asp:Parameter DbType="DateTime" Name="Start" /> 
        <asp:Parameter DbType="DateTime" Name="End" /> 
        <asp:Parameter Name="UserID" Type="Int32" /> 
        <asp:Parameter Name="RecurrenceRule" Type="String" /> 
        <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> 
    </InsertParameters> 
</asp:SqlDataSource> 

  Protected Sub SqlDataSource1_Deleting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Deleting  
        e.Command.Parameters("@ModuleId").Value = ModuleId  
    End Sub 
 
    Protected Sub SqlDataSource1_Inserting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Inserting  
        e.Command.Parameters("@ModuleId").Value = ModuleId  
    End Sub 
 
    Protected Sub SqlDataSource1_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting  
        e.Command.Parameters("@ModuleId").Value = ModuleId  
    End Sub 
 
    Protected Sub SqlDataSource1_Updating(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Updating  
        e.Command.Parameters("@ModuleId").Value = ModuleId  
    End Sub 

Note that if you are using SQL 2005 you need to manually replace the auto-generated "Date" type to "DateTime" in your data source parameters:
<asp:Parameter DbType="DateTime" Name="Start" />
<asp:Parameter DbType="DateTime" Name="End" />

To display appointments just for a specific user, you can modify the select command of the RadScheduler's data source similarly to this online demo.

Feel free to contact us if you have any other questions.

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Jerry
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or