Ejemplo n.º 1
0
        /// <summary>
        /// 添加分类
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menu_AddType_Click(object sender, EventArgs e)
        {
            FrmEditDictType dlg = new FrmEditDictType();

            dlg.PID          = GetParentNodeIndex();
            dlg.OnDataSaved += new EventHandler(dlg_OnDataTreeSaved);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                menu_Refresh_Click(null, null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 编辑分类
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menu_EditType_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeView1.SelectedNode;
            Int32    tmpPID       = 0;

            if (selectedNode != null && selectedNode.Tag != null)
            {
                Int32 typeId = Convert.ToInt32(selectedNode.Tag);

                #region 加载数据字典大项
                XmlNodeList xmlNodeLst = xmldicthelper.Read("datatype/dataitem");

                for (Int32 i = 0; i < xmlNodeLst.Count; i++)
                {
                    // 将节点转换为元素,便于得到节点的属性值
                    XmlElement xe = (XmlElement)xmlNodeLst[i];

                    // 得到DataTypeInfo节点的所有子节点
                    XmlNodeList xnl0 = xe.ChildNodes;

                    if (typeId == Convert.ToInt32(xnl0.Item(0).InnerText))
                    {
                        tmpPID = Convert.ToInt32(xnl0.Item(1).InnerText);
                        break;
                    }
                }
                #endregion

                if (tmpPID != 0)
                {
                    FrmEditDictType dlg = new FrmEditDictType();
                    dlg.ID           = typeId.ToString();
                    dlg.PID          = tmpPID;
                    dlg.OnDataSaved += new EventHandler(dlg_OnDataTreeSaved);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        menu_Refresh_Click(null, null);
                    }
                }
            }
        }