Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        protected override void OnClosing(CancelEventArgs e)
        {
            if (CurrentUserNotifications.CurrentUser != null)
            {
                ESB2Login.Logout(CurrentUserNotifications.CurrentUser);
            }

            if (ESB2db.GetDatabase().ChangeTracker.HasChanges())
            {
                ESB2db.GetDatabase().SaveChanges();
            }

            base.OnClosing(e);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        private void MainWindowKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.F2:
                CurrentUserNotifications.SendNotification(ESB2Login.Login());
                break;

            case Key.Escape:
                if (CurrentUserNotifications.CurrentUser != null)
                {
                    CurrentUserNotifications.SendNotification(ESB2Login.Logout(CurrentUserNotifications.CurrentUser));
                }

                if (ESB2db.GetDatabase().ChangeTracker.HasChanges())
                {
                    ESB2db.GetDatabase().SaveChanges();
                }

                break;
            }
        }
Exemplo n.º 6
0
 public MainWindow()
 {
     ESB2db.InitializeDatabase();
     InitializeComponent();
     CurrentUserNotifications.SendNotification(null);
 }
Exemplo n.º 7
0
 protected override void OnClosing(CancelEventArgs e)
 {
     ESB2db.Save();
     base.OnClosing(e);
 }
Exemplo n.º 8
0
 public MainWindow()
 {
     ESB2db.InitializeDatabase();
     InitializeComponent();
 }