Пример #1
0
        public ActionResult Create(FormCollection form)
        {
            var vehicleSvc = new VehicleLogic(Ticket);
            var modelSvc = new ModelLogic(Ticket);

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

            var vehicleObj = new VehicleEntity();
            vehicleObj.VinNumber = form["vinNumber"];
            vehicleObj.ChassisNumber = form["chassisNumber"];
            vehicleObj.EngineNumber = form["engineNumber"];
            vehicleObj.WholesaleDate = StringUtility.ToDateTime(form["wholesaleDate"]);
            if (modelObj != null)
            {
                vehicleObj.Model.Id = modelObj.Id;
                vehicleObj.Model.Code = modelObj.Code;
                vehicleObj.Model.Name = modelObj.Name;
            }
            vehicleObj.CurrentDistance = int.Parse(form["currentDistance"]);

            int id = vehicleSvc.Create(vehicleObj);

            return RedirectToAction("Display", new { id = id });
        }
Пример #2
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"];
        }