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(); }
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); } }
private void SaveCommers(ClosureWOCheckList 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 == ClosureWOCheckList.TableName && c.SourceCode == FlowCode.Closure).ToList(); if (list.Count > 0) { ProjectComment closureCommens = list[0]; if (!string.IsNullOrEmpty(entity.Comments)) { closureCommens.Content = entity.Comments.Trim(); } _db.ProjectComment.Attach(closureCommens); _db.Entry(closureCommens).State = EntityState.Modified; } else { AddProjectComment(entity, action, status); } } else { var list = _db.ProjectComment.Where(c => c.CreateUserAccount == ClientCookie.UserCode && c.RefTableId == entity.Id && c.Status == ProjectCommentStatus.Save && c.RefTableName == ClosureWOCheckList.TableName && c.SourceCode == FlowCode.Closure).ToList(); if (list.Count > 0) { ProjectComment closureCommens = list[0]; if (!string.IsNullOrEmpty(entity.Comments)) { closureCommens.Content = entity.Comments.Trim(); } closureCommens.Status = ProjectCommentStatus.Submit; _db.ProjectComment.Attach(closureCommens); _db.Entry(closureCommens).State = EntityState.Modified; } else { AddProjectComment(entity, action, status); } } _db.SaveChanges(); }
private void SaveCommers(ClosureConsInvtChecking entity, string action, ProjectCommentStatus status) { if (status == ProjectCommentStatus.Save) { var list = ProjectComment.Search( c => c.CreateUserAccount == ClientCookie.UserCode && c.RefTableId == entity.Id && c.Action == action && c.RefTableName == ClosureConsInvtChecking.TableName && c.SourceCode == FlowCode.Closure).ToList(); if (list.Count > 0) { ProjectComment closureCommens = list[0]; closureCommens.Content = entity.Comments.Trim(); ProjectComment.Update(closureCommens); } else { AddProjectComment(entity, action, status); } } else { AddProjectComment(entity, action, status); } }