private void ModifyEventClick(object sender, RoutedEventArgs e)
        {
            var outage = (Outage)scheduledOutages.SelectedItem;

            var startMonth = int.Parse(startDate.Text.Substring(0, 2));
            var startDay   = int.Parse(startDate.Text.Substring(3, 2));
            var startYear  = int.Parse(startDate.Text.Substring(6, 4));
            var startHour  = int.Parse(startTime.Text.Substring(0, 2));
            var startMin   = int.Parse(startTime.Text.Substring(2, 2));

            var endMonth = int.Parse(endDate.Text.Substring(0, 2));
            var endDay   = int.Parse(endDate.Text.Substring(3, 2));
            var endYear  = int.Parse(endDate.Text.Substring(6, 4));
            var endHour  = int.Parse(endTime.Text.Substring(0, 2));
            var endMin   = int.Parse(endTime.Text.Substring(2, 2));

            outage.Start = new DateTime(startYear, startMonth, startDay, startHour, startMin, 0, DateTimeKind.Utc);
            outage.End   = new DateTime(endYear, endMonth, endDay, endHour, endMin, 0, DateTimeKind.Utc);

            outage.Updates.Add(new OutageUpdate()
            {
                Timestamp = DateTime.Now,
                UpdateBy  = CurrentUser.currentUser,
                Update    = "Event Modified."
            });

            ESB2db.Save();
            RefreshData();
        }
        private void CancelEventClick(object sender, RoutedEventArgs e)
        {
            ((Outage)scheduledOutages.SelectedItem).Canceled = true;
            ((Outage)scheduledOutages.SelectedItem).Updates.Add(new OutageUpdate()
            {
                Timestamp = DateTime.Now,
                UpdateBy  = CurrentUser.currentUser,
                Update    = "Event Canceled"
            });

            ESB2db.Save();
            RefreshData();
        }
        private void EventCompleteClick(object sender, RoutedEventArgs e)
        {
            ((Outage)scheduledOutages.SelectedItem).Completed = true;
            foreach (var equipment in ((Outage)scheduledOutages.SelectedItem).Equipment)
            {
                equipment.EquipmentStatus = EquipmentStatus.Operational;
            }

            ((Outage)scheduledOutages.SelectedItem).Updates.Add(new OutageUpdate()
            {
                Timestamp = DateTime.Now,
                UpdateBy  = CurrentUser.currentUser,
                Update    = "Event Completed"
            });

            ESB2db.Save();
            RefreshData();
        }
Beispiel #4
0
 protected override void OnClosing(CancelEventArgs e)
 {
     ESB2db.Save();
     base.OnClosing(e);
 }