public async Task <SolutionComment> AddSolutionComment(SolutionComment comment) { comment.DateAdded = DateTime.UtcNow; comment = _dbContext.SolutionComments.Add(comment); await _dbContext.SaveChangesAsync(); return(comment); }
public SolutionCommentComponent() { mifnexsoEntities = new MIFNEXSOEntities(); solutionComment = new SolutionComment(); solutionComment.Comment_Id = Guid.Empty; solutionComment.SolutionId = Guid.Empty; mifnexsoEntities.SolutionComments.AddObject(solutionComment); }
public SolutionCommentComponent(Guid guid) { mifnexsoEntities = new MIFNEXSOEntities(); try { if (guid != Guid.Empty) { solutionComment = mifnexsoEntities.SolutionComments.FirstOrDefault(a => a.Comment_Id == guid); } else { solutionComment = new SolutionComment(); solutionComment.SolutionId = Guid.Empty; solutionComment.Comment_Id = Guid.Empty; mifnexsoEntities.SolutionComments.AddObject(solutionComment); } } catch (Exception) { throw; } }
private void btnFinished_Click(object sender, EventArgs e) { if (f.QuickGetStatus(RecordIdtemp) < cstfinished) { try { int temp = rowTemp; Line li = new Line(); li.setLineId(LineIdTemp); li.Load(); String failName = failNameTemp; String failGroup = f.getFailGroup(failName); bool isSendMail = false; if (cbSendMail.Checked) { isSendMail = true; } //string des= gvProblem.Rows[temp].Cells[po].Value; SolutionComment comment = new SolutionComment(isSendMail, employee.getOpName(), li.getMailTo(Convert.ToInt32(gvProblem.Rows[temp].Cells[groupFailIndex].Value)), li.getMailCC(Convert.ToInt32(gvProblem.Rows[temp].Cells[groupFailIndex].Value)), failGroup, li.getLineId(), failName, "des", cstprocessing, li.getUpperLevelMail().Split(';').ToList(), RecordIdtemp, "PO", "Model", "Marterial"); comment.ShowDialog(); LoadData(); checkLight(); //gvProblem.ClearSelection(); //gvProblem.Rows[temp].Selected = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Sự cố đã được xử lý"); LoadData(); } }
public Boolean GetPushSolutionReply([FromBody] JObject jObject) { dynamic json = jObject; int solutionid = json.solutionid; String comment = json.comment; int userid = json.userid; using (LOJEntities3 entity = new LOJEntities3()) { SolutionComment solutionComment = new SolutionComment() { solutionid = solutionid, comment = comment, userid = userid, date = DateTime.Now.ToString() }; using (TransactionScope tran = new TransactionScope()) { try { entity.SolutionComments.Add(solutionComment); if (entity.SaveChanges() > 0) { tran.Complete(); return(true); } else { return(false); } } catch (Exception e) { return(false); } } } }