Hi
Im using framework 4.5, asp.net, c# to caculate quote instantly. The quote for a delivery has be calculated using the kilometres between the pickUp point and DropOff Point, the diesel cost, wear and tear, and labourCost. The formula im using is total= (kilometres * DieselCost)+ wearAndTear + labourCost.
the cost are as follows:
1. kilometres need to be calculated using google maps
2. dieselCost = R12.00
3. wearAndTear = R5000.00
4. labourCost = R10000.00

I need help in the calculation aspect as I dont know where to code the cost figures. And the error keep coming up is "The name kilometres does not exist in the current context". please advise me if there is an easier way to get this working.
here is the codes i have done so far

controller.cs

 public ActionResult Quotation()
        {
            RedirectToAction("Quotation", "Home");
            return View();

        }

businessLogic.cs

{
   public class QuotationBusiness
    {
        public double calculate()
        {
            double total;

            total = (DieselCost * Kilometres) + labourCost + WearAndTear;
            return total;
        }

}

data.cs

public class Quotation
    {
    [Key]

        public string PickUp { get; set; }
        public string DropOff { get; set; }
        public int Quantity { get; set; }
        public int DieselCost { get; set; }
        public int Kilometre { get; set; }
        public int LabourCost { get; set; }
        public int WearAndTear { get; set; }
    }

model.cs

public class QuotationView
    {

        [Display(Name = "Pick Up Point")]
        [Required(ErrorMessage = "Pick Up Point required")]
        public string PickUp { get; set; }
        [Display(Name = "Drop Off Point")]
        [Required(ErrorMessage = "Drop Off Point required")]
        public string DropOff { get; set; }
        [Display(Name = "Quantity")]
        [Required(ErrorMessage = "Quantity required")]
        public int Quantity { get; set; }

    }

quotation.chtml

@{
    ViewBag.Title = "Quotation";
    Layout = "~/Views/Shared/_CustomerLayout.cshtml";
}

<h2>Quotation</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal"> <div class="alert alert-info" role="alert"> <h4>Get A Quote</h4> </div> <hr />


        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.PickUp, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.PickUp, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.PickUp, "", new { @class = "text-danger" })
            </div> </div> <div class="form-group">
            @Html.LabelFor(model => model.DropOff, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.DropOff, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.DropOff, "", new { @class = "text-danger" })
            </div> </div> <div class="form-group">
            @Html.LabelFor(model => model.Quantity, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10"> <div class="checkbox">
                    @Html.EditorFor(model => model.Quantity, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Quantity, "", new { @class = "text-danger" })
                </div> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Create" href="@Url.Action("Calculate")" class="btn btn-default" /> </div> </div> </div>

}    




}   

Recommended Answers

All 4 Replies

per kilometre

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.