Telerik OpenAccess ORM

Telerik OpenAccess ORM Send comments on this topic.
Creating the CarRentalAgency Application
Programmer's Guide > OpenAccess ORM Classic (Old API) > Getting Started > QuickStart > Creating the CarRentalAgency Application

Glossary Item Box

This task will explain you how to create CarRentalAgency web site. You will learn how to set up various pages and add controls to them.

Creating Web Application

To create the client Web application using Visual Studio:

  1. Press File->Add-> New Project in Visual Studio
  2. Choose ASP.NET web application
  3. In the Name field write CarRentalWeb.
  4. Press OK to generate the ASP.NET application.
  5. Right click on the references folder and choose Add Reference...

    AddingReferences
  6. Click on the Projects tab and choose OpenAccessData.

    ChoosingOpenAccessData
  7. Click Ok.
  8. Select your OpenAccessData Project. From Telerik menu point OpenAccess and then Enable Project to use ORM.
  9. Leave everything as it is, just this time mark the Data Access Code (DAL) option.
  10. Click on your CarRental web application and choose Enable Project to use ORM... but this time on step 2 uncheck all the boxes and click next and finish.

Creating the CarRental Forms

To create the Master Page:

  1. Right click on your web application and choose Add->New Item.
  2. In the pop up menu choose Master Page
  3. Name it  "CarRentMaster.Master" than click add.
  4. Double click your CarRentMaster page.
  5. Click on design.

    Click Design
  6. Open your toolbox and expand RadControls for ASPNET AJAX
  7. Add RadScriptManager
  8. Click on the RadScriptManger and choose Register Telerik.WEB.UI.WebResource.axd

    Register telerik rad menu webresource

  9. Add RadMenu control.
  10. Click on the RadMenu control and choose build rad menu

    Click on build rad menu

  11. Click “add root item” and write home.
  12. On the “NavigateURL” property choose default.aspx
  13. Using the same approach add all of your pages in the menu(except the error page and the order completed page)
  14. Open the code behind and replace the code with the following
    VB.NET Copy Code
     Imports System
     Imports System.Collections.Generic
     Imports System.Linq
     Imports System.Web
     Imports System.Web.UI
     Imports System.Web.UI.WebControls
     Imports Telerik.OpenAccess
     Imports OpenAccessData
     Namespace CarRentWebSite
      Partial Public Class CarRentMaster
       Inherits System.Web.UI.MasterPage
       Private scope_Renamed As IObjectScope = ObjectScopeProvider1.GetNewObjectScope()
       Public Property Scope() As IObjectScope
        Get
         Return scope_Renamed
        End Get
        Set(ByVal value As IObjectScope)
         scope_Renamed = value
        End Set
       End Property
       Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
       End Sub
       Public Overrides Sub Dispose()
        scope_Renamed.Dispose()
        MyBase.Dispose()
       End Sub
      End Class
     End Namespace
    C# Copy Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.OpenAccess;
    using OpenAccessData;

    namespace CarRentWebSite
    {
        
    public partial class CarRentMaster : System.Web.UI.MasterPage
        {
            
    private IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();

            
    public IObjectScope Scope
            {
                get {
    return scope; }
                set { scope = value; }
            }
          
            
    protected void Page_Load(object sender, EventArgs e)
            {
              
            }
            
    public override void Dispose()
            {
                scope.Dispose();
                
    base.Dispose();
            }
        }
    }

You should set this master page as a master for every other page that you create.


The above code has been taken from the Best Practices in Web Development Knowledge base. More information on this and other approaches can be found here.

  • Creating the Default(home) page.
    1. Right click on your web application ahd choose Add->New item.
    2. In the pop up menu choose WebForm.
    3. Name it "Default.aspx"
    4. Expand your RadControls for ASPNET ajax located in the toolbox
    5. Add a rad grid control
  • Creating the AvailableCars.aspx
    1. Right click on your web application ahd choose Add->New item.
    2. In the pop up menu choose WebForm.
    3. Name it "AvailableCars.aspx"
    4. Expand your RadControls for ASPNET ajax located in the toolbox
    5. Add a rad grid control
  • Creating the SeeRates.aspx
    1. Right click on your web application ahd choose Add->New item.
    2. In the pop up menu choose WebForm.
    3. Name it "SeeRates.aspx"
    4. Expand your RadControls for ASPNET ajax located in the toolbox
    5. Add a rad grid control
  • Creating the Advanced Search Page
    1. Right click on your web application ahd choose Add->New item.
    2. In the pop up menu choose WebForm.
    3. Name it "AdvanceSearch.aspx"
    4. Expand your RadControls for ASPNET ajax located in the toolbox
    5. Add rad text box.
    6. Add 1 button.
    7. Add 7 check boxes
    8. Add 2 radio buttons
    9. Add 1 rad grid
  • Creating the Book A Car Page
    1. Right click on your web application ahd choose Add->New item.
    2. In the pop up menu choose WebForm.
    3. Name it "BookACar.aspx"
    4. Expand your RadControls for ASPNET ajax located in the toolbox
    5. Add 11 rad text boxes and name each of them as follows:
      • DrivingLicense
      • Names
      • Address
      • Country
      • City
      • State
      • ZIP
      • StartDate
      • EndDate
      • RadTextBox1
      • RadTextBox2
    6. Set the visible property for each text box to false
    7. Add 1 button
    8. Add 1 rad grid
  • Creating the helper pages
    1. Add some text in between the content tags

Next Step

Next, you will add a query to the code-behind that loads specific Car objects and those Car objects will be bound to the grid control.