/
WorkerTime
/
WorkerTimeDiplom
Обзор
Документация
Войти
/
WorkerTime
/
WorkerTimeDiplom
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Views/ExportWindow.xaml.cs
58 строк
2 KB
nikit
Логирование, автосохранение, восстановление пароля
05 июн 2026, 19:24
05 июн 2026, 19:24
715eb3d
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using System.Windows; namespace WorkerTime.Views { public partial class ExportWindow : Window { public int SelectedDepartmentId { get; private set; } public bool Confirmed { get; private set; } public string DocumentNumber { get; private set; } public string DocumentDate { get; private set; } public ExportWindow(List<Department> departments) { InitializeComponent(); DepartmentCombo.ItemsSource = departments; DepartmentCombo.DisplayMemberPath = "Name"; if (departments.Count > 0) { DepartmentCombo.SelectedIndex = 0; } DocumentDatePicker.SelectedDate = DateTime.Now; Confirmed = false; DocumentNumber = ""; DocumentDate = DateTime.Now.ToString("dd.MM.yyyy"); } private void ExportButton_Click(object sender, RoutedEventArgs e) { DocumentNumber = DocumentNumberBox.Text.Trim(); if (DocumentDatePicker.SelectedDate.HasValue) { DocumentDate = DocumentDatePicker.SelectedDate.Value.ToString("dd.MM.yyyy"); } Department selected = DepartmentCombo.SelectedItem as Department; if (selected == null) { MessageBox.Show("Выберите подразделение.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning); return; } SelectedDepartmentId = selected.Id; Confirmed = true; Close(); } private void CancelButton_Click(object sender, RoutedEventArgs e) { Confirmed = false; Close(); } } }