Example #1
0
        public void InterventionCompletedNotActiveTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.AreNotEqual(a.IsActive(), a.IsCompleted());
        }
Example #2
0
        public void InterventionIsCompletedTrueTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.IsTrue(a.IsCompleted());
        }
Example #3
0
        public void InterventionIsActivefalseTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.IsFalse(a.IsActive());
        }
Example #4
0
        public void StatisticsSetNoOfInterventionsTest()
        {
            Statistics   statistics = new Statistics();
            Intervention i          = new Intervention();

            i.setTimeOfCall(DateTime.Now);
            statistics.setNumberOfInterventions();
            Assert.AreEqual(statistics.numberOfOngoingInterventions, 1);
            i.Completed();
            statistics.setNumberOfInterventions();
            Assert.AreEqual(statistics.numberOfCompletedInterventions, 1);
        }
        //Submitting end of intervention
        private void EndIntervention(object sender, RoutedEventArgs e)
        {
            try
            {
                int      hh      = int.Parse(Endhh.Text);
                int      mm      = int.Parse(Endmm.Text);
                DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hh, mm, DateTime.Now.Second);
                int      offset  = (int)DateTime.Now.Subtract(endTime).TotalMinutes;

                List <Resource> resources = this.intervention.getResourceList();

                if (offset < 0)
                {
                    MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_FutureTime);
                }
                else
                {
                    ComboBoxItem conclusion = (ComboBoxItem)ConclusionBox.SelectedItem;

                    if (Grid.GetColumnSpan(ComboBoxBorder) == 1 && AdditionalInformation.Text.Equals(""))
                    {
                        MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_NoConclusion);
                    }
                    else
                    {
                        intervention.Completed();
                        intervention.setConclusionTime(endTime);
                        if (Grid.GetColumnSpan(ComboBoxBorder) == 1)
                        {
                            intervention.setConclusionAdditionalInfo(AdditionalInformation.Text);
                        }
                        interventionForm.CompleteIntervention(offset);
                    }
                }
                intervention.ResourceModified();
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_InvalidTime);
            }
        }