Пример #1
0
        private void tspViewFile_Click(object sender, EventArgs e)
        {
            if (chkIsFile())
            {
                IAccount LoginInfo            = EAS.Application.Instance.Session.Client as IAccount;
                HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper();
                Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string fileName    = this.trvDocumentList.SelectedNode.Text.ToString();
                string swfFileName = System.IO.Path.GetFileNameWithoutExtension(fileName) + @".swf";
                //下载文件
                try
                {
                    FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(ViewFilePath + swfFileName, this.SaveTempPath + swfFileName);
                    if (!downSocket.AckStatus)
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("下载数据异常!:" + ex.Message.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }

                if (tspInView.Checked)
                {
                    // this.webB.Navigate(@"D:\swf\文件权限管理.swf");
                    this.webB.Navigate(this.SaveTempPath + swfFileName);
                }
                else
                {
                    ViewFileFrm fileView = new ViewFileFrm();
                    //  fileView.FileName = "文件权限管理.swf";
                    fileView.FileName = swfFileName;
                    // fileView.ViewFilePath = @"D:\swf\";
                    fileView.ViewFilePath = this.SaveTempPath;
                    fileView.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
Пример #2
0
        private void tspFileDownLoad_Click(object sender, EventArgs e)
        {
            string serverpath = "";

            if (chkIsFile())
            {
                IAccount LoginInfo            = EAS.Application.Instance.Session.Client as IAccount;
                HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper();
                TreeNode node = this.trvDocumentList.SelectedNode;
                string   dd   = node.Text;
                string   ee   = node.Tag.ToString();

                Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    SaveFileDialog saveDialog = new SaveFileDialog();
                    saveDialog.FileName = this.trvDocumentList.SelectedNode.Text.ToString();
                    saveDialog.Filter   = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                    DialogResult res = saveDialog.ShowDialog();
                    if (DialogResult.OK == res)
                    {
                        string clientSaveFileAndPath = saveDialog.FileName.ToString();
                        serverpath = file.getDocumentAllPathByFileID(this.trvDocumentList.SelectedNode.Tag.ToString()) + this.trvDocumentList.SelectedNode.Text.ToString();
                        //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString());
                        FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath);
                    }
                    else
                    {
                        MessageBox.Show("请选择需要下载的文件" + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                //ViewFileFrm fileView = new ViewFileFrm();
                //fileView.FileName = "文件名称.txt";
                //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf";
                //fileView.ShowDialog();
            }
            else
            {
                MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
Пример #3
0
        /// <summary>
        /// 检出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDetect_Click(object sender, EventArgs e)
        {
            if (txtFileName.Text.Trim() == string.Empty || txtFilePath.Text.Trim() == string.Empty)
            {
                MessageBox.Show("文件名或文件路径不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                //Util.FTPHelper helper = Util.Common.FtpHepler();
                var info = "";
                //var result = helper.DownloadFile(txtFilePath.Text, txtFileName.Text, out info);

               // MessageBox.Show(this.txtFilePath.Text.ToString() + @"\" + this.txtFileName.Text.ToString());
                ///下载文件并存放到指定的本地文件夹中
                 HYDocumentMS.IFileHelper fileHelper=new  FileHelper();
                string srvFilePath=fileHelper.getDocumentAllPathByPathID(DocFileEntity.DFL_FILE_CHILD_PATH)+this.txtFileName.Text.ToString();
                FileSockClient.DownLoadFileSocketClient down = new FileSockClient.DownLoadFileSocketClient(srvFilePath, this.txtFilePath.Text.ToString() +@"\"+ this.txtFileName.Text.ToString());

                FileServerAckResult = down.AckStatus;

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #4
0
        /// <summary>
        /// 检出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDetect_Click(object sender, EventArgs e)
        {
            if (txtFileName.Text.Trim() == string.Empty || txtFilePath.Text.Trim() == string.Empty)
            {
                MessageBox.Show("文件名或文件路径不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                //Util.FTPHelper helper = Util.Common.FtpHepler();
                var info = "";
                //var result = helper.DownloadFile(txtFilePath.Text, txtFileName.Text, out info);

                // MessageBox.Show(this.txtFilePath.Text.ToString() + @"\" + this.txtFileName.Text.ToString());
                ///下载文件并存放到指定的本地文件夹中
                HYDocumentMS.IFileHelper fileHelper = new  FileHelper();
                string srvFilePath = fileHelper.getDocumentAllPathByPathID(DocFileEntity.DFL_FILE_CHILD_PATH) + this.txtFileName.Text.ToString();
                FileSockClient.DownLoadFileSocketClient down = new FileSockClient.DownLoadFileSocketClient(srvFilePath, this.txtFilePath.Text.ToString() + @"\" + this.txtFileName.Text.ToString());

                FileServerAckResult = down.AckStatus;

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #5
0
        /// <summary>
        /// 文件下载
        /// </summary>
        private void downLoadFile(TreeGridView tgv, DataType.FileType fileType)
        {
            TreeGridNode node = null;//当前选择的节点
            String serverpath = "";
            node = new TreeGridNode();
            //node = this.tvFileList.CurrentNode;
            node = tgv.CurrentNode;
            int index = node.RowIndex;

            if (index <= 0)
            {
                MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (tgv.CurrentRow == null)
            {
                MessageBox.Show("请选择需要下载的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {

                HYDocumentMS.IFileHelper file = new FileHelper();
                Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.FileName = node.Cells[0].Value.ToString();
                //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                string suffix = node.Cells[0].Value.ToString().Substring(node.Cells[0].Value.ToString().LastIndexOf(@".") + 1);
                saveDialog.Filter = @"文件 (*." + suffix + ")|*." + suffix;
                DialogResult res = saveDialog.ShowDialog();

                //SaveFileDialog saveDialog = new SaveFileDialog();
                //saveDialog.FileName = node.Cells[0].Value.ToString();
                //saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                //DialogResult res = saveDialog.ShowDialog();
                if (DialogResult.OK == res)
                {
                    string clientSaveFileAndPath = saveDialog.FileName.ToString();
                    //MessageBox.Show(clientSavepath);

                    // MessageBox.Show(index.ToString());
                    if (index > 0) //取消第一行
                    {
                        serverpath = node.Cells[1].Value.ToString() + node.Cells[0].Value.ToString();
                        //  MessageBox.Show(serverpath);

                        //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString());
                        FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath);
                        if (!downSocket.AckStatus)
                        {
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            //  this.tvFileList.CurrentRow
        }
Пример #6
0
        //private void btnFileDown_Click(object sender, EventArgs e)
        //{
        //    ///工艺文件下载
        //    downLoadFile(this.tvFileList, DataType.FileType.ProcessFile);
        //}

        /// <summary>
        /// 文件下载
        /// </summary>
        private void downLoadFile(TreeGridView tgv, DataType.FileType fileType)
        {
            TreeGridNode node       = null;//当前选择的节点
            String       serverpath = "";

            node = new TreeGridNode();
            //node = this.tvFileList.CurrentNode;
            node = tgv.CurrentNode;
            int index = node.RowIndex;

            if (index <= 0)
            {
                MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (tgv.CurrentRow == null)
            {
                MessageBox.Show("请选择需要下载的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                HYDocumentMS.IFileHelper file = new FileHelper();

                Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, tgv.CurrentRow.Cells["DFL_ID"].Value.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.FileName = node.Cells[0].Value.ToString();
                saveDialog.Filter   = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                DialogResult res = saveDialog.ShowDialog();
                if (DialogResult.OK == res)
                {
                    string clientSaveFileAndPath = saveDialog.FileName.ToString();
                    //MessageBox.Show(clientSavepath);


                    // MessageBox.Show(index.ToString());
                    if (index > 0) //取消第一行
                    {
                        serverpath = node.Cells[1].Value.ToString() + node.Cells[0].Value.ToString();
                        //  MessageBox.Show(serverpath);

                        //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString());
                        FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath);
                        if (!downSocket.AckStatus)
                        {
                            return;
                        }
                        else
                        {
                            MessageBox.Show("下载成功,保存路径:" + "\n" + clientSaveFileAndPath, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择需要下载的文件" + "(" + index + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            //  this.tvFileList.CurrentRow
        }
Пример #7
0
        private void tspViewFile_Click(object sender, EventArgs e)
        {
            if (chkIsFile())
            {

                IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount;
                HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper();
                Boolean bl = file.isHasAuth(DataType.AuthParmsType.View, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限查看此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string fileName = this.trvDocumentList.SelectedNode.Text.ToString();
                string swfFileName = System.IO.Path.GetFileNameWithoutExtension(fileName) + @".swf";
                //下载文件
                try
                {
                    FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(ViewFilePath + swfFileName, this.SaveTempPath + swfFileName);
                    if (!downSocket.AckStatus)
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("下载数据异常!:" + ex.Message.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    return;
                }

                if (tspInView.Checked)
                {
                   // this.webB.Navigate(@"D:\swf\文件权限管理.swf");
                    this.webB.Navigate(this.SaveTempPath + swfFileName);
                }
                else
                {
                    ViewFileFrm fileView = new ViewFileFrm();
                  //  fileView.FileName = "文件权限管理.swf";
                    fileView.FileName = swfFileName;
                   // fileView.ViewFilePath = @"D:\swf\";
                    fileView.ViewFilePath = this.SaveTempPath;
                    fileView.ShowDialog();
                }

            }
            else
            {
                MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }
Пример #8
0
        private void tspFileDownLoad_Click(object sender, EventArgs e)
        {
            string serverpath = "";
            if (chkIsFile())
            {
                IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount;
                HYDocumentMS.IFileHelper file = new HYDocumentMS.FileHelper();
                TreeNode node = this.trvDocumentList.SelectedNode;
                string dd = node.Text;
                string ee = node.Tag.ToString();

                Boolean bl = file.isHasAuth(DataType.AuthParmsType.DownLoad, LoginInfo.LoginID, this.trvDocumentList.SelectedNode.Tag.ToString());
                if (bl == false)
                {
                    MessageBox.Show("你没有权限下载此文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    SaveFileDialog saveDialog = new SaveFileDialog();
                    saveDialog.FileName = this.trvDocumentList.SelectedNode.Text.ToString();
                    saveDialog.Filter = @"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
                    DialogResult res = saveDialog.ShowDialog();
                    if (DialogResult.OK == res)
                    {
                        string clientSaveFileAndPath = saveDialog.FileName.ToString();
                        serverpath = file.getDocumentAllPathByFileID(this.trvDocumentList.SelectedNode.Tag.ToString()) + this.trvDocumentList.SelectedNode.Text.ToString();
                        //FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, @"C:\\" + node.Cells[0].Value.ToString());
                        FileSockClient.DownLoadFileSocketClient downSocket = new FileSockClient.DownLoadFileSocketClient(serverpath, clientSaveFileAndPath);
                    }
                    else
                    {
                        MessageBox.Show("请选择需要下载的文件" + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                //ViewFileFrm fileView = new ViewFileFrm();
                //fileView.FileName = "文件名称.txt";
                //fileView.ViewFilePathAndName = @"D:\swf\Java网络编程精解.swf";
                //fileView.ShowDialog();
            }
            else
            {
                MessageBox.Show("请在窗体左边的清单中选择需要预览的文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            }
        }