예제 #1
0
        private void btAdd_Click_1(object sender, EventArgs e)
        {
            Smmprog prog = new Smmprog();

            prog.ProgModuleType = "0";

            if (treeView1.SelectedNode.Level == 0)
            {
                prog.ParentId = "";
            }
            else if (treeView1.SelectedNode.Tag is Smmprog)
            {
                prog.ParentId = (treeView1.SelectedNode.Tag as Smmprog).ProgId;
            }
            FrmSmmprogEdit dlg = new FrmSmmprogEdit();

            dlg.Smmprog       = prog;
            dlg.ShowInTaskbar = false;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //SmmprogService.Create<Smmprog>(prog);
                    SmmprogService.Create("InsertSmmprog", prog);

                    TreeNode node = treeView1.SelectedNode.Nodes.Add(prog.ProgName);
                    node.Tag = prog;
                }
                catch { }
            }
        }
예제 #2
0
        private void btEdit_Click_1(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node != null && node.Tag is Smmprog)
            {
                FrmSmmprogEdit dlg = new FrmSmmprogEdit();
                dlg.Smmprog = node.Tag as Smmprog;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        SmmprogService.Update <Smmprog>(dlg.Smmprog);
                        node.Text = dlg.Smmprog.ProgName;
                    }
                    catch (Exception err) { MessageBox.Show(err.Message); }
                }
            }
        }