/// <summary> /// 文件主体添加 /// </summary> /// <param name="DocBody"> 文件主体类</param> public string AddDocBody(DocBody docbody) { // create data object and params Database data = new Database(); string DocID = ""; SqlParameter[] prams = { data.MakeInParam("@ClassID", SqlDbType.Int, 20, docbody.DocClassID), data.MakeInParam("@DocTitle", SqlDbType.NVarChar, 300, docbody.DocTitle), data.MakeInParam("@DocContent", SqlDbType.NVarChar, 5000, docbody.DocContent), data.MakeInParam("@DocApprover", SqlDbType.NVarChar, 200, docbody.DocApprover), data.MakeInParam("@DocApproveDate", SqlDbType.NVarChar, 20, docbody.DocApproveDate), data.MakeInParam("@DocApproved", SqlDbType.Int, 1, docbody.DocApproved), data.MakeInParam("@DocType", SqlDbType.Int, 2, docbody.DocType), data.MakeInParam("@DocAttribute", SqlDbType.Int, 2, docbody.DocAttribute), data.MakeInParam("@DocAddedBy", SqlDbType.NVarChar, 300, docbody.DocAddedBy), data.MakeInParam("@DocAddedDate", SqlDbType.DateTime, 300, DateTime.Parse(docbody.DocAddedDate)), data.MakeOutParam("@CurrentDocID", SqlDbType.Int, 2) }; try { data.RunProc("SP_Ext_AddDocument", prams); DocID = prams[10].Value.ToString(); if (DocID == string.Empty) { return(null); } else { return(DocID); } } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("文档正文增加错误!", ex); } }
/// <summary> /// �ļ�������� /// </summary> /// <param name="DocBody"> �ļ�������</param> public string AddDocBody(DocBody docbody) { // create data object and params Database data = new Database(); string DocID = ""; SqlParameter[] prams = { data.MakeInParam("@ClassID", SqlDbType.Int, 20, docbody.DocClassID), data.MakeInParam("@DocTitle", SqlDbType.NVarChar, 300, docbody.DocTitle), data.MakeInParam("@DocContent",SqlDbType.NText, 8000,docbody.DocContent), data.MakeInParam("@DocApprover", SqlDbType.NVarChar,200, docbody.DocApprover), data.MakeInParam("@DocApproveDate", SqlDbType.NVarChar, 20, docbody.DocApproveDate), data.MakeInParam("@DocApproved", SqlDbType.Int, 1, docbody.DocApproved), data.MakeInParam("@DocType", SqlDbType.Int, 2, docbody.DocType), data.MakeInParam("@DocAttribute", SqlDbType.Int , 2, docbody.DocAttribute), data.MakeInParam("@DocAddedBy", SqlDbType.NVarChar, 300, docbody.DocAddedBy), data.MakeInParam("@DocAddedDate", SqlDbType.DateTime, 300,DateTime.Parse(docbody.DocAddedDate)), data.MakeOutParam("@CurrentDocID", SqlDbType.Int, 2) }; try { data.RunProc("SP_Ext_AddDocument", prams); DocID = prams[10].Value.ToString(); if (DocID == string.Empty ) return null; else return DocID; } catch (Exception ex) { Error.Log(ex.ToString()); throw new Exception("�ĵ��������Ӵ���!",ex); } finally { if (data != null) { data.Close(); data.Dispose(); } } }
/// <summary> /// ������post���� /// </summary> private DocBody ProcessFormPost() { ProjectClass pjt = new ProjectClass (); int cstRightToApproveDocument = 2; //����֤ if(Request.IsAuthenticated) { // ���������ݲ��� DocBody docbody = new DocBody(); docbody.DocTitle = this.txtTitle.Value; docbody.DocContent = this.txtContent.Value; docbody.DocAddedBy = Username; 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; return docbody; } else { return null; } }
/// <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"); } } }
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(); } } } }
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(); } } } }