コード例 #1
0
ファイル: CarCollectFee.cs プロジェクト: 1138631642/SCMS
        //当选不同类型的车辆时,自动填从这中车型对应的占车位和起始收费标准
        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;
        }
コード例 #2
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //新增车位
        private void button2_Click(object sender, EventArgs e)
        {
            string type = cmbCarType.SelectedItem.ToString();

            if (string.IsNullOrEmpty(type))
            {
                MessageBox.Show("请选择车类型后再新增车位....");
                return;
            }
            DateTime     time         = Convert.ToDateTime(dateTimePicker1.Text);
            bool         isDeleted    = checkBox1.Checked ? true : false;
            int          needPosition = Convert.ToInt32(txtPosition.Text);
            CarPositions car          = new CarPositions();

            car.CarType        = type;
            car.CreateDateTime = time;
            car.IsDeleted      = isDeleted;
            car.NeedPosition   = needPosition;

            CarPositionDal dal = new CarPositionDal();
            int            n   = dal.Add(car);

            if (n <= 0)
            {
                MessageBox.Show("新增失败");
            }
            else
            {
                MessageBox.Show("新增成功");
                GetData();
            }
        }
コード例 #3
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //当文本内容发现改变的时候,搜索用户输入的车位号
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            // MessageBox.Show(txtSearch.Text);
            //先获得用户输入的车牌号
            for (int i = 0; i < txtSearch.Text.Length; i++)
            {
                if (!char.IsDigit(txtSearch.Text[i]))
                {
                    MessageBox.Show("请输入正确的车牌号");
                    return;
                }
            }

            if (string.IsNullOrEmpty(txtSearch.Text))
            {
                return;
            }
            try
            {
                int            id     = Convert.ToInt32(txtSearch.Text);
                CarPositionDal carpos = new CarPositionDal();
                DataTable      dt4    = carpos.GetLikeById(id);
                dataGridView1.DataSource = dt4;
            }
            catch
            {
                MessageBox.Show("超出了int的范围");
            }
        }
コード例 #4
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //修改车位信息
        private void btnRessetting_Click(object sender, EventArgs e)
        {
            try
            {
                string       plate        = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                int          id           = Convert.ToInt32(plate);
                string       type         = cmbCarType.SelectedItem.ToString();
                DateTime     time         = Convert.ToDateTime(dateTimePicker1.Text);
                bool         isDeleted    = checkBox1.Checked ? true : false;
                int          needPosition = Convert.ToInt32(txtPosition.Text);
                CarPositions car          = new CarPositions();
                car.Id             = id;
                car.CarType        = type;
                car.CreateDateTime = time;
                car.IsDeleted      = isDeleted;
                car.NeedPosition   = needPosition;

                CarPositionDal dal = new CarPositionDal();
                int            n   = dal.UpdateById(car);
                if (n <= 0)
                {
                    MessageBox.Show("修改失败");
                }
                else
                {
                    MessageBox.Show("修改成功");
                    GetData();
                }
            }
            catch
            {
            }
        }
コード例 #5
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //定义一个方法,用户获取所有的车位信息
        public void GetData()
        {
            //加载所有车位信息
            CarPositionDal carpos = new CarPositionDal();

            dt = carpos.GetAll();
            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("还有添加任何车位...");
                return;
            }
            dataGridView1.DataSource = dt;
        }
コード例 #6
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //删除车位
        private void btnDeleted_Click(object sender, EventArgs e)
        {
            string         plate = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            int            id    = Convert.ToInt32(plate);
            CarPositionDal dal   = new CarPositionDal();
            int            n     = dal.IsDeleted(id);

            if (n <= 0)
            {
                MessageBox.Show("删除失败");
            }
            else
            {
                MessageBox.Show("删除成功");
                GetData();
            }
        }
コード例 #7
0
ファイル: AccountFee.cs プロジェクト: 1138631642/SCMS
        //结算车费
        private void button2_Click(object sender, EventArgs e)
        {
            CarDal dal = new CarDal();
            int    n   = dal.DeletedByPlate(txtPlate.Text, txtMoney.Text, Convert.ToDateTime(txtCloseTime.Text));

            CarPositionDal position   = new CarPositionDal();
            int            positionId = Convert.ToInt32(txtCarPosition.Text);
            int            n2         = position.IsDeleted(positionId);

            if (n > 0 && n2 > 0)
            {
                MessageBox.Show("结算成功");
            }
            else
            {
                MessageBox.Show("结算失败!");
            }
        }
コード例 #8
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //根据选择不同的车类型,从数据库中塞选出不同类型车辆
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //加载车类型信息

            //先获得所选车类型
            string type = comboBox1.SelectedItem.ToString();

            if (type == "----全部-----")
            {
                dataGridView1.DataSource = dt;
                return;
            }
            CarPositionDal type2 = new CarPositionDal();
            DataTable      dt3   = type2.GetByName(type);

            if (dt3.Rows.Count <= 0)
            {
                MessageBox.Show("该类型的车位不存在....");
                return;
            }
            dataGridView1.DataSource = dt3;
        }
コード例 #9
0
ファイル: CarPosition.cs プロジェクト: 1138631642/SCMS
        //车位信息被点击的时候执行
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //获得选中行的车牌编号
            string plate = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();

            if (string.IsNullOrEmpty(plate))
            {
                return;
            }
            try
            {
                int            id  = Convert.ToInt32(plate);
                CarPositionDal dal = new CarPositionDal();
                DataTable      dt  = dal.GetById(id);
                DataRow        row = dt.Rows[0];
                txtPosition.Text        = row["NeedPosition"].ToString();
                checkBox1.Checked       = Convert.ToBoolean(row["IsDeleted"]);
                dateTimePicker1.Text    = row["CreateDateTime"].ToString();
                cmbCarType.SelectedItem = row["CarType"].ToString();
            }
            catch
            {
            }
        }