예제 #1
0
        private void ReportButton_Click(object sender, EventArgs e)
        {
            Report.Clear();
            RestartDGV();

            if (Pages.SelectedTab == Dish)
            {
                Report.AddString("<Center>Отчет по имеющимся блюдам</Center>");
                Report.AddHorizontalRule();
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(QueryDish, connectionString))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    DGDish(dataTable);
                }
            }

            if (Pages.SelectedTab == Orders)
            {
                Report.AddString("<Center>Отчет по имеющимся заказам</Center>");
                Report.AddHorizontalRule();
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(QueryOrders, connectionString))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    DGOrders(dataTable);
                }
            }

            if (Pages.SelectedTab == Clients)
            {
                Report.AddString("<Center>Отчет по имеющимся клиентам</Center>");
                Report.AddHorizontalRule();
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(QueryClients, connectionString))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    DGClients(dataTable);
                }
            }

            if (Pages.SelectedTab == Staff)
            {
                Report.AddString("<Center>Отчет по имеющимся сотрудникам</Center>");
                Report.AddHorizontalRule();
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(QueryStaff, connectionString))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    DGStaff(dataTable);
                }
            }

            if (Pages.SelectedTab == Delivery)
            {
                Report.AddString("<Center>Отчет по имеющимся доставкам</Center>");
                Report.AddHorizontalRule();
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(QueryDelivery, connectionString))
                {
                    DataTable dataTable = new DataTable();
                    adapter.Fill(dataTable);
                    DGDelivery(dataTable);
                }
            }

            Report.AddDatagridView(DGView);
            Report.ShowPrintPreviewDialog();
        }