public async t.Task RemoveToDoCommentAsync(string id, ToDoComment comment) { string cmd = String.Format(@"DELETE FROM ToDoComments WHERE ID = '{0}' AND Time = '{1}';", id, comment.Time); await ExecuteQueryAsync(cmd); }
///<summary> /// typeparameter T must be <c>ToDoComment</c> ///</summary> public async t.Task UpdateToDoCommandAsync(string id, ToDoComment comment) { string cmd = String.Format("UPDATE ToDoComments SET Content = '{0}' WHERE ID = '{1}' AND Time = '{2}';", comment.Content, id, comment.Time); await ExecuteQueryAsync(cmd); }
// // //------ Cooming soon -------begin-------------------------- #region ToDoComment Query Method public async t.Task InsertToDoCommentAsync(ToDoComment comment) { string cmd = String.Format(@"INSERT INTO ToDoComments(Time, Content) VALUES ('{0}', '{1}');", comment.Time, comment.Content); await ExecuteQueryAsync(cmd); }
internal void RemoveToDoComment(string id, ToDoComment comment) { string cmd = String.Format(@"DELETE FROM ToDoComments WHERE ID = '{0}' AND Time = DATE('{1}');", id, comment.Time); ExecuteQuery(cmd).ContinueWith(t => { if (t.IsFaulted) { throw t.Exception; } }); }
///<summary> /// typeparameter T must be <c>ToDoComment</c> ///</summary> internal void UpdateToDoCommand(string id, ToDoComment comment) { string cmd = String.Format("UPDATE ToDoComments SET Content = '{0}' WHERE ID = '{1}' AND Time = DATE('{2}');", comment.Content, id, comment.Time); ExecuteQuery(cmd).ContinueWith(t => { if (t.IsFaulted) { throw t.Exception; } }); }
internal void InsertToDoComment(ToDoComment comment) { string cmd = String.Format(@"INSERT INTO ToDoComments(Time, Content) VALUES (DATE('{0}'), '{1}');", comment.Time, comment.Content); ExecuteQuery(cmd).ContinueWith(t => { if (t.IsFaulted) { throw t.Exception; } }); }
public async System.Threading.Tasks.Task <ActionResult> Detail(int id, ToDo model, FormCollection formcol) { if (formcol["Save"] == "Save") { var cx = new ToDoDBContext(); if (id == 0) { model.GId = Guid.NewGuid(); model.Created = DateTime.Now; cx.ToDoes.Add(model); cx.SaveChanges(); //Send to sservice bus ServiceBusHelper.SendToAll(model); } else { var p = cx.ToDoes.Single(e => e.Id == id); p.Note = model.Note; p.Category = model.Category; cx.SaveChanges(); } } else if (formcol["Comment"] == "Comment") { if (formcol["CommentText"].Length > 0) { var td = new ToDoComment(); td.Id = Guid.NewGuid(); td.ToDoGId = model.GId; td.Created = DateTime.Now; td.Comment = formcol["CommentText"]; var doc = new DocDBContext(); await doc.InsertComment(td); return(RedirectToAction("Detail", new { id = id })); } } return(RedirectToAction("Index")); }
public CommentModel AddComment(string projectId, string milestoneId, string toDoId, string text, bool isPrivate, bool sendNotifications, List <UrlViewModel> attachments) { var project = GetProject(projectId); var todo = GetToDo(project, milestoneId, toDoId); var comment = new ToDoComment() { Date = DateTime.Now, Text = text, UserFullName = CurrentUser.FullName, UserObjectId = CurrentUser.Id, IsPrivate = isPrivate }; attachments.BindUrls(comment.Attachments); todo.Comments.Add(comment); UpdateProject(project); var idea = GetIdea(project.IdeaId); bus.Send(new ProjectCommand() { ActionType = ActionTypes.ToDoCommentAdded, ProjectId = project.Id, MileStoneId = milestoneId, UserId = CurrentUser.Id, ToDoId = todo.Id, Text = comment.Text, ProjectSubject = idea.Subject, Link = GetProjectUrl(project.Id), ToDoSubject = todo.Subject, ToDoLink = Url.ActionAbsolute("Comments", "Project", new { projectId = project.Id, toDoId = todo.Id }), IsPrivate = idea.IsPrivateToOrganization && !string.IsNullOrEmpty(idea.OrganizationId) || todo.IsPrivate || comment.IsPrivate, CommentId = comment.Id, SendNotifications = sendNotifications, UserFullName = CurrentUser.FullName, UserLink = Url.ActionAbsolute("Details", "Account", new { userObjectId = CurrentUser.Id }) }); return(GetCommentModelFromComment(comment, project, milestoneId, toDoId, false)); }
public CommentModel GetCommentModelFromComment(ToDoComment c, Project project, string milestoneId, string toDoId, bool isIdeaClosed) { return(new CommentModel() { AuthorFullName = c.UserFullName, AuthorObjectId = c.UserObjectId, CommentDate = c.Date, CommentText = c.Text.NewLineToHtml().ActivateLinks(), ProjectId = project.Id, Id = c.Id, MileStoneId = milestoneId, ToDoId = toDoId, IsDeletable = CurrentUser.IsAuthenticated && c.UserObjectId == CurrentUser.Id && IsProjectEditable(project, isIdeaClosed), Attachments = c.Attachments.Select(a => new UrlViewModel() { IconUrl = a.IconUrl, Url = a.Url, Title = a.Title }).ToList() }); }
public async Task InsertComment(ToDoComment itm) { await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(databaseName, databaseCollectionName), itm); }