Beispiel #1
0
 /// <summary>
 /// </summary>
 /// <returns></returns>
 public static FolderContentWrapper GetSample()
 {
     return(new FolderContentWrapper()
     {
         Current = FolderWrapper.GetSample(),
         Files = new List <FileWrapper>(new[] { FileWrapper.GetSample(), FileWrapper.GetSample() }),
         Folders = new List <FolderWrapper>(new[] { FolderWrapper.GetSample(), FolderWrapper.GetSample() }),
         PathParts = new
         {
             key = "Key",
             path = "//path//to//folder"
         }
     });
 }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public static FolderContentWrapper <int> GetSample()
        {
            return(new FolderContentWrapper <int>
            {
                Current = FolderWrapper <int> .GetSample(),
                Files = new List <FileWrapper <int> >(new[] { FileWrapper <int> .GetSample(), FileWrapper <int> .GetSample() }),
                Folders = new List <FileEntryWrapper>(new[] { FolderWrapper <int> .GetSample(), FolderWrapper <int> .GetSample() }),
                PathParts = new
                {
                    key = "Key",
                    path = "//path//to//folder"
                },

                StartIndex = 0,
                Count = 4,
                Total = 4,
            });
        }
 /// <summary>
 /// </summary>
 /// <returns></returns>
 public static FileOperationWraper GetSample()
 {
     return(new FileOperationWraper
     {
         Id = Guid.NewGuid().ToString(),
         OperationType = FileOperationType.Move,
         Progress = 100,
         //Source = "folder_1,file_1",
         //Result = "folder_1,file_1",
         Error = "",
         Processed = "1",
         Files = new List <FileWrapper> {
             FileWrapper.GetSample()
         },
         Folders = new List <FolderWrapper> {
             FolderWrapper.GetSample()
         }
     });
 }
        public FileWrapper DeleteCRMFile(int fileid)
        {
            if (fileid < 0)
                throw new ArgumentException();

            var file = FilesDaoFactory.GetFileDao().GetFile(fileid);

            if (file == null)
                throw new ItemNotFoundException();
          
            var result = new FileWrapper(file);

            DaoFactory.GetRelationshipEventDao().RemoveFile(file);

            return result;
        }
        public FileWrapper DeleteCRMFile(int fileid)
        {
            if (fileid < 0) throw new ArgumentException();

            var file = FilesDaoFactory.GetFileDao().GetFile(fileid);
            if (file == null) throw new ItemNotFoundException();
            var result = new FileWrapper(file);

            var _eventsDao = DaoFactory.GetRelationshipEventDao();
            var eventIDs = _eventsDao.RemoveFile(file);
            var events = new List<RelationshipEvent>();

            eventIDs.ForEach(id => events.Add(_eventsDao.GetByID(id)));

            foreach (var evt in events)
            {
                var entityTitle = evt.ContactID > 0
                                  ? DaoFactory.GetContactDao().GetByID(evt.ContactID).GetTitle()
                                  : GetEntityTitle(evt.EntityType, evt.EntityID);
                var messageAction = GetFilesDetachAction(evt.EntityType, evt.ContactID);

                MessageService.Send(Request, messageAction, entityTitle, file.Title);
            }

            return result;
        }
        public FileWrapper DeleteCRMFile(int fileid)
        {
            if (fileid < 0) throw new ArgumentException();

            var file = FilesDaoFactory.GetFileDao().GetFile(fileid);
            if (file == null) throw new ItemNotFoundException();
            var result = new FileWrapper(file);

            var _eventsDao = DaoFactory.GetRelationshipEventDao();
            var eventIDs = _eventsDao.RemoveFile(file);
            var events = new List<RelationshipEvent>();

            eventIDs.ForEach(id => events.Add(_eventsDao.GetByID(id)));
            //events for audit log

            MessageService.Send(_context, MessageAction.CrmEntityDetachedFile, file.Title);

            return result;
        }