private void btnInsertOperation_Click(object sender, EventArgs e) { //gvOperation.Rows.Clear(); for (int i = 0; i < tvOperation.Nodes.Count; i++) { if (tvOperation.Nodes[i].Checked) { bool sw = false; for (int j = 0; j < gvOperation.Rows.Count; j++) { if (gvOperation.Rows[j].Cells[0].Value.ToString() == tvOperation.Nodes[i].Tag.ToString()) { sw = true; } } if (!sw) { gvOperation.Rows.Add(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = tvOperation.Nodes[i].Tag.ToString(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = tvOperation.Nodes[i].Text.ToString(); Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(tvOperation.Nodes[i].Tag.ToString())); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = 1; } } } }
private void BindTreeViwAndGrid(TreeView treeView, DataGridView dataGridView) { ClearCheckAndGrid(tvOperation, gvOperation); ClearCheckAndGrid(tvOperation, gvOperation); dataGridView.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EJackPanelWeek.nodeKeys.Count; i++) { Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EJackPanelWeek.nodeKeys[i]); string s = Operation.ProductID.ToString(); foreach (TreeNode rootnode in tvOperation.Nodes) { if (rootnode.Tag.ToString() == s) { rootnode.Checked = true; gvOperation.Rows.Add(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString(); Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString())); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count; } } } }
private void BindTreeViwAndGridEquipment() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //EQUIPMENT ClearCheckAndGrid(tvEquipment, gvSelectedEquipment); ClearCheckAndGrid(tvEquipment, gvSelectedEquipment); gvSelectedEquipment.Refresh(); //ed.WriteMessage("nodeKeysEPackage.Count:" + Atend.Base.Equipment.ECatOut.nodeKeysEPackage.Count.ToString() + "\n"); for (int i = 0; i < Atend.Base.Equipment.EDisconnector.nodeKeysEPackageX.Count; i++) { string s = Atend.Base.Equipment.EDisconnector.nodeKeysEPackageX[i].ToString(); foreach (TreeNode rootnode in tvEquipment.Nodes) { foreach (TreeNode chileNode in rootnode.Nodes) { if (Atend.Base.Equipment.EDisconnector.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString()) { if (chileNode.Tag.ToString() == s) { rootnode.BackColor = Color.FromArgb(203, 214, 235); chileNode.Checked = true; gvSelectedEquipment.Rows.Add(); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag; gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text; gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EDisconnector.nodeCountEPackageX[i].ToString(); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name; } } } } } //************ //Operation ClearCheckAndGrid(tvOperation, gvSelectedOperation); gvSelectedOperation.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EDisconnector.nodeKeysX.Count; i++) { Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EDisconnector.nodeKeysX[i]); string s = Operation.ProductID.ToString(); foreach (TreeNode rootnode in tvOperation.Nodes) { if (rootnode.Tag.ToString() == s) { rootnode.Checked = true; gvSelectedOperation.Rows.Add(); gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString())); gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[3].Value = Operation.Count; } } } }
private void BindTreeViwAndGrid() { //EQUIPMENT ClearCheckAndGrid(tvEquipment, gvSelectedEquipment); gvSelectedEquipment.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EMeasuredJackPanel.nodeKeysEPackageX.Count; i++) { string s = Atend.Base.Equipment.EMeasuredJackPanel.nodeKeysEPackageX[i].ToString(); foreach (TreeNode rootnode in tvEquipment.Nodes) { foreach (TreeNode chileNode in rootnode.Nodes) { if (Atend.Base.Equipment.EMeasuredJackPanel.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString()) { if (chileNode.Tag.ToString() == s) { rootnode.BackColor = Color.FromArgb(203, 214, 235); chileNode.Checked = true; gvSelectedEquipment.Rows.Add(); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag; gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text; gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EMeasuredJackPanel.nodeCountEPackageX[i].ToString(); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name; } } } } } //************ //Operation ClearCheckAndGrid(tvOperation, gvOperation); gvOperation.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EMeasuredJackPanel.nodeKeys.Count; i++) { //string s = Atend.Base.Equipment.ELight.nodeKeys[i].ToString(); Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EMeasuredJackPanel.nodeKeys[i]); string s = Operation.ProductID.ToString(); foreach (TreeNode rootnode in tvOperation.Nodes) { if (rootnode.Tag.ToString() == s) { rootnode.Checked = true; gvOperation.Rows.Add(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString(); Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString())); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count; } } } }
private void BindTreeViwAndGridEquipment(TreeView treeView, DataGridView dataGridView) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //EQUIPMENT ClearCheckAndGrid(tvEquipment, gvSelectedEquipment); ClearCheckAndGrid(tvEquipment, gvSelectedEquipment); dataGridView.Refresh(); //ed.WriteMessage("nodeKeysEPackage.Count:" + Atend.Base.Equipment.EInsulator.nodeKeysEPackage.Count.ToString() + "\n"); for (int i = 0; i < Atend.Base.Equipment.EInsulator.nodeKeysEPackageX.Count; i++) { string s = Atend.Base.Equipment.EInsulator.nodeKeysEPackageX[i].ToString(); foreach (TreeNode rootnode in tvEquipment.Nodes) { foreach (TreeNode chileNode in rootnode.Nodes) { //ed.WriteMessage("nodeTypeEPackage:" + Atend.Base.Equipment.EInsulator.nodeTypeEPackage[i].ToString() + "\n"); //ed.WriteMessage("rootnode.Tag:" + rootnode.Tag.ToString() + "\n"); if (Atend.Base.Equipment.EInsulator.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString()) { //ed.WriteMessage(string.Format(" child tag : {0} , s: {1} \n", chileNode.Tag.ToString(), s)); if (chileNode.Tag.ToString() == s) { //ed.WriteMessage("I am in the if \n"); rootnode.BackColor = Color.FromArgb(203, 214, 235); chileNode.Checked = true; gvSelectedEquipment.Rows.Add(); //ed.WriteMessage("Child tag : " + chileNode.Tag.ToString() + "\n"); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag; //ed.WriteMessage("Child tag : " + chileNode.Text.ToString() + "\n"); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text; gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EInsulator.nodeCountEPackageX[i].ToString(); gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name; } } } } } //************ //Operation ClearCheckAndGrid(tvOperation, gvOperation); dataGridView.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EInsulator.nodeKeysX.Count; i++) { Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EInsulator.nodeKeysX[i]); string s = Operation.ProductID.ToString(); foreach (TreeNode rootnode in tvOperation.Nodes) { //ed.WriteMessage("RootNode.Tag= " + rootnode.Tag.ToString() + "\n"); if (rootnode.Tag.ToString() == s) { //ed.WriteMessage("I Am In IF" + "rootnode.Tag:= " + rootnode.Tag.ToString() + "S =" + s + "\n"); rootnode.Checked = true; gvOperation.Rows.Add(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString(); Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString())); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count; } } } }
private void BindTreeViwAndGridEquipment() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; ClearCheckAndGrid(tvProduct, gvSelectedProduct); ClearCheckAndGrid(tvProduct, gvSelectedProduct); gvSelectedProduct.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count; i++) { string s = Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString(); foreach (TreeNode rootnode in tvProduct.Nodes) { foreach (TreeNode chileNode in rootnode.Nodes) { //ed.WriteMessage("nodeTypeEPackage:" + Atend.Base.Equipment.EGroundPost.nodeTypeEPackage[i].ToString() + "\n"); //ed.WriteMessage("rootnode.Tag:" + rootnode.Tag.ToString() + "\n"); if (Atend.Base.Equipment.EGroundPost.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString()) { //ed.WriteMessage(string.Format(" child tag : {0} , s: {1} \n", chileNode.Tag.ToString(), s)); if (chileNode.Tag.ToString() == s) { //ed.WriteMessage("I am in the if \n"); rootnode.BackColor = Color.FromArgb(203, 214, 235); chileNode.Checked = true; gvSelectedProduct.Rows.Add(); //ed.WriteMessage("Child tag : " + chileNode.Tag.ToString() + "\n"); gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[0].Value = chileNode.Tag; //ed.WriteMessage("Child tag : " + chileNode.Text.ToString() + "\n"); gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[1].Value = chileNode.Text; gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EGroundPost.nodeCountEPackageX[i].ToString(); gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[3].Value = chileNode.Name; gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[4].Value = rootnode.Tag; } } } } } //((((((((((((((( ClearCheckAndGrid(tvOperation, gvOperation); gvOperation.Refresh(); for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysX.Count; i++) { Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EGroundPost.nodeKeysX[i]); string s = Operation.ProductID.ToString(); foreach (TreeNode rootnode in tvOperation.Nodes) { //ed.WriteMessage("RootNode.Tag= " + rootnode.Tag.ToString() + "\n"); if (rootnode.Tag.ToString() == s) { //ed.WriteMessage("I Am In IF" + "rootnode.Tag:= " + rootnode.Tag.ToString() + "S =" + s + "\n"); rootnode.Checked = true; gvOperation.Rows.Add(); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString(); Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString())); gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name; gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count; } } } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // dt.Rows.Clear(); // foreach (DataRow drGround in Atend.Base.Equipment.EGroundPost.groundPostSubEquip.Rows) // { // DataRow dr = dt.NewRow(); // dr["productCode"] = Convert.ToInt32(drGround["productCode"].ToString()); // dr["Cell"] = Convert.ToInt32(drGround["Cell"].ToString()); // dr["count"] = Convert.ToInt32(drGround["count"].ToString()); // dr["TableType"] = Convert.ToInt32(drGround["TableType"].ToString()); // dt.Rows.Add(dr); // } ////EventArgs e=new EventArgs(); //// cboNumCount_SelectedIndexChanged(cboNumCount,e); // //Opeartion // ClearCheckAndGrid(tvOperation, gvOperation); // gvOperation.Refresh(); // for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeys.Count; i++) // { // string s = Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString(); // //MessageBox.Show(Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString()); // foreach (TreeNode rootnode in tvOperation.Nodes) // { // //foreach (TreeNode chileNode in rootnode.Nodes) // //{ // ed.WriteMessage("RootNOde.Tag= "+rootnode.Tag.ToString()+" NodeKey = "+Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString()+"\n"); // if (rootnode.Tag.ToString() == s) // { // ed.WriteMessage("I Am In The IF"); // rootnode.Checked = true; // gvOperation.Rows.Add(); // gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag; // gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text; // //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString(); // } // } // } //****** }