Exemplo n.º 1
0
 public int CreateDocument(DocumentModel document)
 {
     using (geekinsidekmsEntities context = new geekinsidekmsEntities())
     {
         Document dbDocument = new Document
         {
             CheckerName = "",
             Description = document.Description,
             FileDiskName = document.FileDiskName,
             FileDisplayName = document.FileDisplayName,
             Size = document.Size,
             PubTime = document.PubTime,
             PublisherName = document.PublisherName,
             PublisherNumber = document.PublisherNumber,
             FileTypeId = document.FileTypeId,
             FolderId = document.FolderId,
             AuthLevel = document.AuthLevel
         };
         try
         {
             context.AddToDocuments(dbDocument);
             context.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave);
         }
         catch(Exception e){
             System.Diagnostics.Debug.WriteLine(e.InnerException.Message);
         }
         return dbDocument.Id;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 创建新的 Document 对象。
 /// </summary>
 /// <param name="id">Id 属性的初始值。</param>
 /// <param name="fileDisplayName">FileDisplayName 属性的初始值。</param>
 /// <param name="fileDiskName">FileDiskName 属性的初始值。</param>
 /// <param name="description">Description 属性的初始值。</param>
 /// <param name="folderId">FolderId 属性的初始值。</param>
 /// <param name="fileTypeId">FileTypeId 属性的初始值。</param>
 /// <param name="publisherNumber">PublisherNumber 属性的初始值。</param>
 /// <param name="publisherName">PublisherName 属性的初始值。</param>
 /// <param name="pubTime">PubTime 属性的初始值。</param>
 /// <param name="checkerNumber">CheckerNumber 属性的初始值。</param>
 /// <param name="checkerName">CheckerName 属性的初始值。</param>
 /// <param name="size">Size 属性的初始值。</param>
 /// <param name="viewNumber">ViewNumber 属性的初始值。</param>
 /// <param name="downloadNumber">DownloadNumber 属性的初始值。</param>
 /// <param name="isChecked">IsChecked 属性的初始值。</param>
 /// <param name="authLevel">AuthLevel 属性的初始值。</param>
 public static Document CreateDocument(global::System.Int32 id, global::System.String fileDisplayName, global::System.String fileDiskName, global::System.String description, global::System.Int32 folderId, global::System.Int32 fileTypeId, global::System.Int32 publisherNumber, global::System.String publisherName, global::System.DateTime pubTime, global::System.Int32 checkerNumber, global::System.String checkerName, global::System.String size, global::System.Int32 viewNumber, global::System.Int32 downloadNumber, global::System.Boolean isChecked, global::System.Int32 authLevel)
 {
     Document document = new Document();
     document.Id = id;
     document.FileDisplayName = fileDisplayName;
     document.FileDiskName = fileDiskName;
     document.Description = description;
     document.FolderId = folderId;
     document.FileTypeId = fileTypeId;
     document.PublisherNumber = publisherNumber;
     document.PublisherName = publisherName;
     document.PubTime = pubTime;
     document.CheckerNumber = checkerNumber;
     document.CheckerName = checkerName;
     document.Size = size;
     document.ViewNumber = viewNumber;
     document.DownloadNumber = downloadNumber;
     document.IsChecked = isChecked;
     document.AuthLevel = authLevel;
     return document;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 用于向 Documents EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToDocuments(Document document)
 {
     base.AddObject("Documents", document);
 }