コード例 #1
0
        private void Report_Load(object sender, EventArgs e)
        {
            productsTableAdapter.Fill(NorthwindDataSet.Products);
            employeesTableAdapter.Fill(NorthwindDataSet.Employees);
            customersTableAdapter.Fill(NorthwindDataSet.Customers);
            OrdersTableAdapter.Fill(NorthwindDataSet.Orders);

            var q = from em in NorthwindDataSet.Employees
                    where em.EmployeeID == Convert.ToInt32(id)
                    select new
            {
                firstName = em.FirstName,
                lastName  = em.LastName
            };

            foreach (var i in q)
            {
                employee.Add(i.firstName);
                employee.Add(i.lastName);
            }

            ReportParameterCollection reportParameters = new ReportParameterCollection();

            reportParameters.Add(new ReportParameter("parameterFirstName", employee[0]));
            reportParameters.Add(new ReportParameter("parameterLastName", employee[1]));
            reportViewer1.LocalReport.SetParameters(reportParameters);

            da.Fill(ds.Tables["Orders"]);
            cb_OrderDetails.DataSource    = bs;
            cb_OrderDetails.DisplayMember = "OrderID";

            Order_DetailsTableAdapter.Fill(NorthwindDataSet.Order_Details);
            Order_Details_fill_name();
        }
コード例 #2
0
        void InitializeDataSources()
        {
            var dataSource = new DataSet1();
            var connection = new OleDbConnection();

            connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb";

            EmployeesTableAdapter employees = new EmployeesTableAdapter();

            employees.Connection = connection;
            employees.Fill(dataSource.Employees);

            CustomersTableAdapter customers = new CustomersTableAdapter();

            customers.Connection = connection;
            customers.Fill(dataSource.Customers);

            EmployeeCustomersTableAdapter employeeCustomers = new EmployeeCustomersTableAdapter();

            employeeCustomers.Connection = connection;
            employeeCustomers.Fill(dataSource.EmployeeCustomers);

            OrdersTableAdapter orders = new OrdersTableAdapter();

            orders.Connection = connection;
            orders.Fill(dataSource.Orders);

            Order_DetailsTableAdapter orderDetails = new Order_DetailsTableAdapter();

            orderDetails.Connection = connection;
            orderDetails.Fill(dataSource.Order_Details);

            SnapDocument document = snapControl1.Document;

            document.BeginUpdateDataSource();

            var employeesBinding = new BindingSource()
            {
                DataSource = dataSource, DataMember = employeeDataSourceName
            };

            document.DataSources.Add(new DataSourceInfo(employeeDataSourceName, employeesBinding));

            var customersBinding = new BindingSource()
            {
                DataSource = dataSource, DataMember = customerDataSourceName
            };

            document.DataSources.Add(new DataSourceInfo(customerDataSourceName, customersBinding));

            document.EndUpdateDataSource();
        }
コード例 #3
0
        private void btnFill_Click(object sender, EventArgs e)
        {
            ReportParameterCollection reportParameters = new ReportParameterCollection();

            reportParameters.Add(new ReportParameter("parameterCompanyName", " "));
            reportParameters.Add(new ReportParameter("parameterContactName", " "));
            reportParameters.Add(new ReportParameter("parameterAddress", " "));
            reportParameters.Add(new ReportParameter("parameterCity", " "));
            reportViewer1.LocalReport.SetParameters(reportParameters);

            Order_DetailsTableAdapter.Fill(NorthwindDataSet.Order_Details);
            Order_Details_fill_name();
        }
コード例 #4
0
        //</Snippet5>

        //<Snippet6>
        private void PopulateSalesOrderInfo()
        {
            String[] tempArray = comboBox1.Text.Split(new Char[] { '|' });
            menu1.Items.Clear();

            orderTable        = nwDataSet.Orders;
            orderDetailsTable = nwDataSet.Order_Details;
            productsTable     = nwDataSet.Products;

            ordersTableAdapter.Fill(orderTable);
            detailsTableAdapter.Fill(orderDetailsTable);
            productsTableAdapter.Fill(productsTable);

            var orderQuery = from orders in orderTable.AsEnumerable()
                             where orders.Field <string>("Customer ID") == tempArray[1]
                             select new { OrderID = orders.Field <int>("Order ID") };

            foreach (var orderItem in orderQuery)
            {
                menu1.Items.Add(CreateRibbonMenu());

                RibbonMenu orderMenu = (RibbonMenu)menu1.Items.Last();
                orderMenu.Dynamic = true;
                orderMenu.Label   = orderItem.OrderID.ToString();
                orderMenu.Tag     = orderItem.OrderID;

                var productQuery = from orderDetail in orderDetailsTable.AsEnumerable()
                                   join product in productsTable.AsEnumerable() on
                                   orderDetail.Field <int>("Product ID")
                                   equals product.Field <int>("Product ID")
                                       where orderDetail.Field <int>("Order ID") ==
                                   orderItem.OrderID
                                   select new { ProductName = product.Field <string>("Product Name") };

                foreach (var productItem in productQuery)
                {
                    RibbonButton button = CreateRibbonButton();
                    button.Label = productItem.ProductName;
                    orderMenu.Items.Add(button);
                }
            }
        }
コード例 #5
0
        public Example()

        {
            InitializeComponent();

            NWindDataSet dataSet = new
                                   NWindDataSet();

            OrdersTableAdapter ordersAdapter =
                new OrdersTableAdapter();

            ordersAdapter.Fill(dataSet.Orders);

            Order_DetailsTableAdapter detailAdapter
                = new Order_DetailsTableAdapter();

            detailAdapter.Fill(dataSet.Order_Details);

            radGridView1.AutoGenerateHierarchyFromDataSet = true;

            radGridView1.DataMember = dataSet.Tables["Orders"].TableName;

            radGridView1.ItemsSource = dataSet;
        }