Пример #1
0
        //注意判断误删
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定删除该项数据", "车辆管理", MessageBoxButtons.OKCancel);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            if (m_type == formType.vechType)
            {
                int      index = dataView.CurrentRow.Index;
                vechType one   = new vechType();
                one.name    = dataView.Rows[index].Cells[0].Value.ToString();
                one.volume  = Convert.ToDouble(dataView.Rows[index].Cells[1].Value);
                one.journey = Convert.ToDouble(dataView.Rows[index].Cells[2].Value);
                m_sql.deleteVechType(one);
                load();
            }
            else
            {
                int  index = dataView.CurrentRow.Index;
                vech one   = new vech();
                one.typeName = dataView.Rows[index].Cells[0].Value.ToString();
                one.number   = dataView.Rows[index].Cells[1].Value.ToString();
                one.status   = dataView.Rows[index].Cells[2].Value.ToString();
                m_sql.deleteVech(one);
                load();
            }
        }
Пример #2
0
 private void dataView_Click(object sender, EventArgs e)
 {
     if (m_status != formStatus.noneStaus)
     {
         return;
     }
     if (m_type == formType.vechType)
     {
         int index = dataView.CurrentRow.Index;
         if (index >= vechTypeList.Count)
         {
             return;
         }
         vechType one = new vechType();
         one.name    = dataView.Rows[index].Cells[0].Value.ToString();
         one.volume  = Convert.ToDouble(dataView.Rows[index].Cells[1].Value);
         one.journey = Convert.ToDouble(dataView.Rows[index].Cells[2].Value);
         vechA.intoShow(one);
     }
     else
     {
         int index = dataView.CurrentRow.Index;
         if (index >= vechList.Count)
         {
             return;
         }
         vech one = new vech();
         one.typeName = dataView.Rows[index].Cells[0].Value.ToString();
         one.number   = dataView.Rows[index].Cells[1].Value.ToString();
         one.status   = dataView.Rows[index].Cells[2].Value.ToString();
         vechD.intoShow(one);
     }
     goSub();
 }
Пример #3
0
 public void intoEdit(vech one)
 {
     m_status              = Status.editStatus;
     this.Top              = m_form.getSubTop();
     type_comBox.Enabled   = false;
     num_textBox.ReadOnly  = true;
     ok_button.Visible     = true;
     cal_button.Visible    = true;
     status_comBox.Enabled = true;
     type_comBox.Items.Clear();
     type_comBox.Items.Add(one.typeName);
     type_comBox.SelectedIndex = 0;
     status_comBox.Text        = one.status;
     this.Visible = true;
 }
Пример #4
0
 private void ok_button_Click(object sender, EventArgs e)
 {
     if (m_status == Status.addStatus)
     {
         if (type_comBox.Text == "" || num_textBox.Text == "" || status_comBox.Text == "")
         {
             MessageBox.Show("请完整填写车辆信息", "车辆管理", MessageBoxButtons.OK);
             return;
         }
         else
         {
             if (m_form.containNumber(num_textBox.Text))
             {
                 MessageBox.Show("车辆编码重复,请填写其它编码", "车辆管理", MessageBoxButtons.OK);
                 return;
             }
             vech one = new vech();
             one.typeName = type_comBox.Text;
             one.number   = num_textBox.Text;
             one.status   = status_comBox.Text;
             m_form.insertVech(one);
         }
         m_form.setStatus(formStatus.noneStaus);
         m_form.goFull();
         this.Visible = false;
     }
     else if (m_status == Status.editStatus)
     {
         if (type_comBox.Text == "" || num_textBox.Text == "" || status_comBox.Text == "")
         {
             MessageBox.Show("请完整填写车辆信息", "车辆管理", MessageBoxButtons.OK);
             return;
         }
         else
         {
             vech one = new vech();
             one.typeName = type_comBox.Text;
             one.number   = num_textBox.Text;
             one.status   = status_comBox.Text;
             m_form.updateVech(one);
         }
         m_form.setStatus(formStatus.noneStaus);
         m_form.goFull();
         this.Visible = false;
     }
 }
Пример #5
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (m_type == formType.vechType)
     {
         int      index = dataView.CurrentRow.Index;
         vechType one   = new vechType();
         one.name    = dataView.Rows[index].Cells[0].Value.ToString();
         one.volume  = Convert.ToDouble(dataView.Rows[index].Cells[1].Value);
         one.journey = Convert.ToDouble(dataView.Rows[index].Cells[2].Value);
         vechA.intoEdit(one);
     }
     else
     {
         int  index = dataView.CurrentRow.Index;
         vech one   = new vech();
         one.typeName = dataView.Rows[index].Cells[0].Value.ToString();
         one.number   = dataView.Rows[index].Cells[1].Value.ToString();
         one.status   = dataView.Rows[index].Cells[2].Value.ToString();
         vechD.intoEdit(one);
     }
 }
Пример #6
0
        public void intoShow(vech one)
        {
            m_status             = Status.showStatus;
            this.Top             = m_form.getSubTop();
            num_textBox.ReadOnly = true;
            ok_button.Visible    = false;
            cal_button.Visible   = false;
            type_comBox.Items.Clear();
            type_comBox.Items.Add(one.typeName);
            type_comBox.SelectedIndex = 0;
            type_comBox.Enabled       = false;
            status_comBox.Enabled     = false;
            num_textBox.Text          = one.number;

            for (int i = 0; i < status_comBox.Items.Count; ++i)
            {
                if (status_comBox.Items[i].ToString() == one.status)
                {
                    status_comBox.SelectedIndex = i;
                    break;
                }
            }
            this.Visible = true;
        }
Пример #7
0
 public void updateVech(vech one)
 {
     m_sql.updateVech(one);
     load();
     m_status = formStatus.noneStaus;
 }
Пример #8
0
 public void insertVech(vech one)
 {
     m_sql.insertVech(one);
     load();
     m_status = formStatus.noneStaus;
 }