private void btnCtrlDelete_Click(object sender, EventArgs e) { try { if (dgvTestCtrl.CurrentRow != null && dgvTestCtrl.CurrentRow.Index != -1) //140710_2 { int CurrIndex = this.dgvTestCtrl.CurrentRow.Index; DialogResult drst = new DialogResult(); drst = (MessageBox.Show("即将进行删除资料TestCtrl -->" + dgvTestCtrl.CurrentRow.Cells["ItemName"].Value.ToString() + "\n \n 选择 'Y' (是) 继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)); if (drst == DialogResult.Yes) { string sName = dgvTestCtrl.CurrentRow.Cells["ItemName"].Value.ToString(); long myPID = this.myCtrlPID; //DataTable资料移除部分待新增!!! bool result = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables[2], "PID=" + myPID + "and ItemName='" + sName + "'"); if (result) { PNInfo.ISNeedUpdateflag = true; //140603_2 MessageBox.Show("项目资料 序号为: " + CurrIndex + ";Name =" + sName + "已经移除!"); } else { MessageBox.Show("项目资料 序号为: " + CurrIndex + "!Name =" + sName + "移除失败!"); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void deleteNewModelONErr() { try { string queryCMD = "ItemName='" + this.myModelName + "' And PID=" + this.PID; int myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestModel"], queryCMD); if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"], queryCMD); PNInfo.mylastIDTestModel = PNInfo.mylastIDTestModel - myExistCount; } PNInfo.myTestModelAddOKFlag = true; PNInfo.myTestPrmtrAddOKFlag = true; //140605_2 blnAddNewModel = false; //140527_00 btnAdd.Enabled = true; currlst.Enabled = true; RefreshModelInfo(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); RefreshModelInfo(); } }
private void EquipmentForm_FormClosing(object sender, FormClosingEventArgs e) { blnUnloadFormflag = true; if (this.blnAddNewEquip || AddErr) //140603_1712 Add 判定AddErr-->是否在添加过程中出现错误! { DialogResult myResult = MessageBox.Show( "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); try { //先删除TopoEquipmentParameter资料! string queryCMD = "PID=" + this.myPrmtrPID; int myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], queryCMD); if (myResult == DialogResult.OK) { if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], queryCMD); PNInfo.mylastIDTestEquipPrmtr = PNInfo.mylastIDTestEquipPrmtr - myExistCount; } //再删除TopoEquipment资料! queryCMD = "ItemName='" + this.myEquipName + "' And PID=" + this.PID; myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoEquipment"], queryCMD); if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], queryCMD); PNInfo.mylastIDTestEquip = PNInfo.mylastIDTestEquip - myExistCount; } blnAddNewEquip = false; PNInfo.myTestEquipPrmtrAddOKFlag = true; //140529_1 PNInfo.myTestEquipAddOKFlag = true; //140529_1 mylastIndex = -1; //140603_2 RefreshEquipInfo(); this.Dispose(); } //else //140604_1 //{ // return; //} } catch (Exception ex) { MessageBox.Show(ex.ToString()); RefreshEquipInfo(); //return; } } else { //140612_3 PNInfo.myTestEquipPrmtrAddOKFlag = true; //140529_1 PNInfo.myTestEquipAddOKFlag = true; //140529_1 } }
private void btnRemove_Click(object sender, EventArgs e) { try { if (this.currlst.SelectedIndex != -1) { DialogResult drst = new DialogResult(); drst = (MessageBox.Show("即将进行删除资料TestModel 以及对应的TestParameter--> " + currlst.SelectedItem.ToString() + "\n \n 选择 'Y' (是) 继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)); if (drst == DialogResult.Yes) { //若为新增的项目则必须指定当前的选择的Item int CurrIndex = currlst.SelectedIndex; string sName = currlst.Items[CurrIndex].ToString(); long myPID = PID; bool resultPrmtr = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], "PID=" + myPrmtrPID); bool result = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestModel"], "PID=" + myPID + " and ItemName='" + sName + "'"); if (result && resultPrmtr) { PNInfo.ISNeedUpdateflag = true; //140603_2 currlst.Items.RemoveAt(CurrIndex); PNInfo.myDeletedCountTestModel++; PNInfo.myDeletedCountTestPrmtr++; //140521@子信息的数据需要重新查询...TBD myNewModelcount--; this.blnAddNewModel = false; this.btnAdd.Enabled = true; currlst.Enabled = true; btnOK.Enabled = true; btnNextPage.Enabled = true; MessageBox.Show("项目资料 序号为: " + CurrIndex + ";ItemName =" + sName + "已经移除!"); } else { MessageBox.Show("项目资料 序号为: " + CurrIndex + "!ItemName =" + sName + "移除失败!"); } } } else { MessageBox.Show("请选择需要删除的TestModel后再点击按钮!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void exitForm() { try { if (this.blnAddNew) { DialogResult myResult = MessageBox.Show("尚未完成 TestPlanName= " + this.cboItemName.Text + "的资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (myResult == DialogResult.OK) { string queryCMD = "ItemName= '" + this.cboItemName.Text.ToString() + "' And PID=" + this.PID; int myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestPlan"], queryCMD); if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestPlan"], queryCMD); PNInfo.mylastIDTestPlan = PNInfo.mylastIDTestPlan - myExistCount; } blnAddNew = false; PNInfo.myTestPlanAddOKFlag = true; //140529_1 this.Close(); Application.OpenForms["PNInfo"].Show(); } } else { this.Close(); Application.OpenForms["PNInfo"].Show(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void TestParameterInfo_FormClosing(object sender, FormClosingEventArgs e) { if (this.blnAddNew) { DialogResult myResult = MessageBox.Show( "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); try { string queryCMD = "PID=" + this.myPrmtrPID; int myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], queryCMD); if (myResult == DialogResult.OK) { if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], queryCMD); PNInfo.mylastIDTestPrmtr = PNInfo.mylastIDTestPrmtr - myExistCount; } blnAddNew = false; PNInfo.myTestPrmtrAddOKFlag = true; //140529_1 this.Dispose(); } else //140604_1 { return; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void CtrlInfo_FormClosing(object sender, FormClosingEventArgs e) { if (this.blnAddNew) { DialogResult myResult = MessageBox.Show( "尚未完成资料维护!提前退出将可能无法保证资料完整,系统将自动删除当前维护项目资料!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); try { string queryCMD = "ItemName='" + this.cboItemName.Text.ToString() + "' And PID=" + this.PID; int myExistCount = PNInfo.currPrmtrCountExisted(PNInfo.TopoToatlDS.Tables["TopoTestControl"], queryCMD); if (myResult == DialogResult.OK) { if (myExistCount > 0) { PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoTestControl"], queryCMD); PNInfo.mylastIDTestCtrl = PNInfo.mylastIDTestCtrl - myExistCount; } blnAddNew = false; PNInfo.myTestCtrlAddOKFlag = true; this.Dispose(); } //else //140604_1 //{ // return; //} } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void btnRemove_Click(object sender, EventArgs e) { try { DialogResult drst = new DialogResult(); drst = (MessageBox.Show("即将进行删除资料TestEquip --> " + currlst.SelectedItem.ToString() + "\n \n 选择 'Y' (是) 继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)); if (drst == DialogResult.Yes) { //若为新增的项目则必须制定当前的选择的Item int CurrIndex = currlst.SelectedIndex; string sName = currlst.Items[CurrIndex].ToString(); long myPID = PID; //DataTable资料移除部分待新增!!! bool result = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], "PID=" + myPID + "and ItemName='" + sName + "'"); bool resultPrmtr = PNInfo.DeleteItemForDT(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], "PID=" + myPrmtrPID); currlst.Items.RemoveAt(CurrIndex); if (result && resultPrmtr) { PNInfo.ISNeedUpdateflag = true; //140603_2 PNInfo.myDeletedCountTestEquip++; PNInfo.myDeletedCountTestEquipPrmtr++; if (blnAddNewEquip) { PNInfo.mylastIDTestEquip--; PNInfo.mynewIDTestEquip--; PNInfo.myTestEquipAddOKFlag = true; //140529_1 PNInfo.myTestEquipPrmtrAddOKFlag = true; //140529_1 } myNewEquipcount--; //this.blnAddNew = false; this.blnAddNewEquip = false; this.btnAdd.Enabled = true; grpEquipPrmtr.Enabled = true; btnNextPage.Enabled = true; currlst.Enabled = true; currlst.Focus(); MessageBox.Show("项目资料 序号为: " + CurrIndex + ";Name =" + sName + "已经移除!"); } else { MessageBox.Show("项目资料 序号为: " + CurrIndex + "!Name =" + sName + "移除失败!"); } } mylastIndex = -1; //140603_2 RefreshEquipInfo(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }