Ejemplo n.º 1
0
 //生成最终的DocumentModelList 公用
 private List<DocumentModel> gernerateFinalDocumentModelList(List<DAL.Document> docTempList)
 {
     List<DocumentModel> docList = new List<DocumentModel>();
     foreach (DAL.Document doc in docTempList)
     {
         List<TagModel> tagIdArray = new DALTag().getTagModelListByDocId(doc.Id);
         docList.Add(new DocumentModel
         {
             Id = doc.Id,
             FileDisplayName = doc.FileDisplayName,
             FileDiskName = doc.FileDiskName,
             Description = doc.Description,
             FileTagIdArray = tagIdArray,
             FolderId = doc.FolderId,
             FileTypeId = doc.FileTypeId,
             FileTypeName = doc.FileTypeReference.Value.TypeName,
             PublisherNumber = doc.PublisherNumber,
             PublisherName = doc.PublisherName,
             PubTime = doc.PubTime,
             CheckerNumber = doc.CheckerNumber,
             CheckerName = doc.CheckerName,
             Size = doc.Size,
             ViewNumber = doc.ViewNumber,
             DownloadNumber = doc.DownloadNumber,
             IsChecked = doc.IsChecked,
             AuthLevel = doc.AuthLevel
         });
     }
     return docList;
 }
Ejemplo n.º 2
0
 public DocumentModel getDocumentById(int id)
 {
     using (var gikms = new geekinsidekmsEntities())
     {
         Document dbDocs = (from d in gikms.Documents
                            where d.Id.Equals(id)
                            select d).FirstOrDefault();
         if (dbDocs == null)
         {
             return null;
         }
         List<TagModel> tagIdArray = new DALTag().getTagModelListByDocId(dbDocs.Id);
         return new DocumentModel
         {
             Id = dbDocs.Id,
             FileDisplayName = dbDocs.FileDisplayName,
             FileDiskName = dbDocs.FileDiskName,
             Description = dbDocs.Description,
             FileTagIdArray = tagIdArray,
             FolderId = dbDocs.FolderId,
             FileTypeId = dbDocs.FileTypeId,
             FileTypeName = dbDocs.FileTypeReference.Value.TypeName,
             PublisherNumber = dbDocs.PublisherNumber,
             PublisherName = dbDocs.PublisherName,
             PubTime = dbDocs.PubTime,
             CheckerNumber = dbDocs.CheckerNumber,
             CheckerName = dbDocs.CheckerName,
             Size = dbDocs.Size,
             ViewNumber = dbDocs.ViewNumber,
             DownloadNumber = dbDocs.DownloadNumber,
             IsChecked = dbDocs.IsChecked,
             AuthLevel = dbDocs.AuthLevel
          };
     }
 }