Esempio n. 1
0
        //当选不同类型的车辆时,自动填从这中车型对应的占车位和起始收费标准
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //获取车类型
            string    carType = comboBox1.SelectedItem.ToString();
            CarType   car     = new CarType();
            DataTable dt      = car.GetByName(carType);
            DataRow   row     = dt.Rows[0];

            txtPosition.Text   = row["needposition"].ToString();
            txtStartMoney.Text = row["startmoney"].ToString();
            comboBox1.Tag      = Convert.ToInt32(row["id"]);

            //获取该类型车可用的车位
            CarPositionDal dal = new CarPositionDal();
            DataTable      dt2 = dal.GetAllByType(carType);

            if (dt2.Rows.Count <= 0)
            {
                return;
            }
            comboBox2.Items.Clear();
            foreach (DataRow row2 in dt2.Rows)
            {
                comboBox2.Items.Add(row2["id"]);
            }
            comboBox2.SelectedIndex = 0;
        }
Esempio n. 2
0
        //当车类型发生改变的时候
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string    carType = comboBox1.SelectedItem.ToString();
            CarType   types   = new CarType();
            DataTable dt      = types.GetByName(carType);
            DataRow   row     = dt.Rows[0];

            txtFee.Text      = row["startmoney"].ToString();
            txtPosition.Text = row["needPosition"].ToString();
        }