Example #1
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (this.blAddFlg == true)
            {
                if (addChecking())
                {
                    //添加
                    IDocumentDirService _docService = ServiceContainer.GetService <DocumentDirService>();
                    bool         ok  = false;
                    DOC_FILE_DIR dir = new DOC_FILE_DIR();
                    dir.DFD_ID            = Guid.NewGuid().ToString();
                    dir.DFD_ROOT_DIR      = null;
                    dir.DFD_PATH_NAME     = this.txtNewFolder.Text.ToString();
                    dir.DFD_PARENT_DIR_ID = saveFileKey;//
                    dir.DEL_FLAG          = "N";

                    ok = _docService.addDocumentDir(dir);
                    if (ok == true)
                    {
                        FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("add", new FileHelper().getDocumentAllPathByPathID(dir.DFD_ID.ToString()), "");
                        if (folder.AckStatus)
                        {
                            MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            this.Close();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            else
            {
                //修改
                if (modifyChecking())
                {
                    DOC_FILE_DIR        doc  = new DOC_FILE_DIR();
                    IDocumentDirService docS = ServiceContainer.GetService <DocumentDirService>();
                    Boolean             ok   = false;
                    doc = docS.findDoc(saveFileKey);
                    string oldPath = new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString());
                    doc.DFD_PATH_NAME = this.txtNewFolder.Text.Trim();
                    ok = docS.updateDocumentDir(doc);
                    if (ok == true)
                    {
                        FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("modify", oldPath, new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString()));
                        if (folder.AckStatus)
                        {
                            MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            this.Close();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    }
                }
            }
        }
Example #2
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (this.blAddFlg == true)
            {
                if (addChecking())
                {
                    //添加
                    IDocumentDirService _docService = ServiceContainer.GetService<DocumentDirService>();
                    bool ok = false;
                    DOC_FILE_DIR dir = new DOC_FILE_DIR();
                    dir.DFD_ID = Guid.NewGuid().ToString();
                    dir.DFD_ROOT_DIR = null;
                    dir.DFD_PATH_NAME = this.txtNewFolder.Text.ToString();
                    dir.DFD_PARENT_DIR_ID = saveFileKey;//
                    dir.DEL_FLAG = "N";

                    ok = _docService.addDocumentDir(dir);
                    if (ok == true)
                    {
                        FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("add", new FileHelper().getDocumentAllPathByPathID(dir.DFD_ID.ToString()), "");
                        if (folder.AckStatus)
                        {
                            MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            this.Close();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("添加失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            else
            {
                //修改
                if (modifyChecking())
                {
                    DOC_FILE_DIR doc = new DOC_FILE_DIR();
                    IDocumentDirService docS = ServiceContainer.GetService<DocumentDirService>();
                    Boolean ok = false;
                    doc = docS.findDoc(saveFileKey);
                    string oldPath = new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString());
                    doc.DFD_PATH_NAME = this.txtNewFolder.Text.Trim();
                    ok = docS.updateDocumentDir(doc);
                    if (ok == true)
                    {
                        FileSockClient.FolderOperSocketClient folder = new FileSockClient.FolderOperSocketClient("modify", oldPath, new FileHelper().getDocumentAllPathByPathID(doc.DFD_ID.ToString()));
                        if (folder.AckStatus)
                        {
                            MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            this.Close();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    }
                }

            }
        }