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.Shapes;
using nukakto.Models;

namespace nukakto
{
    /// <summary>
    /// Логика взаимодействия для StockWindow.xaml
    /// </summary>
    public partial class StockWindow : Window
    {
        public StockWindow()
        {
            InitializeComponent(); gr606_kusanContext context = new gr606_kusanContext();
            StockView.ItemsSource = context.Stocks.ToList();

        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            Maps map = new Maps();
            map.Show();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.Hide();
            OneWindow at = new OneWindow();
            at.Show();
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            this.Hide();
            Setting at = new Setting();
            at.Show();
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
           gr606_kusanContext context = new gr606_kusanContext();
            var attraction = (sender as Button).DataContext as Stock;
            var stock = context.Stocks.SingleOrDefault(x => x.IdAttractions == attraction.IdAttractions);
            MessageBox.Show("Номер аттракциона: " + attraction.IdAttractions + "Номер акции: " + stock.IdStock + "\n" + "Начало акции: " + stock.DateStart + "\n" + "Конец акции: " + stock.DateEnd + "\n" + "Описание: " + stock.Comment);
        }
    }
}
