Ejemplo n.º 1
0
        public void GetBlogEntries_NullItem()
        {
            var manager = new EntryManager();
            var entries = manager.GetBlogEntries((Item)null);

            Assert.That(entries, Is.Empty);
        }
Ejemplo n.º 2
0
 public TreeLayout(EntryManager mngr)
 {
     this.entryManager = mngr;
     InitializeComponent();
     //campos de tradução
     datagDirectoryChanges.Tag = new string[] { null, "name", "date", "reason" };;
 }
Ejemplo n.º 3
0
 public EntryUi()
 {
     InitializeComponent();
     customer      = new Customer();
     account       = new Account();
     _entryManager = new EntryManager();
 }
Ejemplo n.º 4
0
        public IEnumerable <Folder> SearchFolders(string text)
        {
            var security = Global.GetFilesSecurity();
            IEnumerable <Folder> result;

            using (var folderDao = Global.DaoFactory.GetFolderDao())
            {
                result = folderDao.Search(text, FolderType.USER, FolderType.COMMON).Where(security.CanRead);

                if (ThirdpartyConfiguration.SupportInclusion &&
                    (Global.IsAdministrator || FilesSettings.EnableThirdParty))
                {
                    var id = Global.FolderMy;
                    if (!Equals(id, 0))
                    {
                        var folderMy = folderDao.GetFolder(id);
                        result = result.Concat(EntryManager.GetThirpartyFolders(folderMy, text));
                    }

                    id = Global.FolderCommon;
                    var folderCommon = folderDao.GetFolder(id);
                    result = result.Concat(EntryManager.GetThirpartyFolders(folderCommon, text));
                }
            }

            return(result);
        }
Ejemplo n.º 5
0
        public ActionResult DeleteEntry(int ID, int id2)
        {
            EntryManager entryManager = new EntryManager(_context);

            entryManager.DeleteEntry(ID);
            return(RedirectToAction("Show_Entry", new { ID = id2 }));
        }
Ejemplo n.º 6
0
        public void GetPopularEntriesByComment_InvalidItem()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);

            var entryLuna = TestUtil.CreateNewEntry(blog, "Luna");

            TestUtil.CreateNewComment(entryLuna);

            var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos");

            TestUtil.CreateNewComment(entryDeimos);
            TestUtil.CreateNewComment(entryDeimos);

            var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos");

            TestUtil.CreateNewComment(entryDeimos);
            TestUtil.CreateNewComment(entryDeimos);
            TestUtil.CreateNewComment(entryDeimos);

            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea");

            TestUtil.UpdateIndex();

            var manager  = new EntryManager();
            var entries  = manager.GetPopularEntriesByComment(entryDeimos, 10);
            var entryIds = from entry in entries select entry.ItemID;

            Assert.That(entryIds, Is.EqualTo(new[] { entryDeimos.ID }));
        }
Ejemplo n.º 7
0
        public void GetBlogEntries_ByCategoryLimited()
        {
            var blog          = TestUtil.CreateNewBlog(TestContentRoot);
            var categoryAlpha = TestUtil.CreateNewCategory(blog, "Alpha");
            var categoryBeta  = TestUtil.CreateNewCategory(blog, "Beta");
            var entryLuna     = TestUtil.CreateNewEntry(blog, "Luna", categories: new[] { categoryBeta.ID }, entryDate: new DateTime(2012, 3, 1));
            var entryDeimos   = TestUtil.CreateNewEntry(blog, "Deimos", categories: new[] { categoryAlpha.ID, categoryBeta.ID }, entryDate: new DateTime(2012, 3, 2));
            var entryPhobos   = TestUtil.CreateNewEntry(blog, "Phobos", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 3));
            var entryAdrastea = TestUtil.CreateNewEntry(blog, "Adrastea", categories: new[] { categoryBeta.ID, categoryAlpha.ID }, entryDate: new DateTime(2012, 3, 4));

            TestUtil.UpdateIndex();

            var manager  = new EntryManager();
            var criteria = new EntryCriteria
            {
                PageNumber = 1,
                PageSize   = 1,
                Category   = categoryAlpha.ID.ToString()
            };

            var results = manager.GetBlogEntries(blog, criteria, ListOrder.Descending);
            var ids     = from result in results.Results select result.Uri.ItemID;

            Assert.That(ids, Is.EqualTo(new[] { entryAdrastea.ID }));
        }
Ejemplo n.º 8
0
        public FileWrapper <T> AddToRecent(T fileId, int version = -1)
        {
            var file = FileStorageService.GetFile(fileId, version).NotFoundIfNull("File not found");

            EntryManager.MarkAsRecent(file);
            return(FileWrapperHelper.Get(file));
        }
Ejemplo n.º 9
0
        public void GetBlogEntries_NullItem()
        {
            var manager = new EntryManager();
            var entries = manager.GetBlogEntries(null, EntryCriteria.AllEntries, ListOrder.Descending);

            Assert.That(entries.Results, Is.Empty);
        }
Ejemplo n.º 10
0
        public void GetBlogEntries_EntriesExist_FieldsRehydratedProperly()
        {
            // arrange
            var entryDate = new DateTime(2012, 3, 1, 13, 42, 10, DateTimeKind.Utc);
            var blog      = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna = TestUtil.CreateNewEntry(
                blog,
                name: "Luna",
                tags: "tag",
                entryDate: entryDate);

            TestUtil.UpdateIndex();

            var manager = new EntryManager();

            // act
            var results = manager.GetBlogEntries(blog, EntryCriteria.AllEntries, ListOrder.Descending);

            // assert
            var ids = from result in results.Results select result.Uri.ItemID;

            Assert.That(results.Results[0].Title, Is.EqualTo("Luna"));
            Assert.That(results.Results[0].Tags, Is.EquivalentTo(new[] { "tag" }));
            Assert.That(results.Results[0].EntryDate, Is.EqualTo(entryDate));
        }
Ejemplo n.º 11
0
        protected SearchResults <Model.Entry> GetEntriesCloseToEntry(EntryItem entry, ListOrder resultOrder, Action <EntryCriteria> mutator)
        {
            var blogHomeItem = BlogManager.GetCurrentBlog(entry);

            if (blogHomeItem == null)
            {
                return(null);
            }

            var pageSizes = new[] { 5, 50, 100, int.MaxValue };

            foreach (var pageSize in pageSizes)
            {
                var criteria = new EntryCriteria
                {
                    PageNumber = 1,
                    PageSize   = pageSize
                };

                mutator.Invoke(criteria);

                var entries = EntryManager.GetBlogEntries(blogHomeItem, criteria, resultOrder);

                for (var i = 0; i < entries.Results.Count; i++)
                {
                    if (entries.Results[i].Uri.ItemID == entry.ID && i < entries.Results.Count - 1)
                    {
                        return(entries);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 12
0
        public IEnumerable <Folder> SearchFolders(string text)
        {
            var security = FileSecurity;
            IEnumerable <Folder> result;
            var folderDao = DaoFactory.FolderDao;

            result = folderDao.Search(text).Where(security.CanRead);

            if (ThirdpartyConfiguration.SupportInclusion &&
                (Global.IsAdministrator || FilesSettingsHelper.EnableThirdParty))
            {
                var id = GlobalFolderHelper.FolderMy;
                if (!Equals(id, 0))
                {
                    var folderMy = folderDao.GetFolder(id);
                    result = result.Concat(EntryManager.GetThirpartyFolders(folderMy, text));
                }

                id = GlobalFolderHelper.FolderCommon;
                var folderCommon = folderDao.GetFolder(id);
                result = result.Concat(EntryManager.GetThirpartyFolders(folderCommon, text));
            }

            return(result);
        }
        private void DeleteFiles(List <object> fileIds)
        {
            if (fileIds.Count == 0)
            {
                return;
            }

            foreach (var fileId in fileIds)
            {
                if (Canceled)
                {
                    return;
                }

                var file = FileDao.GetFile(fileId);
                if (file == null)
                {
                    Error = FilesCommonResource.ErrorMassage_FileNotFound;
                }
                else if (!ignoreException && EntryManager.FileLockedForMe(file.ID))
                {
                    Error = FilesCommonResource.ErrorMassage_LockedFile;
                }
                else if (!ignoreException && FileTracker.IsEditing(file.ID))
                {
                    Error = FilesCommonResource.ErrorMassage_SecurityException_DeleteEditingFile;
                }
                else if (!ignoreException && !FilesSecurity.CanDelete(file))
                {
                    Error = FilesCommonResource.ErrorMassage_SecurityException_DeleteFile;
                }
                else
                {
                    FileMarker.RemoveMarkAsNewForAll(file);
                    if (FileDao.UseTrashForRemove(file))
                    {
                        FileDao.MoveFile(file.ID, _trashId);

                        FilesMessageService.Send(file, httpRequestHeaders, MessageAction.FileMovedToTrash, file.Title);
                        ResultedFile(fileId);
                    }
                    else
                    {
                        try
                        {
                            FileDao.DeleteFile(file.ID);
                            FileDao.DeleteFolder(file.ID);
                        }
                        catch (Exception ex)
                        {
                            Error = ex.Message;

                            Logger.Error(Error, ex);
                        }
                    }
                    ProcessedFile(fileId);
                }
                ProgressStep();
            }
        }
Ejemplo n.º 14
0
 public void Dispose()
 {
     Reset();
     _hEntryManager       = null;
     _hDeviceContent      = null;
     _oCurrentEntryObject = null;
 }
Ejemplo n.º 15
0
        // Úprava existujícího úkolu; pokud neexistuje, je vytvořen úkol nový
        public void Execute(object parameter)
        {
            EntryModel entry = new()
            {
                Name        = _entryDetailsSource.Entry_Name,
                Description = _entryDetailsSource.Entry_Description,
                DateAndTime = _entryDetailsSource.Entry_Date + _entryDetailsSource.Entry_Time,
                EndDate     = _entryDetailsSource.Entry_EndDate,
                RepeatRule  = _entryDetailsSource.Entry_RepeatRule
            };

            if (_entry == null)
            {
                EntryManager.AddEntry(entry);
            }
            else
            {
                _entry.Name        = _entryDetailsSource.Entry_Name;
                _entry.Description = _entryDetailsSource.Entry_Description;
                _entry.DateAndTime = _entryDetailsSource.Entry_Date + _entryDetailsSource.Entry_Time;
                _entry.EndDate     = _entryDetailsSource.Entry_EndDate;
                _entry.RepeatRule  = _entryDetailsSource.Entry_RepeatRule;

                foreach (DateTime completed in _entry.Completed.ToList())
                {
                    if (_entry.CheckDay(completed.Date) == false)
                    {
                        Trace.WriteLine("a completed occurence of an entry deleted!");
                        _entry.Completed.Remove(completed.Date);
                    }
                }
            }
        }
    }
Ejemplo n.º 16
0
        public void GetBlogEntries_LimitedMultipleBlogs()
        {
            var blog1       = TestUtil.CreateNewBlog(TestContentRoot);
            var entryLuna   = TestUtil.CreateNewEntry(blog1, "Luna", entryDate: new DateTime(2012, 3, 1));
            var entryDeimos = TestUtil.CreateNewEntry(blog1, "Deimos", entryDate: new DateTime(2012, 3, 2));
            var entryPhobos = TestUtil.CreateNewEntry(blog1, "Phobos", entryDate: new DateTime(2012, 3, 3));

            var blog2         = TestUtil.CreateNewBlog(TestContentRoot);
            var entryAdrastea = TestUtil.CreateNewEntry(blog2, "Adrastea", entryDate: new DateTime(2012, 3, 1));
            var entryAitne    = TestUtil.CreateNewEntry(blog2, "Aitne", entryDate: new DateTime(2012, 3, 2));
            var entryAmalthea = TestUtil.CreateNewEntry(blog2, "Amalthea", entryDate: new DateTime(2012, 3, 3));
            var entryAnanke   = TestUtil.CreateNewEntry(blog2, "Ananke", entryDate: new DateTime(2012, 3, 4));

            TestUtil.UpdateIndex();

            var manager  = new EntryManager();
            var criteria = new EntryCriteria
            {
                PageNumber = 1,
                PageSize   = 3
            };

            var results = manager.GetBlogEntries(entryAmalthea, criteria, ListOrder.Descending);
            var ids     = from result in results.Results select result.Uri.ItemID;

            Assert.That(ids, Is.EqualTo(new[] { entryAnanke.ID, entryAmalthea.ID, entryAitne.ID }));
            Assert.That(results.HasMoreResults, Is.True);
        }
Ejemplo n.º 17
0
        public IActionResult Show_Entry(int ID)
        {
            EntryManager entry = new EntryManager(_context);

            ViewBag.ID = ID;
            return(View(entry.GetEntries(ID)));
        }
Ejemplo n.º 18
0
 public ChunkedUploaderHandlerService(
     IOptionsMonitor <ILog> optionsMonitor,
     TenantManager tenantManager,
     FileUploader fileUploader,
     FilesMessageService filesMessageService,
     AuthManager authManager,
     SecurityContext securityContext,
     SetupInfo setupInfo,
     EntryManager entryManager,
     InstanceCrypto instanceCrypto,
     ChunkedUploadSessionHolder chunkedUploadSessionHolder,
     ChunkedUploadSessionHelper chunkedUploadSessionHelper)
 {
     TenantManager              = tenantManager;
     FileUploader               = fileUploader;
     FilesMessageService        = filesMessageService;
     AuthManager                = authManager;
     SecurityContext            = securityContext;
     SetupInfo                  = setupInfo;
     EntryManager               = entryManager;
     InstanceCrypto             = instanceCrypto;
     ChunkedUploadSessionHolder = chunkedUploadSessionHolder;
     ChunkedUploadSessionHelper = chunkedUploadSessionHelper;
     Logger = optionsMonitor.CurrentValue;
 }
Ejemplo n.º 19
0
 public void PushPlane(Plane plane)
 {
     Task.Run(() =>
     {
         LogicStation.GetBestStation(EntryManager.GetEntryStations(plane.Route.Name)).EnterStation(plane);
     });
 }
        public static object ToResponseObject(ChunkedUploadSession session, bool appendBreadCrumbs = false)
        {
            var pathFolder = appendBreadCrumbs
                                 ? EntryManager.GetBreadCrumbs(session.FolderId).Select(f =>
            {
                //todo: check how?
                if (f == null)
                {
                    Global.Logger.ErrorFormat("GetBreadCrumbs {0} with null", session.FolderId);
                    return(string.Empty);
                }
                return(f.ID);
            })
                                 : new List <object> {
                session.FolderId
            };

            return(new
            {
                id = session.Id,
                path = pathFolder,
                created = session.Created,
                expired = session.Expired,
                location = session.Location,
                bytes_uploaded = session.BytesUploaded,
                bytes_total = session.BytesTotal
            });
        }
Ejemplo n.º 21
0
        public Configuration <T> OpenEdit(T fileId, int version, string doc, bool view)
        {
            DocumentServiceHelper.GetParams(fileId, version, doc, true, !view, true, out var configuration);
            configuration.EditorType = EditorType.External;
            if (configuration.EditorConfig.ModeWrite)
            {
                configuration.EditorConfig.CallbackUrl = DocumentServiceTracker.GetCallbackUrl(configuration.Document.Info.GetFile().ID.ToString());
            }

            if (configuration.Document.Info.GetFile().RootFolderType == FolderType.Privacy && PrivacyRoomSettings.GetEnabled(SettingsManager))
            {
                var keyPair = EncryptionKeyPairHelper.GetKeyPair();
                if (keyPair != null)
                {
                    configuration.EditorConfig.EncryptionKeys = new EncryptionKeysConfig
                    {
                        PrivateKeyEnc = keyPair.PrivateKeyEnc,
                        PublicKey     = keyPair.PublicKey,
                    };
                }
            }

            if (!configuration.Document.Info.GetFile().Encrypted&& !configuration.Document.Info.GetFile().ProviderEntry)
            {
                EntryManager.MarkAsRecent(configuration.Document.Info.GetFile());
            }

            configuration.Token = DocumentServiceHelper.GetSignature(configuration);
            return(configuration);
        }
Ejemplo n.º 22
0
        public ActionResult AddChecklistEntry(ChecklistEntry data, int DietID)
        {
            EntryManager entry = new EntryManager(_context);

            data.ID = 0;
            entry.AddEntry(data, DietID);
            return(RedirectToAction("Show_Entry", new { ID = DietID }));
        }
Ejemplo n.º 23
0
 public FileMoveCopyOperationScope(FilesMessageService filesMessageService, FileMarker fileMarker, FileUtility fileUtility, Global global, EntryManager entryManager)
 {
     FilesMessageService = filesMessageService;
     FileMarker          = fileMarker;
     FileUtility         = fileUtility;
     Global       = global;
     EntryManager = entryManager;
 }
Ejemplo n.º 24
0
        public void InvalidEntrySpecialTest(InvalidSpecialCondition condition, ResourceId resource)
        {
            var entryManager = new EntryManager();

            var result = entryManager.GetEntryRecords <EntryResponse>(resource, InvalidEntrySpecialTestCasesMapper[condition], HttpMethod.Post);

            PrAssert.That(result, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound));
        }
Ejemplo n.º 25
0
        public ActionResult AddTimerEntry(TimerEntry data, int DiaryId)
        {
            EntryManager entry = new EntryManager(_context);

            data.ID = 0;
            entry.AddEntry(data, DiaryId);
            return(RedirectToAction("Show_Entry", new { ID = DiaryId }));
        }
Ejemplo n.º 26
0
        public static void OnStaticConfigChanged()
        {
            updateDelegate = null;
            if (PlayerListConfig.pingToggle.Value)
            {
                updateDelegate += AddPing;
            }
            if (PlayerListConfig.fpsToggle.Value)
            {
                updateDelegate += AddFps;
            }
            if (PlayerListConfig.platformToggle.Value)
            {
                updateDelegate += AddPlatform;
            }
            if (PlayerListConfig.perfToggle.Value)
            {
                updateDelegate += AddPerf;
            }
            if (PlayerListConfig.distanceToggle.Value)
            {
                updateDelegate += AddDistance;
            }
            if (PlayerListConfig.photonIdToggle.Value)
            {
                updateDelegate += AddPhotonId;
            }
            if (PlayerListConfig.ownedObjectsToggle.Value)
            {
                if (VRCUtils.AreRiskyFunctionsAllowed)
                {
                    updateDelegate += AddOwnedObjects;
                }
                else
                {
                    updateDelegate += AddOwnedObjectsSafe;
                }
            }
            if (PlayerListConfig.displayNameToggle.Value)
            {
                updateDelegate += AddDisplayName;
            }
            if (PlayerListConfig.distanceToggle.Value && EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.Distance) || PlayerListConfig.pingToggle.Value && EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.Ping))
            {
                updateDelegate += (PlayerNet playerNet, PlayerEntry entry, ref StringBuilder tempString) => EntrySortManager.SortPlayer(entry.playerLeftPairEntry);
            }

            if (PlayerListConfig.condensedText.Value)
            {
                separator = "|";
            }
            else
            {
                separator = " | ";
            }

            EntryManager.RefreshPlayerEntries();
        }
Ejemplo n.º 27
0
        public JsonResult List(int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
        {
            try
            {
                var dbRecords        = new List <Entry>();
                var totalRecordCount = 0;

                if (!String.IsNullOrEmpty(Filter))
                {
                    dbRecords        = EntryManager.GetByAdminFilter(StringUtils.HashSHA256(Filter.ToLower()), CurrentContextType).ToList();
                    totalRecordCount = dbRecords.Count();
                }
                else
                {
                    dbRecords        = EntryManager.Get(jtStartIndex, jtPageSize, CurrentContextType).ToList();
                    totalRecordCount = EntryManager.Count(CurrentContextType);
                }

                var records = new List <object>();
                foreach (var dbRecord in dbRecords)
                {
                    records.Add(new {
                        Id             = dbRecord.Id,
                        ParticipantId  = dbRecord.Participant.Id,
                        FirstName      = dbRecord.ParticipantDataCache.FirstName,
                        LastName       = dbRecord.ParticipantDataCache.LastName,
                        Email          = dbRecord.ParticipantDataCache.Email,
                        ConsumerId     = dbRecord.Participant.ConsumerId,
                        BarName        = dbRecord.BarName,
                        BarDescription = dbRecord.BarDescription,
                        BarColour      = dbRecord.BarColour,
                        Ingredient1    = dbRecord.Ingredient1,
                        Ingredient2    = dbRecord.Ingredient2,
                        Ingredient3    = dbRecord.Ingredient3,
                        Colour         = dbRecord.Colour,
                        CreatedOn      = String.Format(
                            "{0:yyyy-MM-dd hh:mm}",
                            dbRecord.CreatedOn
                            )
                    });
                }

                return(Json(new JTableResult
                {
                    Result = "OK",
                    Records = records,
                    TotalRecordCount = totalRecordCount
                }));
            }
            catch (Exception ex)
            {
                return(Json(new JTableResult
                {
                    Result = "ERROR",
                    Message = ex.Message
                }));
            }
        }
Ejemplo n.º 28
0
        public FormEntryInfo(EntryManager mngr, long usn)
        {
            InitializeComponent();

            entryManager = mngr;
            USN          = usn;

            datagFileIdentifiers.Tag = new string[] { null, "name", "date", "reason", "directory" };
        }
Ejemplo n.º 29
0
        public void GetBlogEntries_NoEntries()
        {
            var blog = TestUtil.CreateNewBlog(TestContentRoot);

            var manager = new EntryManager();
            var entries = manager.GetBlogEntries(blog, EntryCriteria.AllEntries, ListOrder.Descending);

            Assert.That(entries.Results, Is.Empty);
        }
Ejemplo n.º 30
0
        public ActionResult AddTextEntry(TextEntry data, int DietID)
        {
            EntryManager entry = new EntryManager(_context);

            data.Type = "Edit_Text_Entry";
            data.ID   = 0;
            entry.AddEntry(data, DietID);
            return(RedirectToAction("Show_Entry", new { ID = DietID }));
        }
Ejemplo n.º 31
0
    // Use this for initialization
    void Awake()
    {
        _instance = this;

    }    // Update is called once per frame