public async Task <IActionResult> PutReportComment(Guid id, ReportComment reportComment) { if (id != reportComment.Id) { return(BadRequest()); } _context.Entry(reportComment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReportCommentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void SetUp() { request = new AddReportCommentRequest { ReportId = "id" }; reportComment = new ReportComment(); report = new Report(); reportCommentService = new Mock <IReportCommentService>(); reportValidationHub = new Mock <IReportValidationHub>(); reportManager = new Mock <IReportManager>(); var notifier = new Mock <INotifier>(); var hubManager = new Mock <IHubManager <NotifierHub> >(); mapper = new Mock <IMapper>(); reportCommentService.Setup(rcs => rcs.AddComment(request)).ReturnsAsync(reportComment); reportValidationHub.Setup(rvh => rvh.ValidateAndReturnReport(It.IsNotNull <string>(), It.IsAny <ReportPermission[]>())) .ReturnsAsync(report); reportManager.Setup(rm => rm.ChangeStatus(It.IsAny <ReportStatusType>(), report)).ReturnsAsync(true); addReportCommentCommand = new AddReportCommentCommand(reportCommentService.Object, reportValidationHub.Object, reportManager.Object, notifier.Object, hubManager.Object, mapper.Object); }
public void FindReportComments() { _reportComment = _report.AddComment(DataEntryUnitTestFixture.IdentityId, "User1", "Description1"); var reportComments = _reportCommentQueryService.FindReportComments(It.IsAny <Guid>()); reportComments.Should().NotBeEmpty(); reportComments.Count.Should().Be(2); }
public IActionResult CreateComment(ReportComment reportcomment) { reportcomment.IsDeleted = false; reportcomment.IsAdminRead = false; reportcomment.CreateDate = DateTime.Now; reportcomment.UserID = _userService.GetUserIDByUserName(User.Identity.Name); _reportService.AddComment(reportcomment); return(View("ShowComment", _reportService.ReportComments(reportcomment.ReportID))); }
public void SetModified() { var newGuid = Guid.NewGuid(); var reportCommentObj = new ReportComment(newGuid, "abc"); reportCommentObj.SetModified(newGuid); reportCommentObj.ModifiedOn.Should().BeOnOrBefore(DateTime.Now); reportCommentObj.ModifiedBy.Should().Be(newGuid); }
public void ClassSetUp() { _factory = new MockRepository(MockBehavior.Loose); _reportsUnitOfWork = _factory.Create <IReportsUnitOfWork>(); _report = new ReportDerived(DataEntryUnitTestFixture.IdentityId, DataEntryUnitTestFixture.AgencyDetails.Id, Guid.NewGuid(), Guid.NewGuid(), ModuleType.Arrest, false); _reportComment = _report.AddComment(DataEntryUnitTestFixture.IdentityId, "User", "Description"); _reportsUnitOfWork.Setup(mock => mock.FindAndInclude <Report>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())).Returns(_report); _reportCommentQueryService = new ReportCommentQueryService(_reportsUnitOfWork.Object, Mock.Of <ILog>(), Mock.Of <IServiceAuthorizationPolicy>(), Mock.Of <IServiceIdentityProvider>()); }
public async Task <ActionResult <ReportComment> > PostReportComment(ReportComment reportComment) { _context.ReportComments.Add(reportComment); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ReportCommentExists(reportComment.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetReportComment", new { id = reportComment.Id }, reportComment)); }
public void AddComment(ReportComment comment) { _context.ReportComments.Add(comment); _context.SaveChanges(); }
protected void Button1_Click(object sender, EventArgs e) { using (WebClient client = new WebClient()) { client.Headers.Add("user-agent", "Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; rv: 11.0) like Gecko"); //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); client.Headers.Add("Authorization", "SNAeoB88JTmAXfNTAfpR"); try { string response = client.DownloadString("https://sandbox.apply-for-teacher-training.service.gov.uk/api/v1"); } catch (Exception e2) { string s5455 = e2.ToString(); s5455 = e2.InnerException.ToString(); } } return; ISAMS_ExamStudentAccessList list44 = new ISAMS_ExamStudentAccessList(); list44.load(18); ISAMS_ExamSeatingPlan_List list33 = new ISAMS_ExamSeatingPlan_List(); list33.Load(18); // ISAMS_Set_PTOList Leena = new ISAMS_Set_PTOList(); // Leena.load(12); return; ExamComponentResultList ecrl1 = new ExamComponentResultList(); ecrl1.Load_OptionStudent(new Guid("d22c0f3e-38ff-4a81-9c00-dc7892548f68"), new Guid("fbbd073f-b4cd-4fb1-a12f-e3a755e7cc63")); string s = ""; foreach (ExamComponentResult r in ecrl1.m_list) { s = r.ComponentStatus; } Response.Redirect("../studentinformation/ComponentResults.aspx?StudentId=fbbd073f-b4cd-4fb1-a12f-e3a755e7cc63 &OptionId=d22c0f3e-38ff-4a81-9c00-dc7892548f68"); TT_compare(); return; //call from button.. RegistrationsList r1 = new RegistrationsList(); r1.Get_Recent_Registrations("6368"); foreach (Registrations r in r1.Registrations) { TextBox1.Text += r.m_date.ToString() + " " + r.m_staff + Environment.NewLine; } return; List <string> test3 = Get_Registrations("6368"); foreach (string s4 in test3) { TextBox1.Text += s4 + Environment.NewLine; } return; IntPtr token = IntPtr.Zero; string adno = "6368"; bool isSuccess = LogonUser("test-staff", "challoners", "123Password", LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, ref token); using (WindowsImpersonationContext person = new WindowsIdentity(token).Impersonate()) { string path1 = @"\\registration.challoners.net\STEARsoft\Reg\data\cc\testfile.txt"; //StreamReader sr1 = new StreamReader(path1); //string s = sr1.ReadLine(); //Label4.Text = s; //s = s; int i = 0; s = ""; int imax = 0; string sfile = ""; string[] fileEntries = Directory.GetFiles(@"\\registration.challoners.net\STEARsoft\Reg\data", "attend*.csv"); foreach (string fileName in fileEntries) { //find last one! s = fileName.Substring(fileName.IndexOf("log")); try { s = s.Substring(3, 2); i = System.Convert.ToInt32(s); if (i > imax) { imax = i; sfile = fileName; } } catch { try { s = s.Substring(3, 3); i = System.Convert.ToInt32(s); if (i > imax) { imax = i; sfile = fileName; } } catch { } } } if (imax > 0) { string s1 = ""; Label4.Text = sfile; StreamReader sr1 = new StreamReader(sfile); while (!sr1.EndOfStream) { s = sr1.ReadLine(); string[] fred = s.Split((char)(',')); if (fred[4] == adno) { s1 = fred[11]; } } } person.Undo(); } return; //adno first name surname StudentId CourseId StaffId CommentType poliyID text Cerval_Library.TextReader text1 = new Cerval_Library.TextReader(); Cerval_Library.TextRecord t = new TextRecord(); string path = Server.MapPath(@"../App_Data/test.txt"); FileStream f = new FileStream(path, FileMode.Open); text1.ReadTextLine(f, ref t);//header row while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID) { ReportComment r = new ReportComment(); r.m_studentId = new Guid(t.field[3]); r.m_courseId = new Guid(t.field[4]); r.m_staffId = new Guid(t.field[5]); r.m_commentType = System.Convert.ToInt32(t.field[6]); r.m_dateCreated = DateTime.Now; r.m_dateModified = r.m_dateCreated; r.m_collectionOutputPolicyId = new Guid(t.field[7]); r.m_content = t.field[8]; r.Save(); } f.Close(); }
public void OnGet(int id) { Comment = _reportService.GetCommentForAdmin(id); }
public ReportComment Create(Guid reportId, ReportComment comment) { comment.Id = _ireportCommentCommandService.CreateReportComment(reportId, comment.Description); return(comment); }
private void SetUpReportComment() { _reportComment = new ReportComment(identityContext.IdentityId, "User"); _reportsUnitOfWork.Setup(mock => mock.Find <ReportComment>(It.IsAny <Guid>(), It.IsAny <TrackingMode>(), It.IsAny <ThrowIf>())) .Returns(_reportComment); }
public void OnGet(int id) { Comment = _reportService.GetCoomentForHeal(id); }