コード例 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int success;

            int vehStatusType;

            vehStatusType = 0;
            if (cmbStatus.Text == "Available")
            {
                vehStatusType = 1;
            }
            else if (cmbStatus.Text == "Out of Service")
            {
                vehStatusType = 2;
            }
            else if (cmbStatus.Text == "In Repair")
            {
                vehStatusType = 3;
            }
            else
            {
                MessageBox.Show("Invalid Selection");
            }

            success = ml.EditVehicle(ID, txtName.Text, txtDescrip.Text, vehStatusType);

            if (success == 1)
            {
                MessageBox.Show("Account Created");
                m_ve            = new BindingSource();
                m_vehicles      = ml.getVehicles();
                m_ve.DataSource = m_vehicles;
                m_ve.ResetBindings(false);
                this.dataGridView1.DataSource = m_ve.DataSource;
                txtName.Clear();
                txtDescrip.Clear();
            }
            else
            {
                MessageBox.Show("A Input is Incorrect.");
            }
        }