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>");
        }
Exemple #2
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();
                        }
                }
            }
        }
Exemple #3
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");
                }
            }
        }
Exemple #4
0
        public void MailIncoming(string MailID,string ClassID)
        {
            if(MailID!=""&&ClassID!="")
            {
                SqlDataReader dataReader = null;
                try
                {
                    String Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
                    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;
                    if (dataReader != null)
                    {
                        dataReader.Close();
                    }
                    pjt = null;
                    docbody = null;

                    Response.Write("<script language=javascript>alert('�鵵�ɹ�!');</script>");
                }
                catch (Exception oe)
                {
                    UDS.Components.Error.Log(oe.ToString());
                    Server.Transfer("../Error.aspx");
                }
                finally
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                    }
                }
            }
        }