Esempio n. 1
0
        //JOIN AND GROUPED TABLES FOR PRESENTING BETWEEN 2 DATES RECEIVABLE ORDERS
        private void BtnShowReceiv_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(DpStart.ToString()) || string.IsNullOrWhiteSpace(DpEnd.ToString()))
            {
                MessageBox.Show("Tarixlər seçilməmişdir !");
                return;
            }
            var query = from ef in _context.BookOrders
                        join p in _context.Books
                        on ef.BookId equals p.Id
                        join s in _context.Orders
                        on ef.OrderId equals s.Id
                        join t in _context.Customers
                        on s.CustomerId equals t.Id
                        where s.CreatedAt.Date >= DpStart.SelectedDate
                        where s.DeadLine.Date <= DpEnd.SelectedDate
                        where s.PaymentStatus == false
                        group s by new
            {
                s.Customer.Name,
                s.Customer.Surname,
                s.Customer.Phone,
                s.Customer.Email,
                s.CreatedAt,
                s.DeadLine,
                s.Fine,
                s.Quantity,
                s.TotalPrice,
                p.BookName
            }
            into g
                select new
            {
                g.Key.Name,
                g.Key.Surname,
                g.Key.Phone,
                g.Key.Email,
                g.Key.CreatedAt,
                g.Key.DeadLine,
                g.Key.Fine,
                Quantity = g.Sum(x => x.Quantity),
                g.Key.TotalPrice,
                g.Key.BookName,
            };

            DgtReport.ItemsSource = query.ToList();

            BtnSaveAs.Visibility = Visibility.Visible;
        }
        public WorkTimeRangeAddView()
        {
            InitializeComponent();

            DpStart.Focus();
        }