コード例 #1
0
        [ValidateAntiForgeryToken] //防止跨網站偽造請求攻擊
        public ActionResult Delete(decimal Seq, string ReportType)
        {
            SI_ResearcherVisit visit = visitService.Get(Seq);

            if (visit != null)
            {
                visitService.Delete(visit);
            }
            //ResearcherVisitRepository.Delete(visit);

            try
            {
                if (ReportType.Equals("2") || ReportType.Equals("3"))
                {
                    SI_StocksReport Stocks = reportService.Get(Seq);
                    if (Stocks != null)
                    {
                        reportService.Delete(Stocks);
                    }

                    //SIReportRepository.Delete(Stocks);
                }
            }
            catch (Exception ex)
            {
                TempData["SuccessYN"] = "刪除失敗";
                return(View("Index"));

                throw;
            }
            TempData["SuccessYN"] = "刪除成功";
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task Can_Create_Visit()
        {
            var visit = await Service.Post(GetCreateVisit);

            visit.Should().NotBeNull();
            visit.Id.Should().BeGreaterThan(0);

            var getVisit = await Service.Get(new GetVisitById { Id = visit.Id });

            getVisit.Should().NotBeNull();
            getVisit.Id.Should().Be(visit.Id);
        }
コード例 #3
0
        public ActionResult Edit(Guid visitId, Guid patientId)
        {
            var baseObject = GetBaseObject();

            var visit   = _visitService.Get(visitId);
            var patient = _patientService.Get(patientId);

            IList <Application.EntityViews.MeasurementTool> measurementTools = _visitService.GetMeasurementToolsOfVisit(visitId);
            IList <Application.EntityViews.TeamMember>      teamMembers      = _patientService.ListTeamMembers(patientId);
            IList <Guid> scoreValues = _visitService.GetVisitScoreValues(visitId);

            if (!patient.CanAccess(baseObject.User, teamMembers, baseObject.User.Permissions))
            {
                throw new BusinessRuleException("You are not autorized to view this patient");
            }

            return(View(new ViewObjects.Visit.Create(baseObject)
            {
                Visit = visit,
                Patient = patient,
                MeasurementTools = measurementTools,
                ScoreValues = scoreValues.ToArray()
            }));
        }