public void ICanUpdateASpecificInspectionReport()
        {
            IInspectionReportService service = new InspectionReportService(_repo, _unit);
            DateTime dateNow = DateTime.Now;

            var tempReport = new InspectionReport
            {
                InspectionNo          = "ABCDEF",
                InspectionDate        = dateNow,
                StructureNo           = "000000",
                DeckType              = "SandPaper",
                IsMaintenanceRequired = true,
                IsHighwayBridge       = true
            };

            service.UpdateInspectionReport(tempReport);

            var result = service.GetInspectionReportByInspectionNo("ABCDEF");

            Assert.IsTrue(result.Count() == 1);

            var report = result.FirstOrDefault();

            Assert.IsTrue(report.InspectionNo == tempReport.InspectionNo);
            Assert.IsTrue(report.DeckType == tempReport.DeckType);
            Assert.IsTrue(report.InspectionDate == tempReport.InspectionDate);
            Assert.IsTrue(report.IsHighwayBridge == tempReport.IsHighwayBridge);
            Assert.IsTrue(report.IsMaintenanceRequired == tempReport.IsMaintenanceRequired);
            Assert.IsTrue(report.StructureNo == tempReport.StructureNo);
        }
示例#2
0
        public Task ReceiveAsync(IContext context)
        {
            switch (context.Message)
            {
            case LogMessage log:
            {
                _logs.Add(log);
                break;
            }

            case InspectionReport report:
            {
                _state = report;
                break;
            }

            case TrackedMessage message:
            {
                _messages.Add(message);
                break;
            }

            case QueryLogsAndMessages q:
            {
                var data = new LogsAndMessagesData();
                data.Messages.Add(_messages);
                data.Logs.Add(_logs);

                context.Tell(context.Sender, data);
                break;
            }
            }
            return(Actor.Done);
        }
示例#3
0
        private IInspectionReport CreateReport(IContext context)
        {
            foreach (var child in context.Children)
            {
                child.Request(Inspect.Instance, context.Sender);
            }

            var report = InspectionReport
                         .Create(context)
                         .Add("kernel::name", __name)
                         .Add("kernel::actorType", GetType().FullName)
                         .Add("kernel::status", __currentStatus)
                         .Add("kernel::uptime", DateTime.UtcNow - __created)
                         .Add("kernel::receivedMessages", __receivedMessages);

            if (__restartCount > 0)
            {
                report.Add("kernel::restarts", __restartCount);
            }

            if (__group != null)
            {
                report.Add("kernel::group", __group);
            }

            OnReport(report);
            return(report);
        }
示例#4
0
 public InspectionReportAck PushReport(InspectionReport req)
 {
     return(new InspectionReportAck()
     {
         result = new Model.ServiceModel.Result()
         {
             code = 0, message = "OK"
         }
     });
 }
示例#5
0
        public Node(InspectionReport report, bool recursive) : this(report.Pid.ToShortString(), recursive)
        {
            Timestamp = UnixEpoch.AddMilliseconds(report.MillisFromEpoch).ToLocalTime();

            foreach (var keyValuePair in report.Status)
            {
                this.Status[keyValuePair.Key] = keyValuePair.Value;
            }

            this.Warnings = report.Warnings.ToList();
        }
示例#6
0
        public void Update(InspectionReport entityToUpdate)
        {
            var report = _mockData.Where(r => r.InspectionNo == entityToUpdate.InspectionNo).FirstOrDefault();

            if (report != null)
            {
                var idx = _mockData.IndexOf(report);
                if (idx >= 0)
                {
                    _mockData[idx] = entityToUpdate;
                }
            }
        }
 public void Initialize()
 {
     _repo   = new MockInspectionReportRepository();
     _unit   = Substitute.For <IUnitOfWork>();
     _report = new InspectionReport
     {
         InspectionNo          = "ABCDEF",
         InspectionDate        = new DateTime(2016, 06, 12, 00, 00, 00),
         StructureNo           = "354891",
         DeckType              = "Earth",
         IsMaintenanceRequired = false,
         IsHighwayBridge       = false
     };
 }
示例#8
0
        public static void SaveToXaml(IEnumerable <InspectionResult> tasks, string dir,
                                      string suffix = null)
        {
            var report = new InspectionReport();

            foreach (var task in tasks)
            {
                report.Results.Add(task);
            }

            DateTime dateTime = DateTime.Now;
            var      fileName = dateTime.ToString("yyyy-MM-dd_HH.mm.ss_") + suffix + "" + ".xaml";
            //            var reportsDir = Path.Combine(dir, "_reports" + dateTime.ToString("_yyyy-MM-dd_HH.mm.ss"));
            var fileFullName = Path.Combine(dir, fileName);

            report.SerializeToXamlFile(fileFullName);
        }
        public IActionResult Put([FromBody] InspectionReport report)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _inspectionReportService.UpdateInspectionReport(report);
                    return(Ok(new { Result = "Success" }));
                }
                catch
                {
                    return(BadRequest(new { ErrorMessage = "Could not update report" }));
                }
            }

            return(BadRequest(new { ErrorMessage = "Model state was invalid" }));
        }
示例#10
0
        public async Task <InspectionReportMap> GetReportAsync(string clientId)
        {
            if (clientId != null && _roots.TryGetValue(clientId, out var node))
            {
                return(await node.RequestAsync <InspectionReportMap>(new InspectionReportRequest()).ConfigureAwait(false));
            }

            var report = new InspectionReportMap();

            var inspectionReport = new InspectionReport
            {
                Pid = new PID("nonhost", clientId ?? "Demo")
            };

            inspectionReport.Status.Add("kernel::name", "Name");
            inspectionReport.Status.Add("kernel::actorType", "ActorType");
            inspectionReport.Status.Add("kernel::status", "Started");

            report.Reports.Add("root", inspectionReport);

            return(report);
        }
示例#11
0
        void m_RepCon1_NewReport(object sender, ReportConnectionEventArgs e)
        {
            // Get the Inspection report
            report = e.Report;
            // Get Number of Blobs
            bool status;
            long numBlobs;

            status        = report.Results[0].AsBool;
            textBox1.Text = status.ToString();
            numBlobs      = report.Results[1].AsInt;
            textBox2.Text = numBlobs.ToString();

            //does our report contain any images, if so display it?
            if (report.Images.Count > 0)
            {
                //extract the image as a BufferDm,
                //and set it into the Buffer View
                BufferView1.Buffer = (BufferDm)report.Images[0];
            }

            // This is a good place to collect unused memory
            GC.Collect();
        }
示例#12
0
 public void Insert(InspectionReport entity)
 {
     throw new NotImplementedException();
 }
示例#13
0
 public void Delete(InspectionReport entityToDelete)
 {
     throw new NotImplementedException();
 }
示例#14
0
 public void UpdateInspectionReport(InspectionReport report)
 {
     _inspectionReportRepository.Update(report);
     _unitOfWork.SaveChanges();
 }
示例#15
0
        public InspectionReportAck PushReport(InspectionReport req)
        {
            Uri uri = new Uri(ServiceURL.UrlINspectionReport);

            return(request <InspectionReport, InspectionReportAck> .executePost(req, uri));
        }