public async Task <IActionResult> PutJournals([FromRoute] int id, [FromBody] Journals journals) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != journals.JournalID) { return(BadRequest()); } _context.Entry(journals).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JournalsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// Adds an <see cref="iCalObject"/>-based component to the /// appropriate collection. Currently, the iCalendar component /// supports the following components: /// <list type="bullet"> /// <item><see cref="DDay.iCal.Components.Event"/></item> /// <item><see cref="DDay.iCal.Components.FreeBusy"/></item> /// <item><see cref="DDay.iCal.Components.Journal"/></item> /// <item><see cref="DDay.iCal.Components.TimeZone"/></item> /// <item><see cref="DDay.iCal.Components.Todo"/></item> /// </list> /// </summary> /// <param name="child"></param> public override void AddChild(iCalObject child) { base.AddChild(child); child.Parent = this; if (child is UniqueComponent) { UniqueComponents.Add((UniqueComponent)child); } Type type = child.GetType(); if (type == typeof(Event) || type.IsSubclassOf(typeof(Event))) { Events.Add((Event)child); } else if (type == typeof(FreeBusy) || type.IsSubclassOf(typeof(FreeBusy))) { FreeBusy.Add((FreeBusy)child); } else if (type == typeof(Journal) || type.IsSubclassOf(typeof(Journal))) { Journals.Add((Journal)child); } else if (type == typeof(iCalTimeZone) || type.IsSubclassOf(typeof(iCalTimeZone))) { TimeZones.Add((iCalTimeZone)child); } else if (type == typeof(Todo) || type.IsSubclassOf(typeof(Todo))) { Todos.Add((Todo)child); } }
public void SubscribeToMessages() { MessagingCenter.Subscribe <LoginPage>(this, "AuthorLogin", (obj) => { JournalDataStore.ResetClient(); }); MessagingCenter.Subscribe <NewJournalPage, Journal>(this, "AddJournal", async(obj, journal) => { var _journal = journal as Journal; Journals.Add(_journal); try { await JournalDataStore.AddAsync(_journal); LoadJournalsCommand.Execute(null); } catch (Exception e) { Debug.WriteLine("AddJournalMessage" + e); if (!e.Message.Contains("A task was canceled")) { await App.Current.MainPage.DisplayAlert("Error", e.Message, "OK"); } } }); }
/// <summary> /// Removes an <see cref="iCalObject"/>-based component from all /// of the collections that this object may be contained in within /// the iCalendar. /// </summary> /// <param name="child"></param> public override void RemoveChild(iCalObject child) { base.RemoveChild(child); if (child is UniqueComponent) { UniqueComponents.Remove((UniqueComponent)child); } Type type = child.GetType(); if (type == typeof(Event) || type.IsSubclassOf(typeof(Event))) { Events.Remove((Event)child); } else if (type == typeof(FreeBusy) || type.IsSubclassOf(typeof(FreeBusy))) { FreeBusy.Remove((FreeBusy)child); } else if (type == typeof(Journal) || type.IsSubclassOf(typeof(Journal))) { Journals.Remove((Journal)child); } else if (type == typeof(DDay.iCal.Components.TimeZone) || type.IsSubclassOf(typeof(DDay.iCal.Components.TimeZone))) { TimeZones.Remove((DDay.iCal.Components.TimeZone)child); } else if (type == typeof(Todo) || type.IsSubclassOf(typeof(Todo))) { Todos.Remove((Todo)child); } }
private IEnumerable <CraftingRequirement> CreateCraftingRequirements(Craftingrequirements[] arg, bool isTransmut, string itemId) { if (arg == null) { yield break; } Journals.TryGetValue(itemId, out var journal); foreach (var cr in arg) { var res = CreateResources(cr.craftresource, cr.currency, cr.playerfactionstanding); if (isTransmut) { yield return new TransmutRequirement(res.ToArray()) { Silver = cr.silver * 10000, AmountCrafted = cr.amountcrafted } } ; else { yield return new CraftingRequirement(res.ToArray()) { Silver = cr.silver * 10000, AmountCrafted = cr.amountcrafted, Journal = journal } }; } }
public static IEnumerable <PostInfo> GetPostsForUser(User user, string profilePath) { // get all wall container workspaces - instead of loading the content of the journal and individually determine the wall container workspace //var wallWorkspacesPaths = ContentQuery.Query("+TypeIs:Workspace +IsWallContainer:1").Nodes.Select(n => n.Path); // gather users's posts: // - gather all journal posts from everywhere, that was created by the user // - gather all big posts that were put out to his/her wall var queryText = string.Format("(+CreatedById:\"{0}\" +Type:Post -PostType:{1}) (+InTree:\"{2}\" +Type:Post)", user.Id, (int)PostType.BigPost, profilePath); var settings = new QuerySettings { EnableAutofilters = false, Sort = new SortInfo[] { new SortInfo { FieldName = "CreationDate", Reverse = true } } }; var posts = ContentQuery.Query(queryText, settings).Nodes.Select(n => new PostInfo(n)); // gather all journalid-s: these are ids to which post has already been created in the Content Repository var journalIds = posts.Select(p => p.JournalId).Distinct(); var journalItems = Journals.GetItemsForUser(user); // get last paths of journals. Get all journals grouped by nodeids var lastPaths = (from j in journalItems group j by j.NodeId into grp select grp.First()).ToDictionary(j => j.NodeId, j => j.Wherewith); // gather users's activities // gather crudposts, where createdby is current user // and it has not been persisted to the content repository yet (journalid is not contained in journalids above) var crudPosts = journalItems.Select(j => new PostInfo(j, lastPaths[j.NodeId])).Where(p => p.CreatedBy != null && !journalIds.Contains(p.JournalId)); return(posts.Union(crudPosts).OrderByDescending(p => p.CreationDate)); }
/// <summary> /// Populates the journals observalbe collection. /// </summary> /// <param name="journals">The collection from which the items are taken.</param> private void FillJournalsObervableCollections(IEnumerable <JournalModel> journals) { foreach (var journal in journals) { Journals.Add(journal); } }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <returns></returns> public override bool Equals(Issue other) { if (other == null) { return(false); } return(Id == other.Id && Project == other.Project && Tracker == other.Tracker && Status == other.Status && Priority == other.Priority && Author == other.Author && Category == other.Category && Subject == other.Subject && Description == other.Description && StartDate == other.StartDate && DueDate == other.DueDate && DoneRatio == other.DoneRatio && EstimatedHours == other.EstimatedHours && (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) && CreatedOn == other.CreatedOn && UpdatedOn == other.UpdatedOn && AssignedTo == other.AssignedTo && FixedVersion == other.FixedVersion && Notes == other.Notes && (Watchers != null ? Watchers.Equals <Watcher>(other.Watchers) : other.Watchers == null) && ClosedOn == other.ClosedOn && SpentHours == other.SpentHours && PrivateNotes == other.PrivateNotes && (Attachments != null ? Attachments.Equals <Attachment>(other.Attachments) : other.Attachments == null) && (ChangeSets != null ? ChangeSets.Equals <ChangeSet>(other.ChangeSets) : other.ChangeSets == null) && (Children != null ? Children.Equals <IssueChild>(other.Children) : other.Children == null) && (Journals != null ? Journals.Equals <Journal>(other.Journals) : other.Journals == null) && (Relations != null ? Relations.Equals <IssueRelation>(other.Relations) : other.Relations == null)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Journalname,Volume,Publicationdate,Issue,Pages,Url")] Journals journals) { if (id != journals.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(journals); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JournalsExists(journals.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(journals)); }
public static IEnumerable <PostInfo> GetPostsForContent(Node content) { // share posts of current content var queryText = string.Format("+SharedContent:\"{0}\" +Type:Post", content.Id.ToString()); var settings = new QuerySettings { Sort = new SortInfo[] { new SortInfo { FieldName = "CreationDate", Reverse = true } } }; var posts = ContentQuery.Query(queryText, settings).Nodes.Select(n => new PostInfo(n)); // gather all journalid-s: these are ids to which post has already been created in the Content Repository var journalIds = posts.Select(p => p.JournalId).Distinct(); var journalItems = Journals.GetItemsForContent(content.Id); // get last paths of journals. Get all journals grouped by nodeids var lastPaths = (from j in journalItems group j by j.NodeId into grp select grp.First()).ToDictionary(j => j.NodeId, j => j.Wherewith); // gather crudposts, where createdby is a valid user (not SYSTEMUSER) // and it has not been persisted to the content repository yet (journalid is not contained in journalids above) var crudPosts = journalItems.Select(j => new PostInfo(j, lastPaths[j.NodeId])).Where(p => p.CreatedBy != null && !journalIds.Contains(p.JournalId)); return(posts.Union(crudPosts).OrderByDescending(p => p.CreationDate)); }
public void DeleteRow(GenJouranlView row) { row.IsHeaden = true; RaisePropertyChanged(() => Journals); Summary = Journals.Sum(i => i.Amount); RaisePropertyChanged(() => Summary); }
// ================================================================================================ Private methods /// <summary> /// Get a post from clientId. If it is a manual post, it comes from repository. /// If it is a journal post, it either comes from journal and a repository post is created, or is already persisted to repository. /// </summary> /// <param name="clientId"></param> /// <param name="contextPath">New posts from journal items will be created under contextPath</param> /// <returns></returns> private static Node GetPostFromId(string clientId, string contextPath) { Node post = null; var itemID = PostInfo.GetIdFromClientId(clientId); if (PostInfo.IsJournalId(clientId)) { // CRUD post, create a manual post // only create it if it is not yet created! post = ContentQuery.Query(string.Format("JournalId:{0}", itemID)).Nodes.FirstOrDefault(); if (post == null) { var item = Journals.GetSingleItem(itemID); // lastpath is empty here: we wont use it from this scenario var postInfo = new PostInfo(item, string.Empty); var sharedContent = Node.LoadNode(item.NodeId); post = CreatePost(contextPath, postInfo.Text, item.When, itemID, postInfo.Type, sharedContent, postInfo.Details); } } else { post = Node.LoadNode(itemID); } return(post); }
// ================================================================================================ Public methods /// <summary> /// Retrieves all posts under given contextPath. /// </summary> /// <param name="contextPath">Path of context, ie. workspace.</param> /// <returns></returns> public static IEnumerable <PostInfo> GetPostsForWorkspace(string contextPath) { var queryText = string.Format("+InTree:\"{0}\" +Type:Post", contextPath); var settings = new QuerySettings { EnableAutofilters = false, Sort = new SortInfo[] { new SortInfo { FieldName = "CreationDate", Reverse = true } } }; var posts = ContentQuery.Query(queryText, settings).Nodes.Select(n => new PostInfo(n)); // gather all journalid-s: these are ids to which post has already been created in the Content Repository var journalIds = posts.Select(p => p.JournalId).Distinct(); var journalItems = Journals.GetItemsForWorkspace(contextPath); // get last paths of journals. Get all journals grouped by nodeids var lastPaths = (from j in journalItems group j by j.NodeId into grp select grp.First()).ToDictionary(j => j.NodeId, j => j.Wherewith); // gather crudposts, where createdby is a valid user (not SYSTEMUSER) // and it has not been persisted to the content repository yet (journalid is not contained in journalids above) var crudPosts = journalItems.Select(j => new PostInfo(j, lastPaths[j.NodeId])).Where(p => p.CreatedBy != null && !journalIds.Contains(p.JournalId)); // gather likes and comments corresponding to content under this workspace var postsFolderPath = RepositoryPath.Combine(contextPath, "Posts"); queryText = string.Format("+InTree:\"{0}\" +(Type:Comment Type:Like) -InTree:\"{1}\"", contextPath, postsFolderPath); var contentComments = ContentQuery.Query(queryText, settings).Nodes.Select(n => PostInfo.CreateFromCommentOrLike(n)).Where(p => p != null).Distinct(new CommentsLikesComparer()); return(posts.Union(crudPosts).Union(contentComments).OrderByDescending(p => p.CreationDate)); }
/// <summary> /// Removes the book from the view and the server. /// </summary> public void RemoveBook() { HttpResponseMessage httpResponse = httpClient.DeleteAsync(booksApiUrl + $"/DeleteBook/{abstractBook.Id}").Result; if (httpResponse.IsSuccessStatusCode) { Message = $"{bookName} has been removed"; if (abstractBook is BookModel bookModel) { Books.Remove(bookModel); } else if (abstractBook is JournalModel journalModel) { Journals.Remove(journalModel); } BookName = ""; TotalePrice = 0; IsBuyable = false; } else { Message = "Check server connection"; } }
private void AddJournal(ItemsJournalitem journalitem, CommonItem item) { if (JournalsItems.TryGetValue(item.Id, out var journal)) { item.Id += "_FULL"; item.Name = Localization.TryGetValue("@ITEMS_" + item.Id, out var name) ? name : item.Id; item.CraftingRequirements = EmptyCraftingRequirements; item.IsCraftable = false; journal.SetFullItem(item); return; } journal = new Journal(item) { MaxFame = journalitem.maxfame }; JournalsItems.Add(item.Id, journal); { item.Id += "_EMPTY"; item.Name = Localization.TryGetValue("@ITEMS_" + item.Id, out var name) ? name : item.Id; } var itemIds = journalitem.famefillingmissions.Where(x => x.craftitemfame != null) .SelectMany(x => x.craftitemfame).SelectMany(x => x.validitem) .Select(x => x.id); foreach (var itemId in itemIds) { Journals.Add(itemId, journal); } }
public void Dispose() { Children.Clear(); Events.Clear(); FreeBusy.Clear(); Journals.Clear(); Todos.Clear(); }
public object Get(Journals request) { using (var db = _connectionFactory.Open()) { var journals = db.Select <Journal>(); return(journals); } }
public override void OnLoad(EventArgs e) { Events.ResolveUIDs(); Todos.ResolveUIDs(); Journals.ResolveUIDs(); base.OnLoad(e); }
public void Refresh() { Journals = DaoController.Current.GetJournalLinesView(); Summary = Journals.Sum(i => i.Amount); RaisePropertyChanged(() => Summary); InEditMode = false; UpdateEditiVisibilities(); }
public object Get(Journals request) { using (var db = _connectionFactory.Open()) { var journals = db.Select<Journal>(); return journals; } }
//silme public void Delete(Journals journals) { using (InstituteDbEntities context = new InstituteDbEntities()) { var entity = context.Entry(journals); entity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Create([FromBody] Journals journal) { Console.WriteLine("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); Console.WriteLine(journal); Console.WriteLine("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); _db.Journals.Add(journal); _db.SaveChanges(); // return RedirectToAction("Index"); }
public void Dispose() { Children.Clear(); Events.Clear(); FreeBusy.Clear(); Journals.Clear(); Todos.Clear(); TimeZones.Clear(); UniqueComponents.Clear(); }
protected bool Equals(Calendar other) { return(string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && UniqueComponents.SequenceEqual(other.UniqueComponents) && Events.SequenceEqual(other.Events) && Todos.SequenceEqual(other.Todos) && Journals.SequenceEqual(other.Journals) && FreeBusy.SequenceEqual(other.FreeBusy) && TimeZones.SequenceEqual(other.TimeZones)); }
public async Task <ActionResult> GetAsync(JournalViewQuery query) { var appUser = await AppUsers.GetCurrentAsync().ConfigureAwait(true); query.OfficeId = appUser.OfficeId; query.UserId = appUser.UserId; var model = await Journals.GetJournalViewAsync(this.Tenant, query).ConfigureAwait(true); return(this.Ok(model)); }
private void ShowAll() { var service = new DataService(); Journals.Clear(); foreach (var item in service.GetAllJournals().Cast <Journal>()) { Journals.Add(new JournalViewModel(item)); } }
public async Task <IActionResult> Create([Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Title,Journalname,Volume,Publicationdate,Issue,Pages,Url")] Journals journals) { if (ModelState.IsValid) { _context.Add(journals); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(journals)); }
///// <summary> ///// Returns a list of flattened recurrences for all recurring components ///// in the iCalendar. ///// </summary> ///// <returns>A list of flattened recurrences for all recurring components</returns> //public IEnumerable<RecurringComponent> FlattenRecurrences() //{ // foreach (RecurringComponent rc in RecurringComponents) // foreach (RecurringComponent instance in rc.FlattenRecurrences()) // yield return instance; //} ///// <summary> ///// Returns a list of flattened recurrences of type T. ///// </summary> ///// <typeparam name="T">The type for which to return flattened recurrences</typeparam> ///// <returns>A list of flattened recurrences of type T</returns> //public IEnumerable<T> FlattenRecurrences<T>() //{ // foreach (RecurringComponent rc in FlattenRecurrences()) // { // if (rc is T) // { // object obj = rc; // yield return (T)obj; // } // } //} ///// <summary> ///// Returns a list of flattened recurrence instances for the given date range. ///// </summary> ///// <param name="startDate">The starting date of the date range</param> ///// <param name="endDate">The ending date of the date range</param> ///// <returns>A list of flattened recurrences for the date range</returns> //public IEnumerable<RecurringComponent> GetRecurrencesForRange(Date_Time startDate, Date_Time endDate) //{ // foreach (RecurringComponent rc in GetRecurrencesForRange<RecurringComponent>(startDate, endDate)) // yield return rc; //} ///// <summary> ///// Returns a list of flattened recurrence instances of type T for the given date range. ///// </summary> ///// <param name="startDate">The starting date of the date range</param> ///// <param name="endDate">The ending date of the date range</param> ///// <returns>A list of flattened recurrences of type T for the date range</returns> //public IEnumerable<T> GetRecurrencesForRange<T>(Date_Time startDate, Date_Time endDate) //{ // Evaluate<T>(startDate, endDate); // foreach (T t in FlattenRecurrences<T>()) // { // if (t is RecurringComponent) // { // RecurringComponent rc = (RecurringComponent)(object)t; // if (rc.Start >= startDate && rc.Start <= endDate) // yield return t; // } // } //} #endregion #region IDisposable Members public void Dispose() { Children.Clear(); Events.Clear(); FreeBusy.Clear(); Journals.Clear(); Todos.Clear(); // FIXME: disposing of time zones currently causes problems when merging calendars. // There are probably problems anyway when serializing, but for now... //TimeZones.Clear(); //UniqueComponents.Clear(); }
public async Task <IActionResult> PostJournals([FromBody] Journals journals) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Journals.Add(journals); await _context.SaveChangesAsync(); return(CreatedAtAction("GetJournals", new { id = journals.JournalID }, journals)); }
public async Task <ActionResult> GetAsync(JournalViewQuery query) { var appUser = await AppUsers.GetCurrentAsync().ConfigureAwait(true); query.OfficeId = appUser.OfficeId; query.UserId = appUser.UserId; query.From = query.From == DateTime.MinValue ? DateTime.Today : query.From; query.To = query.To == DateTime.MinValue ? DateTime.Today : query.To; var model = await Journals.GetJournalViewAsync(this.Tenant, query).ConfigureAwait(true); return(this.Ok(model)); }
/// <summary> /// Upades book's amount. /// </summary> private void UpdateBookAmount(BookModel bookModel) { bookModel.Amount--; HttpResponseMessage httpResponseMessage = ConstantsHelper.Post(bookModel, booksApiUrl + "/PutBook", httpClient); Journals.Clear(); Books.Clear(); PopulateCollections(); if (bookModel.Amount <= 0) { var bookToRemove = Books.FirstOrDefault(b => b.Amount == 0); Books.Remove(bookToRemove); } }