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 Sessioa.BaseModel; using Sessioa.Classes; using System.Data.Entity; namespace Sessioa.Pages { /// /// Логика взаимодействия для OrderNew.xaml /// public partial class OrderNew : Page { User user = null; public OrderNew(User userSign) { InitializeComponent(); user = userSign; if(userSign.UserRole == 2) { LB_OrderProduct.ItemsSource = BaseClass.C_Base.Order.Include(x => x.PointsOfIssue).Include(x=>x.User).ToList(); } else if (userSign.UserRole == 1) LB_OrderProduct.ItemsSource = BaseClass.C_Base.Order.Include(x => x.PointsOfIssue).Where(x => x.UserID == userSign.UserID).ToList(); } private void UserOrder_Loaded(object sender, RoutedEventArgs e) { TextBlock tb = (TextBlock)sender; if(tb.Uid != null && user.UserRole == 2) { User us = BaseClass.C_Base.User.FirstOrDefault(x => x.UserID.ToString() == tb.Uid); tb.Text = $"Заказчик: {us.UserSurname} {us.UserName[0]}.{(us.UserPatronymic != null && us.UserPatronymic != string.Empty ? $"{us.UserPatronymic[0]}." : "")}"; } } private void B_Back_Click(object sender, RoutedEventArgs e) { FrameClass.C_Frame.Navigate(new ProductsPage(user)); } } }