コード例 #1
0
 public AutodeskFile GetAutodeskFile(string fileName, string ownerName, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
         var fileRepo = new AutodeskFileRepository(context);
         return fileRepo.GetByNameAndOwner(fileName, ownerName);
 }
コード例 #2
0
 public bool AddOrUpdateAutodeskFile(AutodeskFile file, bool overwrite, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
     var fileRepo = new AutodeskFileRepository(context);
     var existingFile = fileRepo.GetByNameAndOwner(file.Name, file.MC_OwnerId);
     if (existingFile == null)
     {
         fileRepo.InsertFile(file);
     }
     else
     {
         existingFile.TypeCatalogHeader = file.TypeCatalogHeader;
         fileRepo.UpdateFile(existingFile);
     }
     return true;
 }
コード例 #3
0
 public bool AddTypeToFile(Item item, string fileName, string owner, BXCModelEntities context = null)
 {
     context = context ?? new BXCModelEntities();
         var fileRepo = new AutodeskFileRepository(context);
         var existingFile = fileRepo.GetByNameAndOwner(fileName, owner);
         if (existingFile != null)
         {
             var itemRepo = new ItemRepository(context);
             var existingItem = itemRepo.GetByNameAndAutodeskFileName(fileName, item.Name, owner);
             if (existingItem == null)
             {
                 fileRepo.AddItem(item, existingFile);
                 return true;
             }
             Log.Error(string.Format("Item Not Added:{0} {1}", item.Name, fileName));
             //Should never occur - Deleting all Items on File update.
         }
         return false;
 }