Exemplo n.º 1
0
        private void btnSubJobDel_Click(object sender, EventArgs e)
        {
            if (!checkSubJobInfo())
            {
                return;
            }
            string subId = lvSubJobList.Items[_checkSubJobIndex].SubItems[0].Text;

            if (!checkCanDelete(subId))
            {
                MessageBox.Show("不能删除,当前的选择有后续步骤!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (_checkSubJobIndex < 0)
            {
                MessageBox.Show("请正确选择想要操作的步骤!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (_checkSubJobIndex >= 0 && _checkSubJobIndex < lvSubJobList.Items.Count)
            {
                if (MessageBox.Show(String.Format("是否确定要删除步骤【{0}】?", lvSubJobList.Items[_checkSubJobIndex].SubItems[4].Text), "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    MessageBox.Show("取消删除", "取消", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    DataReadWriteHelper jobReader = new DataReadWriteHelper(Global.config);
                    jobReader.deleteData("delete from sub_job_list where sub_job_id = " + subId);
                    MessageBox.Show("删除成功", "删除", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    _checkSubJobIndex = -1;
                    refreshData();
                }
            }
        }
Exemplo n.º 2
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (_checkIndex >= 0 && _checkIndex < lvJob.Items.Count)
     {
         if (MessageBox.Show(String.Format("是否确定要删除业务【{0}】?", lvJob.Items[_checkIndex].SubItems[2].Text), "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             MessageBox.Show("取消删除", "取消", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             DataReadWriteHelper jobReader = new DataReadWriteHelper(Global.config);
             jobReader.deleteData("delete from job_list where job_id = " + lvJob.Items[_checkIndex].SubItems[0].Text);
             MessageBox.Show("删除成功", "删除", MessageBoxButtons.OK, MessageBoxIcon.Information);
             _checkIndex          = -1;
             _checkJobShowerIndex = -1;
             _checkSubJobIndex    = -1;
             refreshData();
             lvSubJobList.Clear();
         }
     }
 }