123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- 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;
- namespace SneakersSkakunov
- {
- /// <summary>
- /// Логика взаимодействия для Sneaker.xaml
- /// </summary>
- public partial class Sneaker : Page
- {
- private void Revert(object sender, RoutedEventArgs e)
- {
- MainFrame.mframe.Navigate(new AdminPage());
- }
- private void Addendum(object sender, RoutedEventArgs e)
- {
- MainFrame.mframe.Navigate(new Add());
- }
- public Sneaker()
- {
- InitializeComponent();
- Sniker DB = new Sniker();
- SneakerList.ItemsSource = DB.Sneakers.ToList();
- }
- public void brands(object sender, RoutedEventArgs e)
- {
- TextBlock brand = (TextBlock)sender;
- int index = Convert.ToInt32(brand.Uid);
- Sniker DB = new Sniker();
- string a = DB.Brand.Where(x => x.id_Brand == index).Select(x => x.Label).First();
- brand.Text = "Брэнд: " + a;
- }
- public void models(object sender, RoutedEventArgs e)
- {
- TextBlock model = (TextBlock)sender;
- int index = Convert.ToInt32(model.Uid);
- Sniker DB = new Sniker();
- string b = DB.Sneakers.Where(x => x.id_Sneakers == index).Select(x => x.Model + " ").First();
- model.Text = "Модель: " + b;
- }
- public void Colors(object sender, RoutedEventArgs e)
- {
- TextBlock color = (TextBlock)sender;
- int index = Convert.ToInt32(color.Uid);
- Sniker DB = new Sniker();
- string c = DB.Sneakers.Where(x => x.id_Sneakers == index).Select(x => x.Colors + " ").First();
- color.Text = "Цвет: " + c;
- }
- public void prices(object sender, RoutedEventArgs e)
- {
- TextBlock price = (TextBlock)sender;
- int index = Convert.ToInt32(price.Uid);
- Sniker DB = new Sniker();
- string d = DB.Sneakers.Where(x => x.id_Sneakers == index).Select(x => x.Price + " ").First().ToString();
- price.Text = "Цена: " + d + "р.";
- }
- public void Date(object sender, RoutedEventArgs e)
- {
- TextBlock data = (TextBlock)sender;
- int index = Convert.ToInt32(data.Uid);
- Sniker DB = new Sniker();
- string d = DB.Cheque.Where(x => x.id_Cheque == index).Select(x => x.Date_of_formation + " ").First().ToString();
- data.Text = "Дата: " + d;
- }
- private void Delete(object sender, RoutedEventArgs e)
- {
- Button tb = (Button)sender;
- int index = Convert.ToInt32(tb.Uid);
- Sniker DB = new Sniker();
- Sneakers SneakerRemove = DB.Sneakers.FirstOrDefault(x => x.id_Sneakers == index);
- switch (MessageBox.Show("Удалить полис???", "SneakerInsurance", MessageBoxButton.YesNo, MessageBoxImage.Question))
- {
- case MessageBoxResult.Yes:
- DB.Sneakers.Remove(SneakerRemove);
- MessageBox.Show("Полис удален");
- DB.SaveChanges();
- ClassS.Mfrm.Navigate(new Sneaker());
- break;
- case MessageBoxResult.No:
- MessageBox.Show("Полис не удален");
- break;
- }
- }
- }
- }
|