private void Agree_Click(object sender, RoutedEventArgs e)
        {
            swap.OnWhat = DateTime.Now.DayOfYear;
            swap.Agree  = user;

            swapRepository.EditSwap(swap);
            swapRepository.Save();

            Close();
        }
예제 #2
0
        private void Ok_Click(object sender, RoutedEventArgs e)
        {
            var swap = new Swap();

            swap.When = dateOfCleaningDateTime.DayOfYear;
            swap.From = user;
            swap.Room = user.Room;

            if (Deadline.IsChecked == true)
            {
                swap.DeadLine     = true;
                swap.Sick         = false;
                swap.NotInTheTown = false;
            }
            else if (Sick.IsChecked == true)
            {
                swap.DeadLine     = false;
                swap.Sick         = true;
                swap.NotInTheTown = false;
            }
            else if (Out.IsChecked == true)
            {
                swap.DeadLine     = false;
                swap.Sick         = false;
                swap.NotInTheTown = true;
            }
            else if (Other.IsChecked == true)
            {
                swap.DeadLine     = false;
                swap.Sick         = false;
                swap.NotInTheTown = false;
                swap.Reason       = Reason.Text;
            }
            else
            {
                MessageBox.Show("Please, change reason!");
                return;
            }

            swapRepository.AddSwap(swap);
            swapRepository.Save();
            Close();
        }