Пример #1
0
        public ActionResult GetDealer(string code)
        {
            var dealerSvc = new DealerLogic(Ticket);
            var ajaxObj = dealerSvc.GetAjax(code);

            return Json(ajaxObj, JsonRequestBehavior.AllowGet);
        }
        public ActionResult Create(int id, FormCollection form)
        {
            var vehicleServiceSvc = new VehicleServiceLogic(Ticket);
            var dealerSvc = new DealerLogic(Ticket);

            var dealerId = StringUtility.ToInt(form["dealerId"]);
            var dealerObj = dealerSvc.GetById(dealerId);

            var serviceObj = new VehicleServiceEntity();
            serviceObj.VehicleId = id;
            if (dealerObj != null)
            {
                serviceObj.Dealer.Id = dealerObj.Id;
                serviceObj.Dealer.Code = dealerObj.Code;
                serviceObj.Dealer.Name = dealerObj.Name;
            }
            serviceObj.ServiceDate = StringUtility.ToDateTime(form["serviceDate"]);
            serviceObj.ServiceDistance = int.Parse(form["serviceDistance"]);
            serviceObj.InvoiceNumber = form["invoiceNumber"];

            vehicleServiceSvc.Save(serviceObj);

            DisplayInformation(string.Format("Vehicle service ({0}) has been successfully created.", serviceObj.ServiceDistance));

            var addMore = (form["addMore"] == "on");
            if (addMore)
            {
                return RedirectToAction("Create", new { id = id });
            }
            else
            {
                return RedirectToAction("List", new { id = id });
            }
        }
Пример #3
0
        public ActionResult Dealer(SearchRequest request)
        {
            ViewData["code"] = request.Code;
            ViewData["name"] = request.Name;
            ViewData["limit"] = request.Limit;

            var dealerSvc = new DealerLogic(Ticket);
            var model = dealerSvc.Search(request);

            return View(model);
        }
Пример #4
0
        private void BindVehicleRetail(ref VehicleModel vehicleMsg, FormCollection form)
        {
            var dealerSvc = new DealerLogic(Ticket);
            var modelSvc = new ModelLogic(Ticket);

            var dealerId = StringUtility.ToInt(form["dealerId"]);
            var dealerObj = dealerSvc.GetById(dealerId);
            var modelId = StringUtility.ToInt(form["modelId"]);
            var modelObj = modelSvc.GetById(modelId);

            vehicleMsg.Vehicle.VinNumber = form["vinNumber"];
            vehicleMsg.Vehicle.ChassisNumber = form["chassisNumber"];
            vehicleMsg.Vehicle.EngineNumber = form["engineNumber"];
            vehicleMsg.Vehicle.RegistrationNumber = form["registrationNumber"];
            vehicleMsg.Vehicle.WholesaleDate = StringUtility.ToDateTime(form["wholesaleDate"]);
            vehicleMsg.Vehicle.RetailDate = StringUtility.ToDateTime(form["retailDate"]);
            vehicleMsg.Vehicle.RegistrationDate = StringUtility.ToDateTime(form["registrationDate"]);
            if (dealerObj != null)
            {
                vehicleMsg.Vehicle.Dealer.Id = dealerObj.Id;
                vehicleMsg.Vehicle.Dealer.Code = dealerObj.Code;
                vehicleMsg.Vehicle.Dealer.Name = dealerObj.Name;
            }
            if (modelObj != null)
            {
                vehicleMsg.Vehicle.Model.Id = modelObj.Id;
                vehicleMsg.Vehicle.Model.Code = modelObj.Code;
                vehicleMsg.Vehicle.Model.Name = modelObj.Name;
            }
            vehicleMsg.Vehicle.CurrentDistance = StringUtility.ToInt(form["currentDistance"]);
            vehicleMsg.Vehicle.VehicleStatus.Id = StringUtility.ToInt(form["vehicleStatusId"]);

            vehicleMsg.Customer.Title = form["title"];
            vehicleMsg.Customer.Initials = form["initials"];
            vehicleMsg.Customer.FirstName = form["firstName"];
            vehicleMsg.Customer.LastName = form["lastName"];
            vehicleMsg.Customer.ReferenceNumber = form["referenceNumber"];
            vehicleMsg.Customer.Language.Id = StringUtility.ToInt(form["languageId"]);
            vehicleMsg.Customer.Gender.Id = StringUtility.ToInt(form["genderId"]);
            vehicleMsg.Customer.PostalAddress.Line1 = form["postalAddress1"];
            vehicleMsg.Customer.PostalAddress.Line2 = form["postalAddress2"];
            vehicleMsg.Customer.PostalAddress.Line3 = form["postalAddress3"];
            vehicleMsg.Customer.PostalAddress.Line4 = form["postalAddress4"];
            vehicleMsg.Customer.PostalAddress.PostCode = form["postalAddressCode"];
            vehicleMsg.Customer.PhysicalAddress.Line1 = form["physicalAddress1"];
            vehicleMsg.Customer.PhysicalAddress.Line2 = form["physicalAddress2"];
            vehicleMsg.Customer.PhysicalAddress.Line3 = form["physicalAddress3"];
            vehicleMsg.Customer.PhysicalAddress.Line4 = form["physicalAddress4"];
            vehicleMsg.Customer.PhysicalAddress.PostCode = form["physicalAddressCode"];
            vehicleMsg.Customer.HomePhoneNumber = form["homePhoneNumber"];
            vehicleMsg.Customer.WorkPhoneNumber = form["workPhoneNumber"];
            vehicleMsg.Customer.MobileNumber = form["mobileNumber"];
            vehicleMsg.Customer.FaxNumber = form["faxNumber"];
            vehicleMsg.Customer.EmailAddress = form["emailAddress"];
        }