/// <summary> /// 插入产品结构 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStructInsert_Click(object sender, EventArgs e) { //1.找到插入的节点的位置 PDM_STRUCT t_struct = new PDM_STRUCT(); TreeListViewItem item = this.list_productTreeStruct.Items[0]; int count = 0; int index = 0; for (int i = 0; i < item.Items.Count; i++) { if (item.Items[i].CheckStatus == CheckState.Checked) { count++; index = i; } } if (count != 1) { MessageBox.Show("只能选择一条记录且子结构无法更改!"); return; } t_struct.OBJECTID = this.m_product.PRODUCTID; t_struct.ASSOBJECTID = item.Items[index].Tag.ToString(); //2.打开产品添加界面传递(产品对象,关联对象ID,操作类型--插入)参数 ProductsStructAddForm o = new ProductsStructAddForm(this.m_product, t_struct.ASSOBJECTID, Enum_AssOpType.INSERT); o.StartPosition = FormStartPosition.CenterParent; o.ShowDialog(); //3.清空产品结构树,并重新构造树 this.list_productTreeStruct.Items.Clear(); list_productTreeStruct_init(); }
/// <summary> /// 添加产品结构 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStructAdd_Click(object sender, EventArgs e) { //1.打开产品添加界面传递(产品对象,关联对象ID,操作类型--保存)参数 ProductsStructAddForm o = new ProductsStructAddForm(this.m_product, "", Enum_AssOpType.SAVE); o.StartPosition = FormStartPosition.CenterParent; o.ShowDialog(); //2.清空并重新构造产品结构树 this.list_productTreeStruct.Items.Clear(); list_productTreeStruct_init(); }
/// <summary> /// 替换产品结构 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStructReplace_Click(object sender, EventArgs e) { //1.查找需要替换的产品结构 PDM_STRUCT t_struct = new PDM_STRUCT(); TreeListViewItem item = this.list_productTreeStruct.Items[0]; int count = 0; int index = 0; for (int i = 0; i < item.Items.Count; i++) { if (item.Items[i].CheckStatus == CheckState.Checked) { count++; index = i; } } if (count != 1) { MessageBox.Show("只能选择一条记录且子结构无法更改!"); return; } t_struct.OBJECTID = this.m_product.PRODUCTID; t_struct.ASSOBJECTID = item.Items[index].Tag.ToString(); //2.打开产品添加界面传递(产品对象,关联对象ID,操作类型--替换)参数 ProductsStructAddForm o = new ProductsStructAddForm(this.m_product, t_struct.ASSOBJECTID, Enum_AssOpType.REPLACE); o.StartPosition = FormStartPosition.CenterParent; o.ShowDialog(); //3.清空产品结构树,并重新构造树 this.list_productTreeStruct.Items.Clear(); list_productTreeStruct_init(); }
/// <summary> /// 添加产品结构 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStructAdd_Click(object sender, EventArgs e) { //1.打开产品添加界面传递(产品对象,关联对象ID,操作类型--保存)参数 ProductsStructAddForm o = new ProductsStructAddForm(this.m_product,"",Enum_AssOpType.SAVE); o.StartPosition = FormStartPosition.CenterParent; o.ShowDialog(); //2.清空并重新构造产品结构树 this.list_productTreeStruct.Items.Clear(); list_productTreeStruct_init(); }