public IHttpActionResult GetConsInfo(string projectId, string entityId = "") { var entity = ReimageConsInfo.GetConsInfo(projectId, entityId); if (entity != null) { var condition = new ProjectCommentCondition(); condition.SourceCode = FlowCode.Reimage; condition.UserAccount = ClientCookie.UserCode; condition.RefTableId = entity.Id; condition.RefTableName = "ReimageConsInfo"; var comments = ProjectComment.SearchList(condition); if (comments != null && comments.Count > 0) { entity.ProjectComments = comments; var saveComment = comments.OrderByDescending(e => e.CreateTime) .FirstOrDefault(e => e.Status == ProjectCommentStatus.Save); if (saveComment != null) { entity.Comments = saveComment.Content; } } } return(Ok(entity)); }
public void CreateComment(CreateCommentInputModel createCommentInputModel) { var comment = new ProjectComment(createCommentInputModel.Content, createCommentInputModel.IdProject, createCommentInputModel.IdUser); _dbContext.ProjectComments.Add(comment); _dbContext.SaveChanges(); }
public IHttpActionResult GetLegalReview(string projectId, Guid?Id = null) { var tempClosure = TempClosureInfo.FirstOrDefault(tc => tc.ProjectId == projectId); var project = ProjectInfo.Get(projectId, FlowCode.TempClosure_LegalReview); var isActor = ProjectUsers.IsRole(projectId, ClientCookie.UserCode, ProjectUserRoleCode.AssetActor); TempClosureLegalReview entity; if (Id != null) { entity = TempClosureLegalReview.Get(Id.Value); } else { entity = TempClosureLegalReview.Get(projectId); } entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId); var nextRefTableId = new Guid(FlowInfo.GetRefTableId("TempClosurePackage", projectId)); var nextFlowStarted = ProjectInfo.Any(p => p.FlowCode == FlowCode.TempClosure_ClosurePackage && p.ProjectId == projectId && p.NodeCode != NodeCode.Start); //var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.TempClosure_LegalReview && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(entity.Id, "TempClosureLegalReview", ClientCookie.UserCode); var isLegalStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.TempClosure_LegalReview); return(Ok(new { Info = tempClosure, LegalReview = entity, ProjectComment = projectComment != null ? projectComment.Content : "", Editable = project.Status == ProjectStatus.Finished && isActor && !nextFlowStarted && !entity.IsHistory, Recallable = project.Status != ProjectStatus.Finished && isActor && !entity.IsHistory && isLegalStarted, Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.TempClosure_LegalReview) })); }
public ProjectCommentViewData(ProjectComment comment) { Id = comment.Id; UserName = comment.User.FullName; Text = comment.CommentText; Time = comment.CommentingDate.ToString("HH:mm dd.MM.yyyy"); }
public IHttpActionResult GetByProjectId(string projectId) { var entity = ClosureConsInvtChecking.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false); if (entity != null) { var closureInfo = ClosureInfo.GetByProjectId(projectId); entity.USCode = closureInfo.USCode; ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } if (string.IsNullOrEmpty(entity.PMSupervisor)) { var puser = ProjectUsers.FirstOrDefault(i => i.ProjectId == entity.ProjectId && i.RoleCode == ProjectUserRoleCode.CM); if (puser != null) { entity.PMSupervisor = puser.UserAccount; } } } return(Ok(entity)); }
private void AddProjectComment(ClosureConsInvtChecking entity, string action, ProjectCommentStatus status) { ProjectComment closureCommens = new ProjectComment(); closureCommens.RefTableId = entity.Id; closureCommens.RefTableName = ClosureConsInvtChecking.TableName; closureCommens.TitleNameENUS = ClientCookie.TitleENUS; closureCommens.TitleNameZHCN = ClientCookie.TitleENUS; closureCommens.TitleCode = ClientCookie.TitleENUS; closureCommens.CreateTime = DateTime.Now; closureCommens.CreateUserAccount = ClientCookie.UserCode; closureCommens.UserAccount = ClientCookie.UserCode; closureCommens.UserNameENUS = ClientCookie.UserNameENUS; closureCommens.UserNameZHCN = ClientCookie.UserNameZHCN; closureCommens.CreateUserNameZHCN = ClientCookie.UserNameZHCN; closureCommens.Id = Guid.NewGuid(); if (!string.IsNullOrEmpty(entity.Comments)) { closureCommens.Content = entity.Comments.Trim(); } closureCommens.Action = action; closureCommens.Status = status; if (entity.ProcInstID > 0) { closureCommens.ProcInstID = entity.ProcInstID; } closureCommens.SourceCode = FlowCode.Closure; closureCommens.SourceNameENUS = FlowCode.Closure; closureCommens.SourceNameZHCN = "关店流程"; closureCommens.Add(); }
public async Task <ActionResult> Details(int?id) { #region USERVALIDATION token = (string)(Session["accessToken"]); string userID = (string)(Session["UserID"]); #endregion if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <ProjectComment> projectComment = new List <ProjectComment>(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseurl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); HttpResponseMessage Res = await client.GetAsync($"api/ProjectComments/{id}"); if (Res.IsSuccessStatusCode) { var projectCommentResponse = Res.Content.ReadAsStringAsync().Result; ProjectComment myProjectComment = JsonConvert.DeserializeObject <ProjectComment>(projectCommentResponse); return(View(myProjectComment)); } else { this.AddNotification("Unable to display Project Comments,please contact Administrator" + Res, NotificationType.ERROR); return(View()); } } }
public async Task <ActionResult> Edit([Bind(Include = "ID,CommentTitle,CommentDescription,LocalFilePath,FileName,OrganizationID,ProjectID,CreatedDate,isDeleted,TimeStamp,UserId")] ProjectComment projectComment) { if (ModelState.IsValid) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseurl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); HttpResponseMessage Res = await client.PutAsJsonAsync($"api/ProjectComments/{projectComment.ID}", projectComment); if (Res.IsSuccessStatusCode) { this.AddNotification("comment modified successfully", NotificationType.SUCCESS); return(RedirectToAction("Index")); } else { this.AddNotification("comment cannot be modified at this time. Please contact Administrator", NotificationType.ERROR); return(View()); } } } ViewBag.OrganizationID = await OrganizationSelectListByModel(token, projectComment.OrganizationID); ViewBag.ProjectID = await ProjectSelectListByModel(token, projectComment.ProjectID); return(View(projectComment)); }
private void SaveCommers(ClosureLegalReview entity, string action, ProjectCommentStatus status) { //if (status == ProjectCommentStatus.Save) //{ var list = _db.ProjectComment.Where( c => c.CreateUserAccount == ClientCookie.UserCode && c.RefTableId == entity.Id && c.Status == ProjectCommentStatus.Save && c.RefTableName == ClosureLegalReview.TableName && c.SourceCode == FlowCode.Closure).ToList(); if (list.Count > 0) { ProjectComment closureCommens = list[0]; closureCommens.Content = entity.Comments == null ? "" : entity.Comments.Trim(); closureCommens.Status = status; if (entity.ProcInstID.HasValue && entity.ProcInstID.Value > 0) { closureCommens.ProcInstID = entity.ProcInstID; } ProjectComment.Update(closureCommens); } else { AddProjectComment(entity, action, status); } }
public async Task <Unit> Handle(CreateCommentCommand request, CancellationToken cancellationToken) { var projectComment = new ProjectComment(request.Content, request.IdProject, request.IdUser); await _projectRepository.AddCommentAsync(projectComment); return(Unit.Value); }
public IHttpActionResult GetById(string Id) { Guid _Id; if (!Guid.TryParse(Id, out _Id)) { return(Ok()); } var entity = ClosureWOCheckList.Get(_Id); if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); entity.USCode = closureEntity.USCode; entity.UserAccount = ClientCookie.UserCode; } return(Ok(entity)); }
public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <ProjectComment> projectComment = new List <ProjectComment>(); ProjectComment myProjectComment = new ProjectComment(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseurl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); HttpResponseMessage Res = await client.GetAsync($"api/ProjectComments/{id}"); if (Res.IsSuccessStatusCode) { var projectCommentResponse = Res.Content.ReadAsStringAsync().Result; myProjectComment = JsonConvert.DeserializeObject <ProjectComment>(projectCommentResponse); } else { this.AddNotification("Unable to display Comments,please contact Administrator" + Res, NotificationType.ERROR); return(View()); } } ViewBag.OrganizationID = await OrganizationSelectListByModel(token, myProjectComment.OrganizationID); ViewBag.ProjectID = await ProjectSelectListByModel(token, myProjectComment.ProjectID); return(View(myProjectComment)); }
public async Task <Result <ProjectComment> > AddComment(ProjectComment comment, APISession session) { try { using (var adapter = Adapter.Create()) { var commentEntity = new ProjectDiscussionEntity { MessageBody = comment.MessageBody, CommenterId = session.UserId, ProjectId = comment.ProjectId }; var result = await adapter.SaveEntityAsync(commentEntity, true); var meta = new LinqMetaData(adapter); comment.CommenterName = session.User.Name; comment.CommenterMobile = session.User.MobilePhone; return(Result <ProjectComment> .True(comment)); } } catch (Exception ex) { return(Result <ProjectComment> .False(ex)); } }
public void SaveComment(ProjectComment comment) { using (var repositoriesContainer = new LmPlatformRepositoriesContainer()) { repositoriesContainer.ProjectCommentsRepository.Save(comment); repositoriesContainer.ApplyChanges(); } }
public ActionResult DeleteProjectComment(int id) { ProjectComment projectComment = db.ProjectComments.Find(id); db.ProjectComments.Remove(projectComment); db.SaveChanges(); return(RedirectToAction("Index", "Default")); }
public async Task <Unit> Handle(CreateCommentCommand request, CancellationToken cancellationToken) { var comment = new ProjectComment(request.Content, request.ProjectId, request.UserId); await _projectRepository.CreateCommentAssync(comment); return(Unit.Value); }
public ActionResult AddProjectComment(int id, ProjectComment projectComment) { projectComment.ApplicationUserID = User.Identity.GetUserId(); projectComment.ProjectID = id; db.ProjectComments.Add(projectComment); db.SaveChanges(); return(RedirectToAction("Project", "Home", new { id = id })); }
public ActionResult DeleteProjectComment(int id) { ProjectComment projectComment = db.ProjectComments.Find(id); int projectId = projectComment.ProjectID; db.ProjectComments.Remove(projectComment); db.SaveChanges(); return(RedirectToAction("Project", "Home", new { id = projectId })); }
public int Create(CreateProjectCommentInputModel inputModel) { var projectComment = new ProjectComment(inputModel.Content, inputModel.IdProject, inputModel.IdUser); _dbContext.ProjectComments.Add(projectComment); _dbContext.SaveChanges(); return(projectComment.Id); }
public void TestIProjectCommentWorks() { var projectComment = new ProjectComment("Descricao Teste", 1, 2); Assert.NotNull(projectComment.Content); Assert.NotEmpty(projectComment.Content); Assert.NotNull(projectComment); }
private static FeedComment ToFeedComment(ProjectComment comment) { return(new FeedComment(comment.Comment.CreateBy) { Id = comment.Comment.OldGuidId.ToString(), Description = HtmlUtility.GetFull(comment.Comment.Content), Date = comment.Comment.CreateOn }); }
private static FeedComment ToFeedComment(ProjectComment comment) { return(new FeedComment(comment.Comment.CreateBy) { Id = comment.Comment.ID.ToString(), Description = HtmlSanitizer.Sanitize(comment.Comment.Content), Date = comment.Comment.CreateOn }); }
public async Task <Unit> Handle(SaveCommentCommand request, CancellationToken cancellationToken) { var comment = new ProjectComment(request.Content, request.IdProject, request.IdUser); await dBContext.ProjectComments.AddAsync(comment); await dBContext.SaveChangesAsync(); return(Unit.Value); }
private static ProjectComment ToComment(object[] r) { var p = new ProjectComment { Task = new Task { ID = Convert.ToInt32(r[0]), Title = Convert.ToString(r[1]), Description = Convert.ToString(r[2]), Priority = (TaskPriority)Convert.ToInt32(r[3]), Status = (TaskStatus)Convert.ToInt32(r[4]), StatusChangedOn = Convert.ToDateTime(r[5]), Milestone = Convert.ToInt32(r[6]), SortOrder = Convert.ToInt32(r[7]), Deadline = Convert.ToDateTime(r[8]), StartDate = Convert.ToDateTime(r[9]), CreateBy = new Guid(Convert.ToString(r[10])), CreateOn = Convert.ToDateTime(r[11]), LastModifiedBy = ToGuid(r[12]), LastModifiedOn = Convert.ToDateTime(r[13]), Responsibles = r[14] != null ? new List <Guid>(Convert.ToString(r[14]).Split(',').Select(x => new Guid(x))) : new List <Guid>(), Project = new Project { ID = Convert.ToInt32(r[15]), Title = Convert.ToString(r[16]), Description = Convert.ToString(r[17]), Status = (ProjectStatus)Convert.ToInt32(18), StatusChangedOn = Convert.ToDateTime(r[19]), Responsible = new Guid(Convert.ToString(r[20])), Private = Convert.ToBoolean(r[21]), CreateBy = new Guid(Convert.ToString(r[22])), CreateOn = Convert.ToDateTime(r[23]), LastModifiedBy = ToGuid(r[24]), LastModifiedOn = Convert.ToDateTime(r[25]), } } }; if (r[26] != null) { p.Comment = new Comment { OldGuidId = new Guid(Convert.ToString(r[26])), Content = Convert.ToString(r[27]), CreateBy = new Guid(Convert.ToString(r[28])), CreateOn = Convert.ToDateTime(r[29]), Parent = new Guid(Convert.ToString(r[30])), TargetUniqID = Convert.ToString(r[31]) }; } return(p); }
public async Task <ActionResult> Create([Bind(Include = "ID,CommentTitle,CommentDescription,LocalFilePath,FileName,OrganizationID,ProjectID,CreatedDate,isDeleted,TimeStamp,UserId")] ProjectComment projectComment) { #region USERVALIDATION token = (string)(Session["accessToken"]); string userID = (string)(Session["UserID"]); #endregion if (ModelState.IsValid) { HttpPostedFileBase file = Request.Files["file"]; string localfilepath = string.Empty; string filename = string.Empty; if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/DocumentManagement/ProjectComments"), fileName); file.SaveAs(path); localfilepath = clientpath + fileName; filename = fileName.ToString(); } ; projectComment.CreatedDate = DateTime.Now; projectComment.isDeleted = false; projectComment.LocalFilePath = localfilepath; projectComment.FileName = filename; projectComment.UserId = userID; using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseurl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); HttpResponseMessage Res = await client.PostAsJsonAsync("api/ProjectComments", projectComment); if (Res.IsSuccessStatusCode) { this.AddNotification("Comment Posted successfully", NotificationType.SUCCESS); return(RedirectToAction("Index")); } else { this.AddNotification("Comment cannot be posted at this time. Please contact Administrator" + Res, NotificationType.ERROR); return(View()); } } } ViewBag.OrganizationID = await OrganizationSelectListByModel(token, projectComment.OrganizationID); ViewBag.ProjectID = await ProjectSelectListByModel(token, projectComment.ProjectID); return(View(projectComment)); }
public static ProjectComment MapProjectCommentModel(ProjectCommentModel model) { var coreModel = new ProjectComment(); coreModel.Id = model.Id; coreModel.ProjectCommentAreaId = model.ProjectCommentAreaId; coreModel.ProjectCommentTypeId = model.ProjectCommentTypeId; coreModel.ProjectId = model.ProjectId; coreModel.Date = model.Date.GetMyLocalTime(); coreModel.Text = model.Text; return(coreModel); }
public ProjectCommentView CreateComment(ProjectComment comment) { using (SqlConnection conn = SqlHelper.GetOpenConnection()) { var par = new DynamicParameters(); par.Add("@ProjectId", comment.ProjectId); par.Add("@UserId", IdentityContext.Current.User.Id); par.Add("@ProjectCommentAreaId", comment.ProjectCommentAreaId); par.Add("@ProjectCommentTypeId", comment.ProjectCommentTypeId); par.Add("@Text", comment.Text); return(conn.Query <ProjectCommentView>("[CreateProjectComment]", par, commandType: CommandType.StoredProcedure).FirstOrDefault()); } }
public IHttpActionResult GetClosureCommers(string userAccount, string refTableName, Guid refTableId) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.SourceCode = FlowCode.Closure; condition.UserAccount = userAccount; condition.RefTableId = refTableId; ProjectComment.SearchList(condition); var list = _db.ProjectComment.Where(e => e.RefTableName == refTableName && e.RefTableId == refTableId && string.IsNullOrEmpty(e.Content) && e.SourceCode == "Closure").OrderByDescending(e => e.CreateTime); return(Ok(list)); }
public async Task <ActionResult <ProjectComment> > AddComment(ProjectComment comment) { var session = _identityService.GetUserSessionInfo(Request.HttpContext); var result = await _projectDiscussionRepository.AddComment(comment, session); if (result.IsFalse) { return(StatusCode(500, result.ExceptionObject)); } return(Ok(result.Value)); }
public void SaveComment(string comment) { var currentUserId = WebSecurity.CurrentUserId; var newComment = new ProjectComment { CommentText = comment, ProjectId = ProjectId, UserId = currentUserId, CommentingDate = DateTime.Now }; ProjectManagementService.SaveComment(newComment); }
public void Update(ProjectComment model) { if (model == null) throw new ArgumentNullException("message"); projectCommentRepository.Update(model); }
public void AddProjectComment(ProjectComment projectComment) { this.projectComments.Add(projectComment); this.projectComments.Save(); }
public void HardDeleteProjectComment(ProjectComment projectComment) { this.projectComments.HardDelete(projectComment); this.projectComments.Save(); }