コード例 #1
0
        public void Copy()
        {
            if (CurTreeNode.ImageIndex == 2 || CurTreeNode.ImageIndex == 8)
            {
                return;
            }
            frmFileCopy frmFile = new frmFileCopy();

            frmFile.InitData(CurTreeNode.Text);
            if (frmFile.ShowDialog() == DialogResult.OK)
            {
                // CurTreeNode.Text = frmFile.NewFileName;
                string  old_uid = ((SVGFILE)(CurTreeNode.Tag)).SUID;
                string  new_uid = Guid.NewGuid().ToString();
                SVGFILE _svg    = Services.BaseService.GetOneByKey <SVGFILE>(old_uid);
                _svg.SUID     = new_uid;
                _svg.FILENAME = frmFile.NewFileName;
                Services.BaseService.Create <SVGFILE>(_svg);

                IList list1 = Services.BaseService.GetList("SelectglebePropertyBySvgUID", old_uid);
                for (int i = 0; i < list1.Count; i++)
                {
                    glebeProperty _gle = (glebeProperty)list1[i];
                    _gle.UID    = Guid.NewGuid().ToString();
                    _gle.SvgUID = new_uid;
                    Services.BaseService.Create <glebeProperty>(_gle);
                }
                IList list2 = Services.BaseService.GetList("SelectLineInfoBySvgUID", old_uid);
                for (int i = 0; i < list2.Count; i++)
                {
                    LineInfo _line = (LineInfo)list2[i];
                    _line.UID    = Guid.NewGuid().ToString();
                    _line.SvgUID = new_uid;
                    Services.BaseService.Create <LineInfo>(_line);
                }
                IList list3 = Services.BaseService.GetList("SelectsubstationBySvgUID", old_uid);
                for (int i = 0; i < list3.Count; i++)
                {
                    substation _sub = (substation)list3[i];
                    _sub.UID    = Guid.NewGuid().ToString();
                    _sub.SvgUID = new_uid;
                    Services.BaseService.Create <substation>(_sub);
                }
                TreeNode treeNode = new TreeNode();
                treeNode.Tag        = _svg;
                treeNode.ImageIndex = 9;
                treeNode.Text       = _svg.FILENAME;
                root.Nodes.Add(treeNode);
                MessageBox.Show("文件拷贝成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
ファイル: CtrlFileManager.cs プロジェクト: EdgarEDT/myitoppsp
        public void Copy()
        {
            if (CurTreeNode.ImageIndex == 2 || CurTreeNode.ImageIndex == 8)
            {
                return;
            }
            frmFileCopy frmFile = new frmFileCopy();
            frmFile.InitData(CurTreeNode.Text);
            if(frmFile.ShowDialog()==DialogResult.OK){
               // CurTreeNode.Text = frmFile.NewFileName;
                string old_uid=((SVGFILE)(CurTreeNode.Tag)).SUID;
                string new_uid = Guid.NewGuid().ToString();
                SVGFILE _svg= Services.BaseService.GetOneByKey<SVGFILE>(old_uid);
                _svg.SUID = new_uid;
                _svg.FILENAME = frmFile.NewFileName;
                Services.BaseService.Create<SVGFILE>(_svg);

                IList list1= Services.BaseService.GetList("SelectglebePropertyBySvgUID",old_uid);
                for (int i = 0; i < list1.Count;i++ )
                {
                    glebeProperty _gle = (glebeProperty)list1[i];
                    _gle.UID = Guid.NewGuid().ToString();
                    _gle.SvgUID = new_uid;
                    Services.BaseService.Create<glebeProperty>(_gle);
                }
                IList list2 = Services.BaseService.GetList("SelectLineInfoBySvgUID", old_uid);
                for (int i = 0; i < list2.Count; i++)
                {
                    LineInfo _line = (LineInfo)list2[i];
                    _line.UID = Guid.NewGuid().ToString();
                    _line.SvgUID = new_uid;
                    Services.BaseService.Create<LineInfo>(_line);
                }
                IList list3 = Services.BaseService.GetList("SelectsubstationBySvgUID", old_uid);
                for (int i = 0; i < list3.Count; i++)
                {
                    substation _sub = (substation)list3[i];
                    _sub.UID = Guid.NewGuid().ToString();
                    _sub.SvgUID = new_uid;
                    Services.BaseService.Create<substation>(_sub);
                }
                TreeNode treeNode = new TreeNode();
                treeNode.Tag = _svg;
                treeNode.ImageIndex = 9;
                treeNode.Text = _svg.FILENAME;
                root.Nodes.Add(treeNode);
                MessageBox.Show("文件拷贝成功。","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }