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

Car Rental

10 Answers 169 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruno Pimentel
Top achievements
Rank 1
Bruno Pimentel asked on 17 Jan 2011, 08:11 PM
hello,

I downloaded the source code of the example "carrental" and I can not build the project.

The error message presented to me is: "Could not load file or assembly'Telerik.OpenAccess, 2010.2.714.1 Version =, Culture = neutral, PublicKeyToken =7ce17eeaf1d59342' or one of ITS dependencies."

I already tried to do the "Upgrade References" in menu "Telerik" in VS2010, but instead of this error is to appear the following error" Could not load file or assembly'Telerik.Web.UI' or one of ITS dependencies. " repeated five times.

Is there any place where you can download the version of ORM Q2 2010? Or your demoversion will be available in Q3 2010?

Greetings
bruno.

10 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 18 Jan 2011, 03:08 PM
Hello Bruno Pimentel,

How did you try to open the downloaded CarRental code? You need to select File / Open Web Site and choose CarRental.Web to open the code. Please take a look at the picture below:



If you open CarRental instead and build the solution there will be the error  "Could not load file or assembly'Telerik.Web.UI' or one of ITS dependencies" repeated five times.

Please let me know if this was helpful.

Regards,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Bruno Pimentel
Top achievements
Rank 1
answered on 18 Jan 2011, 07:28 PM
Is now solved.
However it is best to change the Source Code of "Car Rental" for the new version of the controls, because otherwise we have to change all the project's dll and web.config

In my case is already running.

Thanks for the help

0
Accepted
Veronica
Telerik team
answered on 19 Jan 2011, 09:08 AM
Hello Bruno Pimentel,

Thank you for the suggestion.

We are planning to update the Car Rental application soon and .dll-s will be changed accordingly. 

All the best,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Erik
Top achievements
Rank 2
answered on 09 Mar 2011, 09:10 PM
I've created a new version of the demo using the newest versions of ASP.NET controls and OpenAcces.

To do this, you also need to upgrade the project "Telerik.CarRental.Core" and use menu Telerik > openAccess > update references.

Ik would like to upload, but the max is 2 MB... :-|
0
siva sankar
Top achievements
Rank 1
answered on 02 May 2011, 12:43 PM
Hello

problem in rent a car application.
                                  
in Rent a car Application ->Daily schedule-> Pick a Specific Vehicle, In pick a specific vehicle it opens window, when i am selecting  view schedule in that window it was not showing schedule for that specific vehicle. whats the problem?  iam using SQL instead of  Object database. 
0
Veronica
Telerik team
answered on 02 May 2011, 12:53 PM
Hello Erik,

I can not tell you what may cause the problem without seeing your concrete implementation. Please open new Support thread and attach the code so I can inspect it and help you.

Thank you!

Kind regards,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
siva sankar
Top achievements
Rank 1
answered on 10 May 2011, 07:16 AM
Hello

problem in rent a car application.
                                  
in Rent a car Application ->Daily schedule-> Pick a Specific Vehicle, In pick a specific vehicle it opens window, when i am selecting  view schedule in that window it was not showing schedule for that specific vehicle. whats the problem?  iam using SQL instead of  Object database. Please Provide Sufficient Code by Using Sql instead of object datasource.

ASP Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DailySchedule.aspx.cs" Inherits="Default3" MasterPageFile="~/Masters/MasterPage.master" Theme="Clear"  %>
<%@ MasterType VirtualPath="~/Masters/MasterPage.master" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
  <telerik:RadCodeBlock ID="codeBlock" runat="server">
        <script type="text/javascript">
            function openRadWindow() {
                var oWnd = $find("<%= rwDailySchedule.ClientID%>");
                oWnd.show();
            }


            function closeRadWindow() {
                var oWnd = $find("<%= rwDailySchedule.ClientID%>");
                if (oWnd && oWnd.isVisible()) {
                    oWnd.close();
                }
            }
            var currentLoadingPanel = null;
            var currentUpdatedControl = null;
            function RequestStart(sender, args) {
                currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
                if (args.get_eventTarget().indexOf("cmbCarsSearch") != -1) {
                    currentUpdatedControl = "<%= Panel1.ClientID %>";
                }


                currentLoadingPanel.show(currentUpdatedControl);
            }
            function ResponseEnd() {
                if (currentLoadingPanel != null)
                    currentLoadingPanel.hide(currentUpdatedControl);
                currentUpdatedControl = null;
                currentLoadingPanel = null;
            }
        </script>
    </telerik:RadCodeBlock>


    <div class="catButtons">
        <telerik:RadMenu ID="rmCategory" runat="server" EnableSelection="true" EnableImagePreloading="true" DataTextField="CategoryName"  DataValueField="CategoryID" DataSourceID="SqlDataSource1"
            Skin="" OnItemClick="rmCategory_ItemClick" Width="100%" Style="z-index: 1;">
            
            <ItemTemplate>
                <telerik:RadBinaryImage ID="RadBinaryImage1" ImageUrl='<%# "App_Themes/Clear/images/categories/"+ Eval("ImageFileName") %>'  runat="server" DescriptionUrl="~/App_Themes/Clear/images/categories/hatchback.png" CssClass="RadToolTip_Clear" />
                </ItemTemplate>
        </telerik:RadMenu>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
        ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" 
        
            SelectCommand="SELECT * FROM [Categories]">
      </asp:SqlDataSource>
    </div>
    <div class="scheduleBox">
        <h2>
            Vehicles</h2>
        <br />
        <div style="float: right; outline: 0">
            <asp:Button runat="server" ID="btnPickVehicle" Text="Pick Specific Vehicle" OnClientClick="openRadWindow(); return false;" /></div>
        <asp:Label ID="lblClassVehicles" runat="server" CssClass="catTitle" />
        <br />
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnableAJAX="true" ClientEvents-OnRequestStart="RequestStart"
            ClientEvents-OnResponseEnd="ResponseEnd">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="cmbCarsSearch">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lvCars" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="lvCars">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lvCars" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rgCategory">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rsRentalOrders" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="lblClassVehicles" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rsRentalOrders">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rsRentalOrders" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
       <telerik:RadScheduler ID="rsRentalOrders" runat="server" ShowAllDayRow="False"
            ShowViewTabs="False" Height="550px" AppointmentStyleMode="Default" 
            GroupBy="Vehicle" StartInsertingInAdvancedForm="True" 
            OnAppointmentDataBound="rsRentalOrders_AppointmentDataBound"
            OnDataBound="rsRentalOrders_DataBound" DataSourceID="SqlDataSource2" DataKeyField="RentalOrderID"
            DataStartField="RentStartDate" DataEndField="RentEndDate" DataSubjectField="FullName"
            OnFormCreating="rsRentalOrders_FormCreating" 
            OnFormCreated="rsRentalOrders_FormCreated">
            <AdvancedForm Modal="true" />
            <ResourceHeaderTemplate>
                <asp:Image ID="VehicleImage" runat="server" Width="75px" Height="48px" ImageUrl='<%# "~/Images/Thumbs/" + Eval("ImageFileName") %>' />
                <div>
                    <%# Eval("Text") %>
                </div>
            </ResourceHeaderTemplate>
            <ResourceTypes>
                <telerik:ResourceType DataSourceID="SqlDataSource2" TextField="Make" KeyField="CarID"
                    ForeignKeyField="CarID" Name="Vehicle" />
                <telerik:ResourceType DataSourceID="SqlDataSource2" TextField="FullName" KeyField="CustomerID"
                    ForeignKeyField="CustomerID" Name="Customer" />
            </ResourceTypes>
        </telerik:RadScheduler>
       
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" 
            DeleteCommand="DELETE FROM [RentalOrders] WHERE [RentalOrderID] = @RentalOrderID" 
            InsertCommand="INSERT INTO RentalOrders(CustomerID, CarID, OrderStatus, RateApplied, RentEndDate, RentStartDate) VALUES (@CustomerID, @CarID, @OrderStatus, @RateApplied, @RentEndDate, @RentStartDate)" 
             SelectCommand="SELECT Cars.CarID, Cars.TagNumber, Cars.Make, Cars.Model, Cars.CarYear, Cars.CategoryID, Cars.Mp3Player, Cars.DVDPlayer, Cars.AirConditioner, Cars.ABS, Cars.ASR, Cars.Navigation, Cars.Available, Cars.Latitude, Cars.Longitude, Cars.ImageFileName, Cars.Rating, Cars.NumberOfRatings, Categories.CategoryName, Customers.FullName, Customers.CustomerID,RentalOrders.RentalOrderID, RentalOrders.RentStartDate, RentalOrders.RentEndDate FROM Cars INNER JOIN Categories ON Cars.CategoryID = Categories.CategoryID LEFT OUTER JOIN RentalOrders ON Cars.CarID = RentalOrders.CarID LEFT OUTER JOIN Customers ON RentalOrders.CustomerID = Customers.CustomerID WHERE (Categories.CategoryID = @CategoryId)"
          
            UpdateCommand="UPDATE [RentalOrders] SET [CustomerID] = @CustomerID, [CarID] = @CarID, [OrderStatus] = @OrderStatus, [RateApplied] = @RateApplied, [RentEndDate] = @RentEndDate, [RentStartDate] = @RentStartDate WHERE [RentalOrderID] = @RentalOrderID">
            <SelectParameters>
                  <asp:QueryStringParameter DbType="Int32" DefaultValue="1" Name="CategoryId" 
                      QueryStringField="@CategoryId" />
              </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="RentalOrderID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="CustomerID" Type="Int32" />
                <asp:Parameter Name="CarID" Type="Int32" />
                <asp:Parameter Name="OrderStatus" Type="String" />
                <asp:Parameter Name="RateApplied" Type="Decimal" />
                <asp:Parameter Name="RentEndDate" Type="DateTime" />
                <asp:Parameter Name="RentStartDate" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="CustomerID" Type="Int32" />
                <asp:Parameter Name="CarID" Type="Int32" />
                <asp:Parameter Name="OrderStatus" Type="String" />
                <asp:Parameter Name="RateApplied" Type="Decimal" />
                <asp:Parameter Name="RentEndDate" Type="DateTime" />
                <asp:Parameter Name="RentStartDate" Type="DateTime" />
                <asp:Parameter Name="RentalOrderID" Type="Int32" />
            </UpdateParameters>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          </asp:SqlDataSource>
      <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" 
            SelectCommand="SELECT * FROM [Cars]"></asp:SqlDataSource>
        <telerik:RadWindow ID="rwDailySchedule" runat="server" Behaviors="Close, Move" Width="760px"
            Height="575px" VisibleStatusbar="False" Modal="True" Animation="Slide"
            Title="Pick Vehicle" ReloadOnShow="True" DestroyOnClose="True" 
            IconUrl="~/Images/icons/vehicle.gif" Behavior="Close, Move">
            <ContentTemplate>
                <telerik:RadComboBox ID="cmbCarsSearch" runat="server" EmptyMessage="Select make"
                    AutoPostBack="true" OnSelectedIndexChanged="cmbCarsSearch_SelectedIndexChanged"
                    Style="margin: 5px 0 15px 0;">
                </telerik:RadComboBox>
                <asp:Panel ID="Panel1" runat="server">
                    <div id="divScroll" style="height: 450px; overflow: auto; margin-bottom: 15px;" runat="server">
                        <telerik:RadListView ID="lvCars" runat="server" DataKeyNames="CarID" DataSourceID="SqlDataSource3"
                            ItemPlaceholderID="CarsContainer" AllowMultiItemSelection="true">
                            <LayoutTemplate>
                                <div class="RadListView RadListViewFloated RLVCarList">
                                    <div class="rlvFloated rlvNoScroll">
                                        <asp:PlaceHolder ID="CarsContainer" runat="server" />
                                    </div>
                                </div>
                            </LayoutTemplate>
                            <ItemTemplate>
                                <div class="rlvI">
                                    <asp:LinkButton ID="lbSelect" runat="server" CommandName="Select">
                                        <asp:Image ID="imgModel" runat="server" ImageUrl='<%# "Images/Thumbs/" + Eval("ImageFileName") %>'
                                            AlternateText='<%# Eval("Make") %>' />
                                        <span class="rlvBSel">&nbsp;</span>
                                        <asp:Label ID="lblModel" runat="server" Text='<%# Eval("Make") %>'></asp:Label>
                                    </asp:LinkButton>
                                </div>
                            </ItemTemplate>
                            <SelectedItemTemplate>
                                <div class="rlvISel">
                                    <asp:LinkButton ID="lbDeselect" runat="server" CommandName="Deselect">
                                        <asp:Image ID="imgModel" runat="server" ImageUrl='<%# "Images/Thumbs/" + Eval("ImageFileName") %>'  AlternateText='<%# Eval("Model") %>' />
                                        <span class="rlvBSel">&nbsp;</span>
                                        <asp:Label ID="lblModel" runat="server" Text='<%# Eval("Make") %>'></asp:Label>
                                    </asp:LinkButton>
                                </div>
                            </SelectedItemTemplate>
                        </telerik:RadListView>
                    </div>
                </asp:Panel>
                <div style="float: right">
                    <asp:Button runat="server" ID="btnViewSchedule" Text="View Schedule" OnClick="btnViewSchedule_Click" />
                    <asp:Button runat="server" ID="btnCancel" Text="Cancel" OnClick="btnCancel_Click" />
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
    </div>
        </div>
     </asp:Content>

C# Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using Telerik.Web.UI;
using Telerik.CarRental.Core;






public partial class Default3 : Page, IFilterContainer<CarsByCategory>
{
    public event EventHandler<EventArgs> FilterChanged;


    public CarsByCategory Criteria
    {
        get
        {
            var criteria = new CarsByCategory();


            if (rmCategory.SelectedItem != null)
            {
                criteria.Category = rmCategory.SelectedItem.Attributes["Category"];
            }


            return criteria;
        }
    }


    private const string SessionKeySelectedCarIds = "DailySchedule_SelectedCarIds";
    private IList<int> SelectedCarIds
    {
        get
        {
            if (Session[SessionKeySelectedCarIds] == null)
            {
                Session[SessionKeySelectedCarIds] = new List<int>();
            }


            return (IList<int>)Session[SessionKeySelectedCarIds];
        }
    }


    private readonly Color[] PredefinedColors = new Color[] {
        Color.FromArgb(237, 214, 171),
        Color.FromArgb(202, 237, 171),
        Color.FromArgb(167, 186, 197),
        Color.FromArgb(171, 205, 237)
    };


    private readonly Color[] PredefinedBorders = new Color[] {
        Color.FromArgb(207, 194, 141),
        Color.FromArgb(172, 207, 141),
        Color.FromArgb(137, 156, 167),
        Color.FromArgb(141, 175, 207)
    };


    private readonly Random RandomGenerator = new Random();


    protected void Page_Load(object sender, EventArgs e)
    {
        Master.BoxCssClass = "schedule";
        rmCategory.ItemClick += new RadMenuEventHandler(rmCategory_ItemClick);
        if (!IsPostBack)
        {
            SelectedCarIds.Clear();
         
            PopulateMakesComboBox();
        }


        if (rmCategory.SelectedItem != null)
        {
            lblClassVehicles.Text = rmCategory.SelectedItem.Attributes["Category"];
        }
    }




    protected void rsRentalOrders_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
    {
        if (e.Mode == SchedulerFormMode.AdvancedInsert)
        {
            e.Appointment.Start = rsRentalOrders.UtcDayStart(e.Appointment.Start);
            e.Appointment.End = e.Appointment.Start.AddDays(1);
        }


        var currentVehicle = e.Appointment.Resources.GetResourceByType("Vehicle").Text;
        if (e.Mode == SchedulerFormMode.AdvancedInsert || e.Mode == SchedulerFormMode.AdvancedEdit)
        {
            rsRentalOrders.Localization.AdvancedNewAppointment = "Rental order for " + currentVehicle;
            rsRentalOrders.Localization.AdvancedEditAppointment = rsRentalOrders.Localization.AdvancedNewAppointment;
        }


    }


    protected void rsRentalOrders_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        var subjectTextBox = e.Container.FindControl("Subject") as RadTextBox;
        if (subjectTextBox != null)
        {
            subjectTextBox.Style["height"] = "0px";
            subjectTextBox.Style["visibility"] = "hidden";
            subjectTextBox.Label = string.Empty;
            subjectTextBox.Text = "empty";
        }


        var vehicleComboBox = e.Container.FindControl("ResVehicle") as RadComboBox;
        if (vehicleComboBox != null)
        {
            vehicleComboBox.Parent.Visible = false;
        }


        RadComboBox customersCombo = e.Container.FindControl("ResCustomer") as RadComboBox;
        var defaultItem = customersCombo.FindItemByText("-");
        if (defaultItem != null)
        {
            defaultItem.Remove();
        }
    }


    protected void rmCategory_ItemClick(object sender, RadMenuEventArgs e)
    {
        SqlDataSource2.SelectParameters["CategoryID"].DefaultValue = rmCategory.SelectedItem.Value;
        rsRentalOrders.DataBind();




    }


    protected void rsRentalOrders_AppointmentDataBound(object sender, SchedulerEventArgs e)
    {
        var apt = e.Appointment;
        if (apt.Resources.GetResourceByType("Vehicle") != null)
        {
            var seed = RandomGenerator.Next(PredefinedColors.Length);
            e.Appointment.BackColor = PredefinedColors[seed];
            e.Appointment.BorderColor = PredefinedBorders[seed];
        }
    }


    protected void rsRentalOrders_DataBound(object sender, EventArgs e)
    {
        foreach (Resource resource in rsRentalOrders.Resources.GetResourcesByType("Vehicle"))
        {
            resource.Attributes["ImageFileName"] = DataBinder.Eval(resource.DataItem, "ImageFileName") as String;
        }
    }






    private void OnFilterChanged(EventArgs e)
    {
        var handler = FilterChanged;
        if (handler != null)
        {
            handler(this, e);
        }
    }


    private void PopulateMakesComboBox()
    {
        var carsService = new CarsService();


        var uniqueMakes = new HashSet<string>();
        //foreach (var car in carsService.RetrieveAllCars())
        {
            //uniqueMakes.Add(car.Make);
        }


        cmbCarsSearch.Items.Add(new RadComboBoxItem("-- All Makes --", string.Empty));
        var uniqueMakesArray = uniqueMakes.ToArray();
        Array.Sort(uniqueMakesArray, StringComparer.InvariantCulture);


        foreach (string make in uniqueMakesArray)
        {
            cmbCarsSearch.Items.Add(new RadComboBoxItem(make, make));
        }
    }


    protected void cmbCarsSearch_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {


        lvCars.ClearSelectedItems();
        lvCars.Rebind();
    }


    protected void btnViewSchedule_Click(object sender, EventArgs e)
    {
        if (lvCars.SelectedItems.Count == 0)
        {
            return;
        }


        rmCategory.ClearSelectedItem();


        SelectedCarIds.Clear();
        foreach (var car in lvCars.SelectedItems)
        {
            SelectedCarIds.Add((int)car.GetDataKeyValue("CarID"));
        }


        ClearSelectionAndCloseWindow();
        lblClassVehicles.Text = string.Empty;
        rsRentalOrders.Rebind();
    }


    protected void btnCancel_Click(object sender, EventArgs e)
    {
        ClearSelectionAndCloseWindow();
    }


 
    protected void ClearSelectionAndCloseWindow()
    {
        lvCars.ClearSelectedItems();
        lvCars.Rebind();
        cmbCarsSearch.ClearSelection();
        RadAjaxManager1.ResponseScripts.Add("closeRadWindow();");
    }
  




    public object CategoryID { get; set; }
}


0
Veronica
Telerik team
answered on 10 May 2011, 07:49 AM
Hello Siva,

Could you please open new support thread and attach your code so I can inspect it and help you?

Thank you!

Kind regards,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ron
Top achievements
Rank 1
answered on 30 Jan 2013, 12:36 PM
Where is the car rental code - I would like to see it.
0
Erik
Top achievements
Rank 2
answered on 30 Jan 2013, 12:39 PM
Hi John,

you can find it here: http://demos.telerik.com/aspnet-ajax/carrental/about.aspx

Regards,

Erik
Tags
General Discussions
Asked by
Bruno Pimentel
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Bruno Pimentel
Top achievements
Rank 1
Erik
Top achievements
Rank 2
siva sankar
Top achievements
Rank 1
Ron
Top achievements
Rank 1
Share this question
or