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(); } } }
private void loadSubJobList(int idx) { DataReadWriteHelper jobReader = new DataReadWriteHelper(Global.config); _checkSubJobIndex = -1; jobReader.readData(ref this.lvSubJobList, "select * from sub_job_list where job_id = " + lvJobShower.Items[idx].SubItems[0].Text); }
private void btnSave_Click(object sender, EventArgs e) { DataReadWriteHelper drw = new DataReadWriteHelper(Global.config); string cmd = String.Format("update job_list set JOB_SN=\"{0}\", JOB_NAME=\"{1}\", JOB_DESC=\"{2}\", JOB_TYPE=\"{3}\", JOB_KEY_WORD=\"{4}\" where JOB_ID = {5}" , txtSN.Text, txtName.Text, txtDesc.Text, txtType.Text, txtKeyWord.Text, job_id); drw.updateData(cmd); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { DataReadWriteHelper drw = new DataReadWriteHelper(Global.config); int type = 1; if (Int32.TryParse(txtType.Text.Trim(), out type) == false) { type = 0; } string args = "[{'name':'@sn','value':'" + txtSN.Text + "','direct':'1'},{'name':'@name','value':'" + txtName.Text + "','direct':'1'}" + ",{'name':'@desc','value':'" + txtDesc.Text + "','direct':'1'},{'name':'@type','value':'" + type + "','direct':'1'},{'name':'@key','value':'" + txtKeyWord.Text + "','direct':'1'}]"; drw.callProc("PROC_INSERT_JOB_LIST", args); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { int postId = -1; if (cbPostId.SelectedIndex >= 0) { postId = (int)_listPov.ElementAt(cbPostId.SelectedIndex).ID; } DataReadWriteHelper drw = new DataReadWriteHelper(Global.config); string cmd = String.Format("update sub_job_list set SUBJOBNAME=\"{0}\", SUBJOBTEXT=\"{1}\", SUB_JOB_TYPE=\"{2}\", POSTID=\"{3}\" where SUB_JOB_ID = {4}", txtStepName.Text, txtStepText.Text, cbStepType.Text, postId, _id); drw.updateData(cmd); this.Close(); }
//获取位置点列表信息 private void getPovList() { DataReadWriteHelper drw = new DataReadWriteHelper(Global.config); _listPov = drw.readData <PovInfo>("select ID, PlaceName from Nav"); if (_listPov != null && _listPov.Count > 0) { foreach (PovInfo t in _listPov) { if (t.PlaceName != null && t.ID > 0) { cbPostId.Items.Add(t.PlaceName); } } } }
private void btnSave_Click(object sender, EventArgs e) { int postId = -1; if (cbPostId.SelectedIndex >= 0) { postId = (int)_listPov.ElementAt(cbPostId.SelectedIndex).ID; } DataReadWriteHelper drw = new DataReadWriteHelper(Global.config); string args = "[{'name':'@name','value':'" + txtStepName.Text + "','direct':'1'},{'name':'@text','value':'" + txtStepText.Text + "','direct':'1'}" + ",{'name':'@parentid','value':'" + _parentId.ToString() + "','direct':'1'} ,{'name':'@jobid','value':'" + _jobId.ToString() + "','direct':'1'}" + ",{'name':'@type','value':'" + cbStepType.Text + "','direct':'1'},{'name':'@postid','value':'" + postId.ToString() + "','direct':'1'}]"; drw.callProc("PROC_INSERT_SUB_JOB_LIST", args); this.Close(); }
//刷新业务信息数据,功能函数 private void refreshData() { DataReadWriteHelper jobReader = new DataReadWriteHelper(Global.config); jobReader.readData(ref this.lvJob, "select * from job_list"); jobReader.readData(ref this.lvJobShower, "select * from job_list"); if (_checkIndex >= 0 && lvJob.Items.Count > _checkIndex) { lvJob.Items[_checkIndex].Checked = true; } if (_checkJobShowerIndex >= 0 && lvJobShower.Items.Count > _checkJobShowerIndex) { lvJobShower.Items[_checkJobShowerIndex].Checked = true; } if (_checkSubJobIndex >= 0 && lvSubJobList.Items.Count > _checkSubJobIndex) { lvSubJobList.Items[_checkSubJobIndex].Checked = true; } }
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(); } } }
//判断是否可以删除某个子步骤 private bool checkCanDelete(string subId) { DataReadWriteHelper jobReader = new DataReadWriteHelper(Global.config); return(jobReader.readData <SubJobInfo>("select * from sub_job_list where PriorID = " + subId).Count < 1); }