123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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 WriteErase.ClassBase;
- using WriteErase.ClassData;
- namespace WriteErase.ClassPages
- {
- /// <summary>
- /// Логика взаимодействия для PageOrderView.xaml
- /// </summary>
- public partial class PageOrderView : Page
- {
- public PageOrderView()
- {
- InitializeComponent();
- lvOrder.ItemsSource = BaseConnection.kotBase.Order.ToList();
- }
- private void btnBackClick(object sender, RoutedEventArgs e)
- {
- MainFrame.mainFrame.Navigate(new PageMain());
- }
- private void cbCostSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (lvOrder != null && cbCost != null)
- filter();
- }
- private void cbDiscountSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (lvOrder != null && cbDiscount != null)
- filter();
- }
- private void filter()
- {
- List<Order> list = BaseConnection.kotBase.Order.ToList();
- //сортировка по стоимости
- switch (cbCost.SelectedIndex)
- {
- case 1:
- {
- list = list.OrderBy(tb => tb.CostWithDiscount).ToList();
- break;
- }
- case 2:
- {
- list = list.OrderByDescending(tb => tb.CostWithoutDiscount).ToList();
- break;
- }
- default:
- break;
- }
- //фильтрация по скидке
- switch (cbDiscount.SelectedIndex)
- {
- case 1:
- {
- list = list.Where(tb => tb.ProcentCost >= 0.0 && tb.ProcentCost <= 9.99).ToList();
- break;
- }
- case 2:
- {
- list = list.Where(tb => tb.ProcentCost >= 10.0 && tb.ProcentCost <= 14.99).ToList();
- break;
- }
- case 3:
- {
- list = list.Where(tb => tb.ProcentCost >= 15.0).ToList();
- break;
- }
- default:
- break;
- }
- lvOrder.ItemsSource = list;
- }
- }
- }
|