コード例 #1
0
 /// <summary>
 /// 创建文档数据。
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public Document CreateDocument(HttpContext context)
 {
     Document doc = null;
     GUIDEx fileID = this.GetDocumentID(context);
     if (fileID.IsValid)
     {
         HttpRequest request = context.Request;
         doc = new Document();
         doc.FileID = fileID;
         doc.ContentType = request.ContentType;
         doc.UserInfo = context.Handler as IUser;
         using (Stream dataStream = request.InputStream)
         {
             byte[] data = new byte[request.ContentLength];
             dataStream.Read(data, 0, data.Length);
             doc.Content = data;
             dataStream.Close();
         }
     }
     return doc;
 }
コード例 #2
0
 /// <summary>
 /// 修改文档内容。
 /// </summary>
 /// <param name="document"></param>
 public void ModifyDocumentContent(Document document)
 {
     this.documentHandler.ModifyDocumentContent(document);
 }
コード例 #3
0
 ///<summary>
 /// 获取文档数据。
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public Document GetDocument(HttpContext context)
 {
     GUIDEx fileID = this.GetDocumentID(context);
     Document doc = null;
     if (fileID.IsValid)
     {
         doc = new Document();
         doc.FileID = fileID;
         string fileName = null, contentType = null;
         doc.Content = this.storageFactory.Download(doc.FileID); //this.storageFactory.Download(doc.FileID, out fileName, out contentType);
         doc.FileName = fileName;
         doc.ContentType = contentType;
         doc.UserInfo = context.Handler as IUser;
     }
     return doc;
 }
コード例 #4
0
 /// <summary>
 /// 修改文档内容。
 /// </summary>
 /// <param name="document"></param>
 public void ModifyDocumentContent(Document document)
 {
     if (document != null && document.FileID.IsValid && document.Content != null)
     {
         //this.storageFactory.Upload(document.FileID, document.FileName, document.ContentType, document.Content);
         this.storageFactory.Upload(document.FileID, 0, document.Content);
     }
 }