Ejemplo n.º 1
0
        private static IEnumerable <CarAttribute> SortAttributes(IEnumerable <CarType> carTypes)
        {
            var result = new List <CarAttribute>();

            foreach (var carModel in carTypes)
            {
                var mark = result.FirstOrDefault(x => x.MarkId == carModel.MarkId);
                if (mark is null)
                {
                    mark = new CarAttribute
                    {
                        MarkName = carModel.MarkName,
                        MarkId   = carModel.MarkId,
                        Models   = new List <CarType> {
                            carModel
                        }
                    };
                    result.Add(mark);
                }
                else
                {
                    mark.Models.Add(carModel);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string path = "C:\\Users\\Тимофей\\Documents\\!ТИМА\\УНИВЕР\\!ПРЕДМЕТЫ\\Программирование\\КДЗ_2\\mtcars.csv";

            int[] arr = { 1, 2, 3 };
            //CSVProcessor processor = new CSVProcessor(path);
            //foreach (string str in processor)
            //{
            //    Console.WriteLine(str);
            //}

            //TypeConverter converter = TypeDescriptor.GetConverter(typeof(int));
            CarAttribute <double> attr = new CarAttribute <double>(-1.0, 15.0, "1,9");
            Car           car          = new Car();
            string        str          = "\"ccccccc RX4\",21,6,160,110,3.9,2.62,16.46,0,1,4,4";
            List <string> l            = str.Split(',').ToList <string>();

            //Console.WriteLine("13".T)
            car.SetFromStringList(l, CultureInfo.GetCultureInfo("en-US"));
            List <Car> cars = new List <Car>();

            cars.Add(car);
            CSVProcessor processor = new CSVProcessor(@"C:\Users\Тимофей\Documents\!ТИМА\УНИВЕР\!ПРЕДМЕТЫ\Программирование\КДЗ_2\new1.csv");
            bool         r         = processor.TrySaveRecords(cars);

            Console.WriteLine(r);
        }
Ejemplo n.º 3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Rigidbody2D  rb = GetComponent <Rigidbody2D>();
        CarAttribute ca = GetComponent <CarAttribute>();

        float driftFactor = driftFactorSticky;

        if (RightVelocity().magnitude > maxStickyVelocity)
        {
            driftFactor = driftFactorSlippy;
        }

        rb.velocity = ForwardVelocity() + RightVelocity() * driftFactor;

        if (Input.GetButton("Accelerate"))
        {
            rb.AddForce(transform.up * speedForce * ca.getSpeedMulti());
        }
        if (Input.GetButton("Brakes"))
        {
            rb.AddForce(transform.up * -speedForce / 2f * ca.getSpeedMulti());
        }

        // If you are using positional wheels in your physics, then you probably
        // instead of adding angular momentum or torque, you'll instead want
        // to add left/right Force at the position of the two front tire/types
        // proportional to your current forward speed (you are converting some
        // forward speed into sideway force)
        float tf = Mathf.Lerp(0, torqueForce, rb.velocity.magnitude / 2);

        rb.angularVelocity = Input.GetAxis("Horizontal") * tf;
    }
Ejemplo n.º 4
0
 public void SaveAssets(AssetsMain main, CarAttribute attr)
 {
     main.InputTime    = DateTime.Now;
     main.ExtDataTable = "ASSETS_CAR";
     _assetsMainRep.Save(main);
     attr.AssetsNum = main.AssetsNum;
     _carRep.Save(attr);
 }
Ejemplo n.º 5
0
        public int UpdateAssetsEx(AssetsMain main, CarAttribute attr)
        {
            main.InputTime    = DateTime.Now;
            main.ExtDataTable = "ASSETS_CAR";
            _assetsMainRep.Save(main);
            attr.AssetsNum = main.AssetsNum;
            _carRep.Update(attr);

            var result = _assetsMainRep.FirstOrDefault(x => x.AssetsNum == main.AssetsNum);

            return(result.EntityId);
        }
        int LowerID; // 定义一个下级编号的变量
        /// <summary>
        /// “保存” 按钮的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtCarAttribute_Name.Text == "")
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "车辆属性名称不能为空!", txtCarAttribute_Name, this);
                    return;
                }
                if (this.comboxCarAttribute_HeightID.Text != "")
                {
                    LowerID = int.Parse(this.comboxCarAttribute_HeightID.SelectedValue.ToString());
                }
                else
                {
                    LowerID = 0;
                }
                if (!btnCheck())
                {
                    return;              // 去重复
                }
                var CarAttributeadd = new CarAttribute
                {
                    CarAttribute_Name     = this.txtCarAttribute_Name.Text.Trim(),
                    CarAttribute_State    = this.cbxCarAttribute_State.Text,
                    CarAttribute_HeightID = LowerID
                };

                if (CarAttributeDAL.InsertOneCarAttribute(CarAttributeadd))
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                string strContent1 = "车辆属性名称为:" + this.txtCarAttribute_Name.Text.Trim();;
                CommonalityEntity.WriteLogData("添加", strContent1, CommonalityEntity.USERNAME);//添加操作日志
            }
            catch
            {
                CommonalityEntity.WriteTextLog("车辆属性管理 btnSave_Click()");
            }
            finally
            {
                LogInfoLoad("");
                BindHeightIDAttribute();
                Empty(); // 调用清空的方法
            }
        }
        /// <summary>
        /// 新增一条质检记录
        /// </summary>
        /// <param name="qcRecord">质检实体</param>
        /// <returns></returns>
        public static bool InsertOneCarAttribute(CarAttribute eh_Fvn)
        {
            bool rbool = true;

            using (DCCarManagementDataContext db = new DCCarManagementDataContext())
            {
                try
                {
                    rbool = LinQBaseDao.InsertOne(db, eh_Fvn);
                }
                catch
                {
                    rbool = false;
                }
                finally { db.Connection.Close(); }
            }
            return(rbool);
        }
Ejemplo n.º 8
0
 public void AddAssetsCar(CarAttribute item)
 {
     _assetsCarRep.Add(item);
 }