文档管理系统需要的方法
Inheritance: IFileHelper
Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        //自动生成文件类型的选项
        private void setCheckFileType()
        {
            DataTable dtTemp = new FileHelper().getDataTableBySql("distinct upper(DFL_FILE_EXTEND) as ext", "", "DOC_FILE_LIST ORDER BY EXT ASC");
            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                ///添加checkbox控件
                CheckBox chkBoxExt = null;
                int x = 15;
                int y = 19;
                int count = 1;
                chkBoxExt = new CheckBox();
                chkBoxExt.Location = new System.Drawing.Point(x, y);
                chkBoxExt.Name = "ALL";
                chkBoxExt.Size = new System.Drawing.Size(78, 16);
                chkBoxExt.Text = "ALL";
                chkBoxExt.UseVisualStyleBackColor = true;
                chkBoxExt.Visible = true;
                chkBoxExt.Checked = false;
                this.pnlFileExt.Controls.Add(chkBoxExt);
                x += 90;
                foreach (DataRow row in dtTemp.Rows)
                {
                    chkBoxExt = new CheckBox();

                    chkBoxExt.Location = new System.Drawing.Point(x, y);
                    chkBoxExt.Name = row["ext"].ToString();
                    chkBoxExt.Size = new System.Drawing.Size(78, 16);
                    chkBoxExt.Text = row["ext"].ToString();
                    chkBoxExt.UseVisualStyleBackColor = true;
                    chkBoxExt.Visible = true;

                    count += 1;
                    if (count % 3 == 0)
                    {
                        x = 15;
                        y += 28;
                    }
                    else
                    {
                        x += 90;
                    }
                    this.pnlFileExt.Controls.Add(chkBoxExt);
                }
            }
            this.txtName.Focus();
            this.txtName.SelectAll();
        }
Esempio n. 3
0
        /// <summary>
        /// 检入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCheckIN_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            if (txtFileName.Text.Trim() == string.Empty || txtFilePath.Text.Trim() == string.Empty)
            {
                MessageBox.Show("文件名或文件路径不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                //Boolean result = true;
                //Util.FTPHelper helper = Util.Common.FtpHepler();
                //var info = "";
                //var result = helper.UploadFile(txtFilePath.Text, out info);

                try
                {
                    string filePath = this.txtFilePath.Text.ToString();
                    int i = filePath.LastIndexOf(@"\");
                    if (i == -1)
                    {
                        i = filePath.LastIndexOf(@"/");
                    }
                    filePath = filePath.Substring(0, i) + @"\" + this.txtFileName.Text.ToString();

                    string tempNewFileName = this.txtFileName.Text.ToString();

                    tempNewFileName = tempNewFileName.Substring(0, tempNewFileName.LastIndexOf(@".")) + DocFileEntity.DFL_VER_LATEST + tempNewFileName.Substring(tempNewFileName.LastIndexOf(@"."));

                    //  MessageBox.Show(filePath);
                    string serPathAndFileName = new FileHelper().getDocumentAllPathByPathID(DocFileEntity.DFL_FILE_CHILD_PATH) + this.txtFileName.Text.ToString();
                    FileSockClient.CopyOldVerFile hh = new FileSockClient.CopyOldVerFile(serPathAndFileName, tempNewFileName); //复制旧版本数据到Vers目录下
                    if (!hh.AckStatus)
                    {
                        FileServerAckReult = hh.AckStatus;
                        this.DialogResult = DialogResult.OK;
                        return;
                    }
                    //上传更新文件覆盖旧文件
                    FileSockClient.UpLoadFileSocketClient upload = new FileSockClient.UpLoadFileSocketClient(filePath, new FileHelper().getDocumentAllPathByPathID(DocFileEntity.DFL_FILE_CHILD_PATH), true);
                    if (!upload.AckStatus)
                    {
                        FileServerAckReult = upload.AckStatus;
                        this.DialogResult = DialogResult.OK;
                        return;
                    }

                }
                catch (Exception ex)
                {
                    FileServerAckReult = false;
                    this.DialogResult = DialogResult.No;
                    MessageBox.Show(ex.Message.ToString());
                }

                //if (result)
                //{
                //    MessageBox.Show("文件检入成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
                //else
                //{
                //    this.DialogResult = DialogResult.No;
                //    MessageBox.Show("文件检入失败,具体原因为:" + info, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);

                //}

            }
        }
Esempio n. 4
0
        private void pnlFind_Click(object sender, EventArgs e)
        {
            StringBuilder stbQuery = new StringBuilder();
            //stbQuery.Append("SELECT DFL_ID,DFL_FILE_NAME,DFL_FILE_EXTEND,DFL_FILE_CHILD_PATH");
            //stbQuery.Append(" FROM DOC_FILE_LIST");
            stbQuery.Append("WHERE DEL_FLAG='N'");
            CheckBox chkAll = null;
            StringBuilder strFileExt = new StringBuilder();
            if (this.chkFileType.Checked == true)
            {
                foreach (Control ctl in this.pnlFileExt.Controls)
                {
                    // MessageBox.Show(ctl.GetType().Name.ToString());
                    if (ctl.GetType().Name.ToString() == "CheckBox")
                    {
                        if (((CheckBox)ctl).Checked == true)
                        {
                            if (((CheckBox)ctl).Name == "ALL")
                            {
                                chkAll = (CheckBox)ctl;
                                return;
                            }
                            strFileExt.Append("'").Append(((CheckBox)ctl).Name.ToString()).Append("',");
                        }
                    }
                }
            }
            else
            {
                if (this.txtName.Text.ToString().Trim() == "")
                {
                    MessageBox.Show("请输入文件名称!", "查询助手提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    this.txtName.Focus();
                    return;
                }
            }

            if (this.txtName.Text.ToString().Trim() != "")
            {
                stbQuery.Append(" AND DFL_FILE_NAME LIKE '").Append("%").Append(this.txtName.Text).Append("%'");
            }

            if (this.chkFileType.Checked == true)
            {
                if (chkAll != null && chkAll.Name.ToString() == "ALL")
                {
                    //为ALL标识不区分后缀
                }
                else
                {
                    if (strFileExt == null || strFileExt.Length == 0)
                    {
                        MessageBox.Show("请选择文件类别!", "查询助手提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                        return;
                    }
                    else
                    {
                        strFileExt.Remove(strFileExt.Length - 1, 1);
                        strFileExt.Insert(0, "(").Append(")");
                        stbQuery.Append(" AND upper(DFL_FILE_EXTEND) IN ").Append(strFileExt.ToString());
                    }
                }
            }
            //MessageBox.Show(strFileExt.ToString());
            //stbQuery.Append(" AND upper(DFL_FILE_EXTEND) IN ").Append(strFileExt.ToString());
            //查询生成树
            DataTable dtDocFileList = new FileHelper().getDataTableBySql("DFL_ID,DFL_FILE_NAME,DFL_FILE_EXTEND,DFL_FILE_CHILD_PATH", stbQuery.ToString(), "DOC_FILE_LIST");
            if (dtDocFileList.Rows.Count == 0)
            {
                MessageBox.Show("没有查询到你需要的信息!!", "查询助手提示您:", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                this.trvDocumentList.Nodes.Clear();
                return;
            }
            this.trvDocumentList.Nodes.Clear();
            fileHelper.getTreeViewByDocFileList(this.trvDocumentList, dtDocFileList);
            trvDocumentList.ExpandAll();

            //}
        }