/// <summary>新增同级/下级 /// /// </summary> /// <param name="strOperation">操作类型</param> private void DoNew(string strOperation) { string strMsg = CheckSelect("新增等级"); if (strMsg != string.Empty) { MessageBox.Show(strMsg); return; } int intParentId = -1; TreeListDemo model = dataTreeListView.SelectedObjects[0] as TreeListDemo; if (model != null) { intParentId = strOperation == "cmdNewSameLevel" ? model.ParentId : model.Id; } FrmTreeListDemoDialog frmDialog = new FrmTreeListDemoDialog(null, intParentId, m_lstTreeListDemo); if (frmDialog.ShowDialog() == DialogResult.OK) { m_lstTreeListDemo = frmDialog.ListTreeListDemo; dataTreeListView.DataSource = m_lstTreeListDemo; dataTreeListView.Refresh(); } }
/// <summary>编辑 /// /// </summary> private void DoEdit() { string strMsg = CheckSelect("修改"); if (strMsg != string.Empty) { MessageBox.Show(strMsg); return; } TreeListDemo model = dataTreeListView.SelectedObjects[0] as TreeListDemo; if (model != null) { FrmTreeListDemoDialog frmDialog = new FrmTreeListDemoDialog(model, 0, m_lstTreeListDemo); if (frmDialog.ShowDialog() == DialogResult.OK) { m_lstTreeListDemo = frmDialog.ListTreeListDemo; dataTreeListView.DataSource = m_lstTreeListDemo; dataTreeListView.Refresh(); } } }