Exemplo n.º 1
0
        /// <summary>
        /// 文档处理处理,包括文档处理及附件处理
        /// </summary>
        private void DocProcess(MailMainBody mailbody, ArrayList upattlist)
        {
            string       DocID = "";
            int          cstRightToApproveDocument = 2;
            ProjectClass pjt     = new ProjectClass();
            DocBody      docbody = new DocBody();

            docbody.DocTitle       = mailbody.MailSubject;
            docbody.DocContent     = mailbody.MailBody;
            docbody.DocAddedBy     = mailbody.MailSender;
            docbody.DocClassID     = mailbody.MailClassID;
            docbody.DocAddedDate   = DateTime.Now.ToString();
            docbody.DocApprover    = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument))?Username:"";
            docbody.DocApproveDate = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument))?DateTime.Now.ToString():"";
            docbody.DocApproved    = (docbody.DocApprover == "")?0:1;
            docbody.DocAttribute   = 0;
            docbody.DocType        = 0;

            DocumentClass doc = new DocumentClass();

            // 添加文档,并返回ID

            DocID = doc.AddDocBody(docbody);
            foreach (UDS.Components.MailAttachFile att in upattlist)
            {
                try
                {
                    DocAttachFile docatt = new DocAttachFile();
                    //  Mail Attach File 类转换为Doc Attach File
                    docatt.FileAttribute  = 0;
                    docatt.FileSize       = att.FileSize;
                    docatt.FileName       = att.FileName;
                    docatt.FileAuthor     = Username;
                    docatt.FileCatlog     = "文档";
                    docatt.FileVisualPath = "Mail" + att.FileVisualPath;
                    docatt.FileAddedDate  = DateTime.Now.ToString();
                    docatt.DocID          = Int32.Parse(DocID);
                    // 转换结束


                    // 附件数据库处理
                    doc.AddAttach(docatt, Int32.Parse(DocID));
                }
                catch (Exception ioex)
                {
                    UDS.Components.Error.Log(ioex.ToString());
                    Server.Transfer("../../Error.aspx");
                }
            }
        }
Exemplo n.º 2
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string        DocID   = "";
            DocBody       docbody = ProcessFormPost();
            DocumentClass doc     = new DocumentClass();

            // 添加文档,并返回ID
            DocID = doc.AddDocBody(docbody);
            ArrayList listattfile = (ArrayList)Session["listattfile"];

            foreach (UDS.Components.DocAttachFile att in listattfile)
            {
                try
                {
                    if (!Directory.Exists(Server.MapPath(".") + "\\AttachFiles\\" + Username))
                    {
                        Directory.CreateDirectory(Server.MapPath(".") + "\\AttachFiles\\" + Username);
                    }

                    //Directory.Move(att.FileVisualPath.ToString().Replace(att.FileName,""),Server.MapPath(".")+"\\AttachFiles\\"+Username+"\\");
                    Random TempNameInt   = new Random();
                    string NewDocDirName = TempNameInt.Next(100000000).ToString();
                    Directory.CreateDirectory(Server.MapPath(".") + "\\AttachFiles\\" + Username + "\\" + NewDocDirName);
                    File.Move(Server.MapPath(".") + "\\" + att.FileVisualPath, Server.MapPath(".") + "\\AttachFiles\\" + Username + "\\" + NewDocDirName + "\\" + att.FileName);
                    Directory.Delete(Server.MapPath(".") + "\\" + att.FileVisualPath.ToString().Replace(att.FileName, ""), true);
                    att.FileVisualPath = "\\AttachFiles\\" + Username + "\\" + NewDocDirName + "\\" + att.FileName;
                    att.FileAddedDate  = DateTime.Now.ToString();
                    // 附件数据库处理
                    doc.AddAttach(att, Int32.Parse(DocID));
                }
                catch (Exception ioex)
                {
                    UDS.Components.Error.Log(ioex.ToString());
                    Server.Transfer("../../Error.aspx");
                }
            }
            Response.Write("<script language=javascript>alert('文档提交成功!');self.location='../Switch.aspx?Action=1&ClassID=" + ClassID + "';</script>");
        }
Exemplo n.º 3
0
        public void MailIncoming(string MailID, string ClassID)
        {
            SqlDataReader dataReader = null;

            if (MailID != "" && ClassID != "")
            {
                try
                {
                    throw new Exception("错误测试");

                    String        Username  = Request.Cookies["Username"].Value.ToString();
                    MailClass     mailclass = new MailClass();
                    ProjectClass  pjt       = new ProjectClass();
                    DocBody       docbody   = new DocBody();
                    DocumentClass doc       = new DocumentClass();

                    dataReader = mailclass.GetMailCompleteInfoDbreader(MailID);
                    if (dataReader.Read())
                    {
                        int cstRightToApproveDocument = 2;

                        docbody.DocTitle       = dataReader["MailSubject"].ToString();
                        docbody.DocContent     = dataReader["MailBody"].ToString();;
                        docbody.DocAddedBy     = dataReader["MailSender"].ToString();;
                        docbody.DocClassID     = Int32.Parse(ClassID);
                        docbody.DocAddedDate   = DateTime.Now.ToString();
                        docbody.DocApprover    = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument)) ? Username : "";
                        docbody.DocApproveDate = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument)) ? DateTime.Now.ToString() : "";
                        docbody.DocApproved    = (docbody.DocApprover == "") ? 0 : 1;
                        docbody.DocAttribute   = 0;
                        docbody.DocType        = 0;
                    }
                    dataReader.Close();
                    string DocID = doc.AddDocBody(docbody);

                    dataReader = mailclass.GetMailAttInfoDbreader(MailID);
                    while (dataReader.Read())
                    {
                        DocAttachFile docatt = new DocAttachFile();
                        docatt.FileAttribute  = 0;
                        docatt.FileSize       = Int32.Parse(dataReader["FileSize"].ToString());
                        docatt.FileName       = dataReader["FileName"].ToString();
                        docatt.FileAuthor     = Username;
                        docatt.FileCatlog     = "文档";
                        docatt.FileVisualPath = "Mail" + dataReader["FileVisualPath"].ToString();
                        docatt.FileAddedDate  = DateTime.Now.ToString();
                        docatt.DocID          = Int32.Parse(DocID);
                        doc.AddAttach(docatt, Int32.Parse(DocID));
                    }


                    dataReader = null;
                    pjt        = null;
                    docbody    = null;
                }
                catch (Exception oe)
                {
                    throw new Exception(oe.Message);
                }
                finally
                {
                    if (null != dataReader)
                    {
                        if (!dataReader.IsClosed)
                        {
                            dataReader.Close();
                        }
                    }
                }
            }
        }