Ejemplo n.º 1
0
        private void btn_modify_Click(object sender, RoutedEventArgs e)
        {
            txb_modify.Text = txb_modify.Text.Replace(" ", "");

            if (!(txb_modify.Text == "") && !(selectDataStar == null) && !(selectDataStar.Name == txb_modify.Text))
            {
                selectDataEnd = selectDataStar;

                if (txb_modify.Text[txb_modify.Text.Length - 1].ToString() == "组")
                {
                    txb_modify.Text = txb_modify.Text.Replace(" ", "").TrimEnd('组');
                }

                string strSQL = " update [member] set [name] = '" + txb_modify.Text + "' where [ID] = " + selectDataEnd.ID + " ";
                DatabaseOperate.databaseOperate(strSQL);

                this.cmb_whichgroup.ItemsSource = App.GroupComboBoxData;
                this.my_treeview.ItemsSource    = App.outputTreeView;
            }

            if (!(selectIndexEnd == -1))
            {
                cmb_whichgroup.SelectedIndex = selectIndexEnd;
            }
        }
Ejemplo n.º 2
0
        private void my_treeview_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            try
            {
                selectDataStar  = my_treeview.SelectedItem as ShowTreeViewData;
                txb_modify.Text = selectDataStar.Name;
            }

            catch
            { }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 递归向下查找
        /// </summary>
        private static ShowTreeViewData FindDownward(List <ShowTreeViewData> treeviewData, int id)
        {
            if (treeviewData == null)
            {
                return(null);
            }

            for (int i = 0; i < treeviewData.Count; i++)
            {
                if (treeviewData[i].ID == id)
                {
                    return(treeviewData[i]);
                }

                ShowTreeViewData node = FindDownward(treeviewData[i].ChildNodes, id);

                if (node != null)
                {
                    return(node);
                }
            }
            return(null);
        }
Ejemplo n.º 4
0
        private void btn_delete_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (!(selectDataStar == null))
            {
                selectDataEnd = selectDataStar;

                if (selectDataEnd.ParentID == -1)
                {
                    string _strSQL = " delete from [member] where [parentID] = " + selectDataEnd.ID + " ";
                    DatabaseOperate.databaseOperate(_strSQL);
                }

                string strSQL = " delete from [member] where [ID] = " + selectDataEnd.ID + " ";
                DatabaseOperate.databaseOperate(strSQL);

                this.cmb_whichgroup.ItemsSource = App.GroupComboBoxData;
                this.my_treeview.ItemsSource    = App.outputTreeView;
            }

            if (!(selectIndexEnd == -1))
            {
                cmb_whichgroup.SelectedIndex = selectIndexEnd;
            }
        }