Example #1
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;
     }
 }
 private void ok_button_Click(object sender, EventArgs e)
 {
     if (m_status == Status.addStatus)
     {
         if (name_textBox.Text == "" || vol_textBox.Text == "" || jour_textBox.Text == "")
         {
             MessageBox.Show("请完整填写车型信息", "车辆管理", MessageBoxButtons.OK);
             return;
         }
         else
         {
             if (m_form.containTypeName(name_textBox.Text))
             {
                 MessageBox.Show("车型名称重复,请填写其它名称", "车辆管理", MessageBoxButtons.OK);
                 return;
             }
             vechType one = new vechType();
             one.name    = name_textBox.Text;
             one.volume  = Convert.ToDouble(vol_textBox.Text);
             one.journey = Convert.ToDouble(jour_textBox.Text);
             m_form.insertVechType(one);
         }
     }
     else if (m_status == Status.editStatus)
     {
         if (vol_textBox.Text == "" || jour_textBox.Text == "")
         {
             MessageBox.Show("请完整填写车型信息", "车辆管理", MessageBoxButtons.OK);
             return;
         }
         else
         {
             vechType one = new vechType();
             one.name    = name_textBox.Text;
             one.volume  = Convert.ToDouble(vol_textBox.Text);
             one.journey = Convert.ToDouble(jour_textBox.Text);
             m_form.updateVechType(one);
         }
     }
     m_form.setStatus(formStatus.noneStaus);
     m_form.goFull();
     this.Visible = false;
 }