Пример #1
0
 void Awake()
 {
     _CarInfo = transform.root.GetComponent<CarInfo>();
     _Car = transform.root.GetComponent<CarController>();
     _Collider = GetComponent<Collider>();
     Counting();
 }
Пример #2
0
        /// <summary>
        /// Saves a record to the car table.
        /// </summary>
        public virtual void Insert(CarInfo carInfo)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@number_plate", carInfo.Number_plate),
                new SqlParameter("@car_type", carInfo.Car_type),
                new SqlParameter("@brand", carInfo.Brand),
                new SqlParameter("@province", carInfo.Province)
            };

            SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "car_Insert", parameters);
        }
Пример #3
0
        private void Awake()
        {
            // get the car controller reference
            m_CarController = GetComponent <CarController>();

            // give the random perlin a random value
            m_RandomPerlin = Random.value * 100;

            m_Rigidbody      = GetComponent <Rigidbody>();
            m_info           = GetComponent <CarInfo>();
            m_gameController = GameObject.Find("Controller").GetComponent <GameController>();
            InvokeRepeating("CheckPosition", 3f, 4f);
            m_tracker = m_Target.GetComponent <Tracker>();
        }
Пример #4
0
        private void UpdateDirtLevel(CarInfo playerCar)
        {
            double maxDirt = playerCar.WheelsInfo.AllWheels.Max(x => x.DirtLevel);

            if (maxDirt < 0.01)
            {
                TyreDirtStatus.IconState      = StatusIconState.Unlit;
                TyreDirtStatus.AdditionalText = string.Empty;
                return;
            }

            TyreDirtStatus.AdditionalText = ((int)(maxDirt * 100)).ToString();
            TyreDirtStatus.IconState      = maxDirt > 0.5 ? StatusIconState.Error : StatusIconState.Warning;
        }
Пример #5
0
 private void ShowCarInfo(CarInfo carInfo)
 {
     if (tb_CarInfo.InvokeRequired)
     {
         this.Invoke(new ShoaCarInfoDelegate(ShowCarInfo), carInfo);
     }
     else
     {
         tb_CarInfo.Text = "";
         tb_CarInfo.AppendText("车牌号:" + carInfo.PlateNum + "\r\n");
         tb_CarInfo.AppendText("车型:" + carInfo.Type + "\r\n");
         tb_CarInfo.AppendText("发动机号:" + carInfo.EngineNum + "\r\n");
     }
 }
Пример #6
0
 private void btnSelectCar_Click(object sender, EventArgs e)
 {
     if (lvCarList.SelectedItems.Count > 0)
     {
         int carID = Convert.ToInt32(lvCarList.SelectedItems[0].SubItems[1].Text);
         Debug.WriteLine("选择车辆的ID是" + carID);
         CarInfo     carTemp     = carDal.GetCarById(carID);
         RentCarForm rentCarForm = new RentCarForm(carTemp);
         rentCarForm.ShowDialog();
     }
     else
     {
         MessageBox.Show("请先选择要租赁的车辆");
     }
 }
Пример #7
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            carInfo = other.gameObject.GetComponent <CarInfo>();

            if (!carInfo.carStats.isShieldEnabled)
            {
                GameObject clonedEffect = Instantiate(electricEffect, other.transform.position + offset, other.transform.rotation, other.transform);
                clonedEffect.transform.Rotate(0, 90, 0);
            }
        }

        Destroy(this.gameObject);
    }
        //Message Contract Exempel
        public CarInfo GetCarById(int id)
        {
            var     service = new CarService();
            var     car     = service.GetById(id);
            CarInfo carInfo = new CarInfo
            {
                Id    = car.Id,
                Brand = car.Brand,
                Model = car.Model,
                RegNr = car.RegNr,
                Year  = car.Year
            };

            return(carInfo);
        }
Пример #9
0
 private void btnUpdateCar_Click(object sender, EventArgs e)
 {
     if (lvCarList.SelectedItems.Count > 0)
     {
         int           carID         = Convert.ToInt32(lvCarList.SelectedItems[0].SubItems[1].Text);
         CarInfo       carTemp       = carDal.GetCarById(carID);
         UpdateCarForm updateCarForm = new UpdateCarForm(carTemp);
         updateCarForm.ShowDialog();
         RefreshList();
     }
     else
     {
         MessageBox.Show("请先选择要修改的车辆");
     }
 }
Пример #10
0
        public async Task <ActionResult> EditFinish([Bind(Include = "CarId,Model,WashType,ArrivalTime,PickUpTime,Cost,Faktura,Color,TypeOfCar,Payment")] CarInfo carInfo)
        {
            if (ModelState.IsValid)
            {
                carInfo.TakeConfirmed   = true;
                carInfo.PaidConfirmed   = true;
                carInfo.PickUpTime      = DateTime.Now;
                carInfo.Status          = "Oddane";
                db.Entry(carInfo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(carInfo));
        }
Пример #11
0
        private void Button1_Click(object sender, EventArgs e)
        {
            CarInfo c = new CarInfo()
            {
                Make = textBox1.Text, Model = textBox2.Text, Regnr = textBox3.Text, Kilometer = textBox4.Text, Price = textBox5.Text
            };

            repoLager.Save(c);
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            listBox1.Items.Add(c);
        }
Пример #12
0
        public async Task <ActionResult> Create([Bind(Include = "CarId,Model,Color,ArrivalTime,PickUpTime,WashType,Cost,TypeOfCar,Faktura,Payment")] CarInfo carInfo)
        {
            if (ModelState.IsValid)
            {
                carInfo.ArrivalTime = DateTime.Now;
                carInfo.Status      = "Oczekujące";
                //carInfo.PickUpTime = null;
                db.CarInfos.Add(carInfo);
                await db.SaveChangesAsync();

                return(RedirectToAction("CarWait"));
            }

            return(View(carInfo));
        }
        public async Task <IActionResult> AddCarAsync(CarInfo car)
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri("https://localhost:44327");

            var postCar = await client.PostAsJsonAsync <CarInfo>("api/car", car);

            if (postCar.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError(string.Empty, "This did not work");
            return(View(car));
        }
Пример #14
0
        private void FillDrsData(AssettoCorsaShared data, CarInfo playerCar)
        {
            DrsSystem drsSystem = playerCar.DrsSystem;

            if (data.AcsPhysics.drsEnabled == 1)
            {
                drsSystem.DrsStatus = DrsStatus.InUse;
                return;
            }

            if (data.AcsPhysics.drsAvailable == 1)
            {
                drsSystem.DrsStatus = DrsStatus.Available;
            }
        }
Пример #15
0
        private void Bind()
        {
            CarInfo entity = Core.Container.Instance.Resolve <IServiceCarInfo>().GetEntity(_id);

            txtRemark.Text                 = entity.Remark;
            txbVipPhone.Text               = entity.ContractPhone;
            txtAddress.Text                = entity.ContractAddress;
            txtLinkMan.Text                = entity.DriverName;
            txtVipName.Text                = entity.CarNO;
            ddlIsUsed.SelectedValue        = entity.IsUsed;
            txtCarLoad.Text                = entity.CarLoad;
            rbtnChargingType.SelectedValue = entity.ChargingType;
            txtDailyRents.Text             = entity.PayPrice.ToString();
            rbtnPayType.SelectedValue      = entity.IsCalcPeice.ToString();
        }
Пример #16
0
 public int UpdateCarInfo(CarInfo car)
 {
     Console.Write("Updating database...[");
     try
     {
         int executeCnt = db.UpdateCarInfo(car);
         Console.WriteLine(executeCnt + "]");
         return(executeCnt);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message + "]");
         return(0);
     }
 }
Пример #17
0
    public DataSet populateYearDropDown(CarInfo ci)
    {
        SqlConnection con = new SqlConnection(connstring);

        con.Open();
        SqlCommand cmd = new SqlCommand("SELECT distinct CarYear FROM snehav27.CAR_STYLE_INFO where carName=@Carname", con);

        cmd.Parameters.Add("@Carname", ci.carname);
        DataSet        ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(ds);
        con.Close();
        return(ds);
    }
Пример #18
0
        public List <CarInfo> GetArrayCars()
        {
            List <CarInfo> result = new List <CarInfo>();

            for (int i = 1; i < 50; i++)
            {
                CarInfo car = new CarInfo()
                {
                    Id   = i,
                    Name = "car" + i,
                };
                result.Add(car);
            }

            return(result);
        }
        async void CarTapped(object sender, EventArgs e)
        {
            if (isBusy)
            {
                return;
            }
            isBusy = true;

            await AnimationUtilites.Press(sender as View);

            CarInfo car = (sender as CarView).Car;

            await Navigation.PushAsync(new CarEditPage(viewModel.DriverInfo, car), true);

            isBusy = false;
        }
Пример #20
0
    public DataSet populateCarmodel(CarInfo ci)
    {
        SqlConnection con = new SqlConnection(connstring);

        con.Open();
        SqlCommand cmd = new SqlCommand("select (CarSeries + ' - ' + Name) AS CarModelName ,CarID from snehav27.CAR_STYLE_INFO where CarYear=@Year and carName=@Carname", con);

        cmd.Parameters.Add("@Carname", ci.carname);
        cmd.Parameters.Add("@Year", ci.year);
        DataSet        ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(ds);
        con.Close();
        return(ds);
    }
Пример #21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CarInfo carInfo = Maper.MapingCarModel
                                  (comboBoxModel.Text, Int32.Parse(txtPrice.Text), pictureBoxColor.BackColor.Name);
            bool isValid = _carController.AddCar(carInfo);

            if (isValid)
            {
                DialogResult = DialogResult.OK;
                MessageBox.Show("Car Successfuly added!!");
            }
            else
            {
                MessageBox.Show("Invalid model name!!");
            }
        }
        // GET: CarInfoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CarInfo carInfo = db.CarInfoes.Find(id);

            if (carInfo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Car_Company = new SelectList(db.CarCompanies, "CompanyId", "CompanyName", carInfo.Car_Company);
            ViewBag.CarDriver   = new SelectList(db.DriverInfoes, "DriverId", "DriverName", carInfo.CarDriver);
            return(View(carInfo));
        }
    private void OnEnable()
    {
        switch (ModeController.Mode)
        {
        case SimulatorMode.Playback:
        case SimulatorMode.RemoteControl:
            break;

        default:
            Debug.Log("Initializing spectator socket");
            StartListening();
            RaceParameters raceParams = RaceParameters.readRaceParameters();
            if (raceParams.raceLogFile != null)
            {
                Debug.Log("Writing race log to " + raceParams.raceLogFile);
                var stream = new BinaryWriter(File.Open(raceParams.raceLogFile, FileMode.Create));

                Spectate(b => { stream.Write(b); }, () => stream.Close(), new CarInfo[] { });
            }
            EventBus.Subscribe <CarAdded>(this, e => {
                CarInfo car = ((CarAdded)e).car;
                carInfos.Add(car.name, car);
            });
            EventBus.Subscribe <CarRemoved>(this, e => {
                CarInfo car = ((CarRemoved)e).car;
                carInfos.Remove(car.name);
            });

            EventBus.Subscribe <RaceFinished>(this, e => {
                Observables.Delay(TimeSpan.FromSeconds(1)).Subscribe(_ => {
                    Debug.Log("Race finished, stopping updates");
                    raceEnded = true;
                    EventBus.Publish(new GameStatus(new CarStatus[0]));
                    var stream = new BinaryWriter(File.Open(raceParams.raceResultFile, FileMode.Create));

                    stream.Write(System.Text.Encoding.UTF8.GetBytes(JsonUtility.ToJson(e, true)));
                    stream.Close();
                });

                Observables.Delay(TimeSpan.FromSeconds(3)).Subscribe(_ => {
                    Debug.Log("Quitting application");
                    Application.Quit();
                });
            });
            break;
        }
    }
Пример #24
0
        public void Create(CarInfo car)
        {
            using var connection = new MySqlConnection(_appSettings.MySqlConnectionString);

            connection.Execute(@"
                INSERT INTO cars
                    (car_regis, car_custid, car_make, car_model)
                VALUES
                    (@registration, @customerId, @make, @model)",
                               new
            {
                car.Registration,
                car.CustomerId,
                car.Make,
                car.Model
            });
        }
        public bool AuthenticateKey(int carId, int keyId)
        {
            using (var sqlConn = new SqlConnection(conn))
            {
                try
                {
                    //Verify hard coded ID to see if registered.
                    sqlConn.Open();

                    var search = "Select * from CarInfo";
                    using (var command = new SqlCommand(search, sqlConn))
                    {
                        var dataReader = command.ExecuteReader();
                        var car        = new CarInfo();

                        while (dataReader.Read())
                        {
                            var result = (int)dataReader["Id"];

                            if (result == carId)
                            {
                                Console.WriteLine("Car Id Authenticated!");

                                car.Id       = carId;
                                car.SendSMS  = (int)dataReader["SendSMS"];
                                car.PhoneNum = dataReader["PhoneNum"].ToString();
                                car.Email    = dataReader["Email"].ToString();

                                //Car matches DB now see if key matches with the car.
                                return(CompareKeys(car, keyId));
                            }
                        }
                    }
                    sqlConn.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error in SQL in TFA. Error: " + ex.ToString());
                }
            }

            // Car is not authenticated.
            Console.WriteLine("Car not found");

            return(false);
        }
Пример #26
0
        private bool VerifyAllExpectedCarAreInResponse(string[] expectedCarMakers, List <CarInfo> actualCarInfoList)
        {
            bool allCarInfoMatched = true;

            foreach (var carmake in expectedCarMakers)
            {
                CarInfo expectedCarInfo = _apiTestContext.CarsRepository.Find(car => car.make.Equals(carmake));
                CarInfo actualCarInfo   = actualCarInfoList.Find(car => car.make.Equals(carmake));
                allCarInfoMatched = allCarInfoMatched && expectedCarInfo.Equals(actualCarInfo);
                if (!allCarInfoMatched)
                {
                    Console.WriteLine($"CarInfo Unmatched for Make {carmake}");
                }
            }

            return(allCarInfoMatched);
        }
Пример #27
0
        /// <summary>
        /// Make a page to setup a new car
        /// </summary>
        /// <param name="driverInfo"></param>
        public CarEditPage(DriverInfo driverInfo)
        {
            InitializeComponent();

            this.driverInfo = driverInfo ?? throw new ArgumentNullException();
            isNew           = true;

            carInfo = new CarInfo
            {
                Name            = "Car_" + driverInfo.Cars.Count,
                DefaultCapacity = 1
            };

            Title = "New Car";

            SetUpPage();
        }
Пример #28
0
 /// </inheritdoc>
 public InsuranceResult GetInsuranceContract(CarInfo info)
 {
     if (info.DriverLicenseDate != null && info.Price >= this.limitPrice)
     {
         return(new InsuranceResult
         {
             HasInsurance = true,
             Type = InsuranceType.Regular,
             Amount = 200,
             Franchise = Decimal.MaxValue
         });
     }
     else
     {
         return(this.nextContract.GetInsuranceContract(info));
     }
 }
Пример #29
0
    //Method for when the missile collides with the player or other object
    private void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            carInfo = other.gameObject.GetComponent <CarInfo>();

            if (!carInfo.carStats.isShieldEnabled)
            {
                carInfo.carStats.health += 10;
            }
        }

        //Destorys the missile and spawns the explosion effect
        GameObject clonedExplosion = Instantiate(explosion, transform.position, transform.rotation);

        Destroy(this.gameObject);
    }
Пример #30
0
 public async Task <IActionResult> InsertCarAsync(CarInfo carInfo)
 {
     try
     {
         dbContext.carInfoRepository.CreateInfo(carInfo);
         if (await dbContext.carInfoRepository.SaveAsync())
         {
             return(Ok(1));
         }
         _logger.LogInformation($"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}添加车辆信息");
         return(Ok("添加失败"));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #31
0
        private Collection <CarInfo> SortCarsList(Collection <CarInfo> cars)
        {
            for (int ix = 0; ix < cars.Count; ix++)
            {
                for (int iy = ix + 1; iy < cars.Count; iy++)
                {
                    if (cars[ix].CarPrice > cars[iy].CarPrice)
                    {
                        CarInfo temp = cars[ix];
                        cars[ix] = cars[iy];
                        cars[iy] = temp;
                    }
                }
            }

            return(cars);
        }
Пример #32
0
        private void ExplainText(string s)
        {
            if (!WinVisible)
            {
                return;
            }

            ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
            {
                Clear();
                ControlHelper.ThreadRunExt(AppHelper.MainForm, () =>
                {
                    FeeTools feeTools = new FeeTools();
                    _carInfo          = new CarInfo();
                    _carInfo.TestNo   = RegexVal(s, @"检验流水号:(.*)号牌号码");
                    _carInfo.PlateNo  = RegexVal(s, @"号牌号码:(.*)车辆类型");
                    _carInfo.CarType  = RegexVal(s, @"车辆类型:(.*)检测项目");
                    _carInfo.TestItem = RegexVal(s, @"检测项目:(.*)检测次数");
                    string testTimes  = RegexVal(s, @"检测次数:(.*)引车员");
                    _carInfo.Guider   = RegexVal(s, @"引车员:(.*)检测时间");
                    _carInfo.TestDate = RegexVal(s, @"检测时间:(.*)");
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        //处理检验项目和检验次数
                        string[] testItems = _carInfo.TestItem.Split(',');
                        for (int i = 0; i < testItems.Length; i++)
                        {
                            int times     = RegexVal(testTimes, $@"{testItems[i]}(.*?)次").ToInt();
                            decimal price = CalPrice(feeTools, testItems[i].Trim(), times);
                            ItemList.Add(new Tuple <string, int, decimal>(testItems[i].ToString(), times, price));
                            var item = new ListViewItem(new string[] { testItems[i], times.ToString(), price.ToString() });
                            materialListView1.Items.Add(item);
                        }


                        foreach (var item in ItemList)
                        {
                            TOTAL_PRICE += item.Item3;
                        }
                        _carInfo.Price = TOTAL_PRICE;
                        carFiller.DisplayEntity(_carInfo);
                        labPrice.Text = ExtendMethod.MoneyToCap(TOTAL_PRICE);
                    });
                }, null, AppHelper.MainForm, true, "", 200);
            });
        }
Пример #33
0
 public Car(Vector3 startUpPosition, float startUpRotation, CarInfo carInfo) : base(startUpPosition, startUpRotation)
 {
     CarInfo = carInfo;
     _wheels = new Wheel[4];
 }
Пример #34
0
 public void RegisterCarNameHandler(CarInfo<string> handler) {
     carNameHandlers += handler;
 }
Пример #35
0
 public void RegisterCarSpeedHandler(CarInfo<int> handler) {
     carSpeedHandlers += handler;
 }
Пример #36
0
        /// <summary>
        /// Creates a new instance of the car class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual CarInfo MakeCarInfo(SqlDataReader dataReader)
        {
            CarInfo carInfo = new CarInfo();
            carInfo.Number_plate = SqlClientUtility.GetString(dataReader,DbConstants.CAR.NUMBER_PLATE, String.Empty);
            carInfo.Car_type = SqlClientUtility.GetInt32(dataReader,DbConstants.CAR.CAR_TYPE, 0);
            carInfo.Brand = SqlClientUtility.GetString(dataReader,DbConstants.CAR.BRAND, String.Empty);
            carInfo.Province = SqlClientUtility.GetString(dataReader,DbConstants.CAR.PROVINCE, String.Empty);

            return carInfo;
        }
        public ActionResult Index (int CarId, string Vendor, string CarModel, int? Year, double? Capacity, int? Passengers, string type)
        {
            string rqs = Request.Params["button"];

            if (Year == null)
            {
                Year = 2000;
            }

            if (rqs == "Get Car")
            {

                var car = _client.GetCar(new CarRequest("LKMN", CarId));
                Vendor = car.Vendor;
                CarModel = car.Model;
                Year = car.Year;

                if (car.Type == CarType.TruckCar)
                {
                    Capacity = car.Capacity;
                    type = "Truck";
                }
                else
                {
                    Passengers = car.Passengers;
                    type = "Passenger";
                }

                return RedirectToAction("Index", new { CarId, Vendor, CarModel, Year, Capacity, Passengers, type });

            }
            else
            {
                CarInfo car = new CarInfo();

                switch (type)
                {
                    case "Truck":
                        
                       car.Capacity = Capacity ?? 0;
                        car.Type = CarType.TruckCar;
                    break;
                    case "Passenger":
                        
                        car.Passengers = Passengers ?? 0;
                        car.Type = CarType.PassengerCar;
                        break;
                    default:
                        car = new CarInfo();
                        break;
                }


               
                car.Id = CarId;
                car.Vendor = Vendor;
                car.Model = CarModel;
                car.Year = Year??0;
                _client.SetCar(car);
            }

            return RedirectToAction("Index", new { CarId, Vendor, CarModel, Year, Capacity, Passengers, type });
        }
Пример #38
0
        public void GetCarsList(int charityExamId)
        {
            ListCars = new List<Car>();
            ListCarInfo = new List<CarInfo>();

            ListCars = db.Cars.Where(o => o.CharityExamID == charityExamId).ToList();
            TotalCarsNo = ListCars.Count;
            //ListCars = ListCars.OrderByDescending(f => f.AvailableSlots).ToList();

            foreach (var car in ListCars)
            {
                var carInfo = new CarInfo();
                carInfo.Car = car;

                if (car.SponsorID != null)
                {
                    carInfo.SponsorName = car.Sponsor.Account.Profiles.FirstOrDefault().Lastname + " " + car.Sponsor.Account.Profiles.FirstOrDefault().Firstname;
                }

                ListCarInfo.Add(carInfo);
            }
        }