//Setup initial form
        private void FillForm(Intervention intervention)
        {
            AdditionalInformation.Text = intervention.getConclusionAdditionalInfo();

            if (intervention.getConclusion() != null)
            {
                int index = 0;
                foreach (ComboBoxItem cb in ConclusionBox.Items)
                {
                    index++;
                    if (cb.Content.ToString() == intervention.getConclusion())
                    {
                        break;
                    }
                }
                ConclusionBox.SelectedIndex = index - 1;
            }

            if (intervention.getConclusionTime().Hour != 0 && intervention.getConclusionTime().Minute != 0)
            {
                TextBoxHandler.setTime(Endhh, Endmm, intervention.getConclusionTime().Hour, intervention.getConclusionTime().Minute);
            }
            if (intervention.getConclusion() == Properties.Resources.ComboBoxItem_Conclusion_911)
            {
                if (intervention.getCall911Time().Hour != 0 && intervention.getCall911Time().Minute != 0)
                {
                    TextBoxHandler.setTime(Call911hh, Call911mm, intervention.getCall911Time().Hour, intervention.getCall911Time().Minute);
                }
                if (intervention.getFirstResponderArrivalTime().Hour != 0 && intervention.getFirstResponderArrivalTime().Minute != 0)
                {
                    TextBoxHandler.setTime(FirstResponderArrivalhh, FirstResponderArrivalmm, intervention.getFirstResponderArrivalTime().Hour, intervention.getFirstResponderArrivalTime().Minute);
                }

                if (intervention.getAmbulanceArrivalTime().Hour != 0 && intervention.getAmbulanceArrivalTime().Minute != 0)
                {
                    TextBoxHandler.setTime(AmbulanceArrivalhh, AmbulanceArrivalmm, intervention.getAmbulanceArrivalTime().Hour, intervention.getAmbulanceArrivalTime().Minute);
                }

                AmbulanceCompany.Text      = intervention.getAmbulanceCompany();
                AmbulanceVehicle.Text      = intervention.getAmbulanceVehicle();
                FirstResponderCompany.Text = intervention.getFirstResponderCompany();
                FirstResponderVehicle.Text = intervention.getFirstResponderVehicle();
                MeetingPoint.Text          = intervention.getMeetingPoint();
            }
        }
Beispiel #2
0
        public void InterventionSetAmbulanceArrivalTimeTest()
        {
            Intervention a   = new Intervention();
            DateTime     now = DateTime.Now;

            a.setCall911Time(now);
            a.setAmbulanceArrivalTime(now);
            Assert.AreEqual(now, a.getAmbulanceArrivalTime());
        }
        //Method runs every second
        public void Refresh(object sender, EventArgs e)
        {
            TimeSpan elapsed;
            bool     ongoing = true;

            if (intervention.IsCompleted())
            {
                elapsed = intervention.getConclusionTime() - intervention.getTimeOfCall();
                ongoing = false;
            }
            else
            {
                elapsed = DateTime.Now - intervention.getTimeOfCall();
            }
            UpdateTimer(elapsed, interventionTimer, interventionStatus, ongoing, interventionDeadline);

            if (intervention.getFirstResponderArrivalTime() != DateTime.MinValue || intervention.getAmbulanceArrivalTime() != DateTime.MinValue)
            {
                if (intervention.getFirstResponderArrivalTime() != DateTime.MinValue)
                {
                    ongoing = false;
                    elapsed = intervention.getFirstResponderArrivalTime() - intervention.getCall911Time();
                    UpdateTimer(elapsed, timerFR, statusFR, ongoing, interventionDeadline);
                }
                else
                {
                    ongoing = true;
                    elapsed = DateTime.Now - intervention.getCall911Time();
                    UpdateTimer(elapsed, timerFR, statusFR, ongoing, interventionDeadline);
                }
                if (intervention.getAmbulanceArrivalTime() != DateTime.MinValue)
                {
                    ongoing = false;
                    elapsed = intervention.getAmbulanceArrivalTime() - intervention.getCall911Time();
                    UpdateTimer(elapsed, timerAmbulance, statusAmbulance, ongoing, interventionDeadline);
                }
                else
                {
                    ongoing = true;
                    elapsed = DateTime.Now - intervention.getCall911Time();
                    UpdateTimer(elapsed, timerAmbulance, statusAmbulance, ongoing, interventionDeadline);
                }
            }
            else
            {
                if (intervention.getCall911Time() != DateTime.MinValue)
                {
                    ongoing = true;
                    elapsed = DateTime.Now - intervention.getCall911Time();
                }
                UpdateTimer(elapsed, timer911, status911, ongoing, interventionDeadline);
            }

            foreach (Resource resource in resourceList)
            {
                ongoing = true;
                if (resource.hasArrived())
                {
                    elapsed = resource.getArrivalTime() - resource.getMovingTime();
                    ongoing = false;
                }
                else
                {
                    elapsed = DateTime.Now - resource.getMovingTime();
                }
                UpdateTimer(elapsed, resourceTimerDictionary[resource], resourceStatusDictionary[resource], ongoing, movingDeadline);
            }
        }