示例#1
0
        public string GetEventFolder(PendingEvent evt)
        {
            var folder_name = evt.title;

            if (string.IsNullOrEmpty(folder_name))
            {
                var evtTime = evt.time_start.ToLocalTime();
                folder_name = string.Format("{0} ~ {1}", evtTime.ToString("yyyy-MM-dd HH-mm-ss"), evt.time_end.ToLocalTime().ToString("yyyy-MM-dd HH-mm-ss"));
            }
            else
            {
                folder_name = sanitizeFolderName(folder_name);
            }

            return(folder_name);
        }
示例#2
0
        public void Do(PendingEvent evt)
        {
            IEventDirOrganizer organizer = null;

            if (evt.type == (int)EventType.Monthly)
            {
                organizer = new MonthlyDirOrganizer();
            }
            else
            {
                organizer = new EventDirOrganizer();
            }

            var folder = util.CreateFolder(organizer.GetEventFolder(evt));

            var pending_files = util.GetPendingFiles(evt.files);

            if (pending_files == null)
            {
                return;
            }

            var resDir     = util.GetResourceFolder();
            var pendingDir = util.GetPendingFolder();
            var fileData   = new List <FileData>();

            foreach (var pending_file in pending_files)
            {
                var full_path = util.Move(
                    Path.Combine(pendingDir, pending_file.saved_path),
                    Path.Combine(resDir, pending_file.dev_folder, folder, pending_file.file_name));

                var relative_path = PathUtil.MakeRelative(full_path, resDir);

                fileData.Add(
                    new FileData
                {
                    file_id       = pending_file.file_id,
                    parent_folder = Path.GetDirectoryName(relative_path),
                    saved_path    = relative_path,
                });
            }

            util.CreateFolderRecord(util.DevFolder, folder);
            util.MoveDbRecord(fileData);
        }
示例#3
0
        public string GetEventFolder(PendingEvent evt)
        {
            var evtTime = evt.time_start.ToLocalTime();

            return(evtTime.ToString("yyyy-MM"));
        }