コード例 #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(vechType one)
 {
     this.Top = m_form.getSubTop();
     m_status = Status.editStatus;
     name_textBox.ReadOnly = true;
     vol_textBox.ReadOnly  = false;
     jour_textBox.ReadOnly = false;
     name_textBox.Text     = one.name;
     vol_textBox.Text      = one.volume.ToString();
     jour_textBox.Text     = one.journey.ToString();
     this.Visible          = true;
     ok_button.Visible     = true;
     cal_button.Visible    = true;
 }
コード例 #4
0
 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;
 }
コード例 #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 updateVechType(vechType one)
 {
     m_sql.updateVechType(one);
     load();
     m_status = formStatus.noneStaus;
 }
コード例 #7
0
 public void insertVechType(vechType one)
 {
     m_sql.insertVechType(one);
     load();
     m_status = formStatus.noneStaus;
 }