Example #1
0
        /// <summary>
        /// 右键文档菜单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuFile_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.contextMenuFile.Visible = false;
            if (e.ClickedItem.Name == "cutItem")
            {
                // 剪切
                cutNode = node;
                this.cutFileItem.Enabled = false;
                this.cutItem.Enabled = false;
                this.copyDocClassItem.Enabled = false;
                this.pasteItem.Enabled = true;
            }
            else if (e.ClickedItem.Name == "controlBrowseItem")
            {
                // 控件浏览
                // 开启socket文件 ,下载文件,
                SocketServer s = new SocketServer("127.0.0.1", 7774, @"G:\asp.net\" + selTreeNode.cn_name +
                "." + selTreeNode.format_name);
                s.start();
                selTreeNode.physical_file_location = @"g:\11.xls";
                selTreeNode.ipaddress = "127.0.0.1";
                selTreeNode.port = 7774;
                // 再浏览
                System.Diagnostics.Process.Start("rundll32.exe", @"shell32,OpenAs_RunDLL " + @"G:\asp.net\" + selTreeNode.cn_name + "." + selTreeNode.format_name);
            }
            else if (e.ClickedItem.Name == "browseItem")
            {
                //浏览
                //获取选中的行
                DocModify modify = new DocModify(selTreeNode, 3);
                if (DialogResult.OK == modify.ShowDialog())
                {
                    // 修改文档成功!
                    MessageBox.Show("文档修改成功!");
                }
            }
            else if (e.ClickedItem.Name == "downItem")
            {
                //下载
                // 打开文件夹
                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    // 开启socket文件
                    SocketServer s = new SocketServer("127.0.0.1", 7774, dlg.SelectedPath + "\\");
                    s.start();
                    selTreeNode.physical_file_location = @"g:\11.xls";
                    selTreeNode.ipaddress = "127.0.0.1";
                    selTreeNode.port = 7774;
                    bool flag = WcfServiceLocator.Create<IDocManageTool>().downDocument(selTreeNode);
                    while (!(flag && s.flag))
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    s.lisner.Stop();
                    s.TempThread.Abort();
                }

            }
            else if (e.ClickedItem.Name == "alterDocumentItem")
            {
                //修改文档
                //获取选中的行
                DocModify modify = new DocModify(selTreeNode, 2);
                if (DialogResult.OK == modify.ShowDialog())
                {
                    // 修改文档成功!
                    MessageBox.Show("文档修改成功!");
                }
            }
            else if (e.ClickedItem.Name == "delDocumentItem")
            {
                // 删除文档
                if (DialogResult.OK == MessageBox.Show("确认删除!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                {
                    bool flag = WcfServiceLocator.Create<IDocManageTool>().delDocument(selTreeNode);
                    // 调用后台删除方法,来删除数据!
                    if (flag)
                    {
                        this.treeList1.DeleteNode(node);
                    }
                }
            }
            else if (e.ClickedItem.Name == "pigeonholeItem")
            {
                // 归档文档 ,是选择正在执行的文档批量归档
            }
            else if (e.ClickedItem.Name == "openWithItem")
            {
                //打开方式
            }
            else if (e.ClickedItem.Name == "updateDocStatusItem")
            {
                //更新文档状态
            }
            else if (e.ClickedItem.Name == "permissionApplyItem ")
            {
                //获取选中的行
                //document doc = (document)this.gridView1.GetFocusedRow();
                //DocModify modify = new DocModify(doc, 2);
                //List<document> list = new List<document>();
                //list.Add(doc);
                //申请权限
                // DocQuery.PermissionApply permissionApply = new DocQuery.PermissionApply(list);
                //if (DialogResult.OK == permissionApply.ShowDialog())
                //{
                //    MessageBox.Show("申请权限成功!");
                //}
            }
            else if (e.ClickedItem.Name == "prinApplyItem")
            {
                //申请打印

            }
            else if (e.ClickedItem.Name == "grantItem")
            {
                // 发放文档

            }
            else if (e.ClickedItem.Name == "grantHistoryItem")
            {
                //文档发放情况

            }
            else if (e.ClickedItem.Name == "docPropertyItem")
            {
                // 文档属性

            }
            else if (e.ClickedItem.Name == "updateHistoryItem")
            {
                //查看变更历史

            }
            else if (e.ClickedItem.Name == "relationDocItem")
            {
                // 关联文档
                DocModify modify = new DocModify(selTreeNode, 4);
                if (DialogResult.OK == modify.ShowDialog())
                {
                    // 修改文档成功!
                    MessageBox.Show("文档修改成功!");
                }
            }
        }
Example #2
0
        /// <summary>
        /// 右键文档夹菜单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuFiles_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            this.contextMenuFiles.Visible = false;
            if (e.ClickedItem.Name == "cutFileItem")
            {
                // 剪切
                cutNode = node;
                this.cutFileItem.Enabled = false;
                this.cutItem.Enabled = false;
                this.copyDocClassItem.Enabled = false;
                this.pasteItem.Enabled = true;
            }
            else if (e.ClickedItem.Name == "pasteItem")
            {
                // 粘贴
                if (cutNode.Tag.GetType() == typeof(document))
                {
                    // 更新后台的数据
                    document doc = ((document)cutNode.Tag);
                    doc.document_type_id = ((document_tree)node.Tag).id;
                    doc.document_type_name = ((document_tree)node.Tag).name;
                    // 调用接口来更新后台数据

                    //粘贴的当前节点添加
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(doc.id, node);
                    tns.SetValue(DocName, doc.cn_name);
                    tns.SetValue(DocID, doc.id);
                    tns.SetValue(DocType, "File");
                    tns.Tag = doc;
                    //剪切的当前节点减少
                    this.treeList1.DeleteNode(cutNode);
                }
                else
                {
                    document_tree docTree = (document_tree)cutNode.Tag;
                    docTree.parent_id = ((document_tree)node.Tag).id;
                    docTree.parent_name = ((document_tree)node.Tag).name;
                    // 调用接口来更新后台数据

                    //粘贴的当前节点添加
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docTree.id, node);
                    tns.SetValue(DocName, docTree.name);
                    tns.SetValue(DocID, docTree.id);
                    tns.SetValue(DocType, "Files");
                    tns.ImageIndex = 0;
                    tns.Tag = docTree;
                    GetCentralChild(tns, docTree.id, docTree.all_name);
                    //剪切的当前节点减少
                    this.treeList1.DeleteNode(cutNode);
                }

                this.cutFileItem.Enabled = true;
                this.cutItem.Enabled = true;
                this.copyDocClassItem.Enabled = true;
                this.pasteItem.Enabled = false;
            }
            else if (e.ClickedItem.Name == "copyDocClassItem")
            {
                // 复制文档分类
                this.cutFileItem.Enabled = false;
                this.cutItem.Enabled = false;
                this.copyDocClassItem.Enabled = false;
                this.pasteItem.Enabled = true;
            }
            else if (e.ClickedItem.Name == "expandAllItem")
            {
                // 展开
                node.ExpandAll();
            }
            else if (e.ClickedItem.Name == "collapseAllItem")
            {
                // 折叠
                treeList1.CollapseAll();
            }
            else if (e.ClickedItem.Name == "loadingItem")
            {
                // 加载文档
                //	加载文档是指将该分类的分类和文档呈树形显示供查看其中内容;
            }
            else if (e.ClickedItem.Name == "addDocItem")
            {
                // 录入已有文档
                //	录入已有文档是指将本地已完成的文档录入到PDM系统中;
                document document = new document();
                document.document_type_id = ((document_tree)node.Tag).id;
                document.document_type_name = ((document_tree)node.Tag).all_name;
                DocModify docModify = new DocModify(document, 1);
                if (DialogResult.OK == docModify.ShowDialog())
                {
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docModify.docSave.id, node);
                    tns.SetValue(DocName, docModify.docSave.cn_name);
                    tns.SetValue(DocID, docModify.docSave.id);
                    tns.SetValue(DocType, "Files");
                    tns.Tag = docModify.docSave;
                    // 修改文档成功!
                    MessageBox.Show("创建成功!");
                }

            }
            else if (e.ClickedItem.Name == "importItem")
            {
                // 批量导入文档
                //	文档批量导入是指将本地已完成的多个文档一次录入到PDM系统中;
                DocBulkImport import = new DocBulkImport((document_tree)node.Tag);
                if (DialogResult.OK == import.ShowDialog())
                {
                    // 批量导入成功!
                }
            }
            else if (e.ClickedItem.Name == "downDocItem")
            {
                // 下载
                // 打开文件夹
                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    // 开启socket文件
                    SocketServer s = new SocketServer("127.0.0.1", 7774, dlg.SelectedPath + "\\");
                    s.start();
                    var files = from d in doclist where d.document_type_id != 0 && d.document_type_id == ((document_tree)node.Tag).id select d;
                    if (files.Count() < 1) return;
                    List<document> list = new List<document>();
                    foreach (document st in files)
                    {
                        st.ipaddress = "127.0.0.1";
                        st.port = 7774;
                        list.Add(st);
                    }
                    bool flag = WcfServiceLocator.Create<IDocManageTool>().downDocumentAll(list);
                    while (!(flag && s.flag))
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    s.lisner.Stop();
                    s.TempThread.Abort();
                }
            }
            else if (e.ClickedItem.Name == "updateDocTreeStatusItem")
            {
                // 更新文档状态
                //	更新文档状态是指将该分类下文档状态已改变而显示界面上无变化时,点击改变界面显示;
            }
            else if (e.ClickedItem.Name == "grantDocItem")
            {
                // 发放文档
                //
            }
            else if (e.ClickedItem.Name == "permissionApplyDocItem")
            {
                // 申请权限
            }
            else if (e.ClickedItem.Name == "scanDocGrantRItem")
            {
                // 查看文档发放规则
            }
            else if (e.ClickedItem.Name == "addDocTreeItem")
            {
                // 增加文档分类
                document_tree doct = new document_tree();
                doct.parent_id = ((document_tree)node.Tag).id;
                doct.parent_name = ((document_tree)node.Tag).name;
                BuildDocCategory docCat = new BuildDocCategory(doct, 1);
                if (docCat.ShowDialog() == DialogResult.OK)
                {
                    DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docCat.docTree.id, node);
                    tns.SetValue(DocName, docCat.docTree.name);
                    tns.SetValue(DocID, docCat.docTree.id);
                    tns.SetValue(DocType, "Files");
                    docCat.docTree.all_name = ((document_tree)(node.Tag)).all_name + @"\" + docCat.docTree.name;
                    tns.Tag = docCat.docTree;
                    // 添加成功!
                }
            }
            else if (e.ClickedItem.Name == "updatedocTreeItem")
            {
                // 修改文档分类
                document_tree docType = new document_tree();
                docType.parent_id = ((document_tree)node.Tag).parent_id;
                docType.parent_name = ((document_tree)node.Tag).parent_name;
                docType.id = ((document_tree)node.Tag).id;
                docType.name = ((document_tree)node.Tag).name;
                BuildDocCategory docCat = new BuildDocCategory(docType, 2);
                if (docCat.ShowDialog() == DialogResult.OK)
                {
                    // 修改成功!
                    ((document_tree)node.Tag).name = docCat.docTree.name;
                    node.SetValue(DocName, docCat.docTree.name);
                }
            }
            else if (e.ClickedItem.Name == "delDocTreeItem")
            {
                // 删除文档分类
                if (MessageBox.Show("确认删除?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    bool flag = WcfServiceLocator.Create<IDocManageTool>().delDocumentTree((document_tree)node.Tag);
                    if (flag)
                    {
                        // 删除文件夹
                        this.treeList1.DeleteNode(node);
                    }
                }
            }
            else if (e.ClickedItem.Name == "scanDocTypeItem")
            {
                // 查看文档分类
                document_tree docType = new document_tree();
                docType.parent_id = ((document_tree)node.Tag).parent_id;
                docType.parent_name = ((document_tree)node.Tag).parent_name;
                docType.id = ((document_tree)node.Tag).id;
                docType.name = ((document_tree)node.Tag).name;
                BuildDocCategory docCat = new BuildDocCategory(docType, 3);
                docCat.ShowDialog();

            }
            else if (e.ClickedItem.Name == "execlEmportItem")
            {
                // excel导出

            }
            else if (e.ClickedItem.Name == "userImportItem")
            {
                // 自定义导出

            }
            else if (e.ClickedItem.Name == "docCountStaItem")
            {
                // 文档数量统计,统计该节点下文件的数目
                int count = GetChildNodes(node);
                MessageBox.Show("共有文档" + count + "个");
            }
        }