1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- namespace school
- {
- /// <summary>
- /// Логика взаимодействия для pageServiceNearRecord.xaml
- /// </summary>
- public partial class pageServiceNearRecord : Page
- {
- DispatcherTimer timer = new DispatcherTimer();
- public pageServiceNearRecord()
- {
- InitializeComponent();
- timer.Interval = new TimeSpan(0,0,30); //таймер на 30 секунд
- timer.Tick += update;
- init();
- timer.Start();
- }
- private void update(object sender, EventArgs e)
- {
- init();
- }
- private void init()
- {
- DateTime now = DateTime.Now;
- DateTime tomorrow = DateTime.Today.AddDays(2); //конец завтрашнего дня
- List<ClientService> list = baseConnect.thisBase.ClientService.Where(tb => tb.StartTime > now && tb.StartTime < tomorrow).OrderBy(tb=>tb.StartTime).ToList();
- if(list.Count > 0)
- {
- DGRecords.ItemsSource = list;
- }
- else
- {
- MessageBox.Show("Соответствующие записи не были найдены");
- }
- }
- private void BtnBackClick(object sender, RoutedEventArgs e)
- {
- dataFrame.mainFrame.Navigate(new pageServicesList());
- }
- }
- }
|