private void dgvTestModel_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (dgvTestModel.CurrentRow != null && dgvTestModel.CurrentRow.Index != -1 && e.RowIndex != -1) //140714_0 { currTestModelIndex = e.RowIndex; // Convert.ToInt32(dgvTestModel.Rows[e.RowIndex].Cells["id"].Value); myPrmtrPID = PNInfo.getNextPIDFromdgv(dgvTestModel, currTestModelIndex); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void RefreshMyInfo(bool isFormLoad) { try { PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestControl"], dgvTestCtrl, "PID=" + this.myCtrlPID); if (dgvTestCtrl.Rows.Count > 0) { myModelPID = Convert.ToInt64(this.dgvTestCtrl.Rows[0].Cells["ID"].Value); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], dgvTestModel, "PID=" + this.myModelPID); crpTestModel.Enabled = true; showBtns(0, true); } else { showBtns(0, false); crpTestModel.Enabled = false; grpTestPrmtr.Enabled = false; } if (isFormLoad) //140714_1 ADD { if (dgvTestModel.Rows.Count > 0) { myPrmtrPID = Convert.ToInt64(this.dgvTestModel.Rows[0].Cells["ID"].Value); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID); grpTestPrmtr.Enabled = true; showBtns(1, true); showBtns(2, true); } else { showBtns(1, false); showBtns(2, false); grpTestPrmtr.Enabled = false; this.dgvTestPrmtr.DataSource = null; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void currlst_SelectedIndexChanged(object sender, EventArgs e) { txtDGVItem.Visible = false; try { if (currlst.SelectedIndex != -1) { txtSaveResult.Text = ""; mylastIndex = currlst.SelectedIndex;//140530_1 myEquipName = this.currlst.SelectedItem.ToString(); int lastChar = myEquipName.IndexOf("_"); myQueryEquipName = myEquipName.Substring(0, lastChar); myGlobalEquipID = Convert.ToInt64(PNInfo.getDTColumnInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentList"], "ID", "ItemName='" + myQueryEquipName + "'")); DataTable myPrmtrDT = new DataTable(); if (!blnAddNewEquip) { //140529 TBD 若Global的EquipParameter参数有新增? 但是查询TopoTable无法新增资料? //140529 TBD 如何处理? 删除原Equip 后新增? btnEditPrmtrOK.Enabled = true; getInfoFromDT(PNInfo.TopoToatlDS.Tables["TopoEquipment"], currlst.SelectedIndex); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoEquipmentParameter"], dgvEquipPrmtr, "PID=" + myPrmtrPID); //140709_3 if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width) { dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width; } int myTopoEquipPrmtrCount = dgvEquipPrmtr.Rows.Count; int myGlobalEquipPrmtrCount = PNInfo.currPrmtrCountExisted(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], "PID=" + +myGlobalEquipID); string[,] myValues = new string[myGlobalEquipPrmtrCount, 2]; for (int i = 0; i < myGlobalEquipPrmtrCount; i++) { if (i < myTopoEquipPrmtrCount) { myValues[i, 0] = dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString(); myValues[i, 1] = dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value.ToString(); } else //140707_0 { myValues[i, 0] = ""; myValues[i, 1] = ""; } } if (myTopoEquipPrmtrCount != myGlobalEquipPrmtrCount) { MessageBox.Show("发现Topo表参数数目:" + myTopoEquipPrmtrCount + " Global参数数目:" + myGlobalEquipPrmtrCount + ";\n 参数数目不一致,即将新增" + (myGlobalEquipPrmtrCount - myTopoEquipPrmtrCount) + "条仪器参数!!!"); PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID); //若Topo表中存在部分资料则需要覆盖掉此部分Global的默认参数! //140709_3 if (dgvEquipPrmtr.Columns["Item"].Width + dgvEquipPrmtr.Columns["ItemValue"].Width < dgvEquipPrmtr.Size.Width) { dgvEquipPrmtr.Columns["ItemValue"].Width = dgvEquipPrmtr.Size.Width - dgvEquipPrmtr.Columns["Item"].Width; } for (int i = 0; i < myGlobalEquipPrmtrCount; i++) { if (myValues[i, 0] == dgvEquipPrmtr.Rows[i].Cells["Item"].Value.ToString()) { dgvEquipPrmtr.Rows[i].Cells["ItemValue"].Value = myValues[i, 1]; } } } } else { btnEditPrmtrOK.Enabled = false; PNInfo.showTablefilterStrInfo(PNInfo.GlobalTotalDS.Tables["GlobalAllEquipmentParamterList"], dgvEquipPrmtr, "PID=" + myGlobalEquipID); myPrmtrPID = PNInfo.mylastIDTestEquip + 1; } PNInfo.hideMyIDPID(dgvEquipPrmtr); if (dgvEquipPrmtr.Columns.Contains("ItemDescription")) //140530_1 { PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemDescription"); } if (dgvEquipPrmtr.Columns.Contains("ItemType")) //140530_1 { PNInfo.hideMyColumn(dgvEquipPrmtr, "ItemType"); } if (dgvEquipPrmtr.Columns.Contains("Item")) //140530_1 { dgvEquipPrmtr.Columns["Item"].HeaderText = "项目"; } if (dgvEquipPrmtr.Columns.Contains("ItemValue")) //140530_1 { dgvEquipPrmtr.Columns["ItemValue"].HeaderText = "内容"; } } else { mylastIndex = -1; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void dgvTestCtrl_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (dgvTestCtrl.CurrentRow != null && dgvTestCtrl.CurrentRow.Index != -1 && e.RowIndex != -1) //140714_0 { if (!blnAddNewCtrl) { currTestCtrlIndex = e.RowIndex; if (dgvTestCtrl.Rows.Count > 0) { myModelPID = PNInfo.getNextPIDFromdgv(dgvTestCtrl, currTestCtrlIndex); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], dgvTestModel, "PID=" + this.myModelPID); crpTestModel.Enabled = true; showBtns(0, true); } else { showBtns(0, false); crpTestModel.Enabled = false; grpTestPrmtr.Enabled = false; } if (dgvTestModel.Rows.Count > 0) { myPrmtrPID = Convert.ToInt64(this.dgvTestModel.Rows[0].Cells["ID"].Value); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID); grpTestPrmtr.Enabled = true; showBtns(1, true); showBtns(2, true); DataGridViewCell cell = dgvTestModel.Rows[0].Cells["SEQ"]; dgvTestModel.CurrentCell = cell; } else { grpTestPrmtr.Enabled = false; showBtns(1, false); showBtns(2, false); this.dgvTestPrmtr.DataSource = null; } } else { if (dgvTestCtrl.Rows.Count > 0) { currTestCtrlIndex = dgvTestCtrl.Rows.Count - 1; myModelPID = PNInfo.getNextPIDFromdgv(dgvTestCtrl, currTestCtrlIndex); PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestModel"], dgvTestModel, "PID=" + this.myModelPID); crpTestModel.Enabled = true; showBtns(0, true); } else { crpTestModel.Enabled = false; grpTestPrmtr.Enabled = false; showBtns(0, false); } if (dgvTestModel.Rows.Count > 0) { myPrmtrPID = PNInfo.mylastIDTestModel + 1; PNInfo.showTablefilterStrInfo(PNInfo.TopoToatlDS.Tables["TopoTestParameter"], dgvTestPrmtr, "PID=" + this.myPrmtrPID); grpTestPrmtr.Enabled = true; showBtns(1, true); showBtns(2, true); } else { grpTestPrmtr.Enabled = false; showBtns(1, false); showBtns(2, false); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }