//??????????????       2



        //????????????????????????????????????????????????????????????? LOADs

        internal static void Customers_Table_Load()
        {

            if (dataSet_CustomersAndAgents_appdata.Customers.Rows.Count <= 0)
            {
                Table_Adapter_Cust.Fill(dataSet_CustomersAndAgents_appdata.Customers);
            }
            else if (dataSet_CustomersAndAgents_appdata.Customers.Rows.Count >= 1)
            {

            }

        }
Exemple #2
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            // Fill the Customers table adapter with data.
            _customersTableAdapter.ClearBeforeFill = true;
            _customersTableAdapter.Fill(_nwDataSet.Customers);

            // Fill the Orders table adapter with data.
            _ordersTableAdapter.Fill(_nwDataSet.Orders);

            // Assign the BindingSource to
            // the data context of the main grid.
            mainGrid.DataContext = _nwBindingSource;

            // Assign the BindingSource to
            // the data source of the list box.
            listBox1.ItemsSource = _nwBindingSource;

            // Because this is a master/details form, the DataGridView
            // requires the foreign key relating the tables.
            dataGridView1.DataSource = _nwBindingSource;
            dataGridView1.DataMember = "FK_Orders_Customers";

            // Handle the currency management aspect of the data models.
            // Attach an event handler to detect when the current item
            // changes via the WPF ListBox. This event handler synchronizes
            // the list collection with the BindingSource.
            //

            var cv = CollectionViewSource.GetDefaultView(
                _nwBindingSource) as BindingListCollectionView;

            cv.CurrentChanged += WPF_CurrentChanged;
        }
        public CustomerDataAccessLayer()
        {
            NorthwindDataSet dataset = NorthWindDataProvider.NorthwindDataSet;

            // populate the typed data set
            adapter = new CustomersTableAdapter();
            adapter.Fill(NorthWindDataProvider.NorthwindDataSet.Customers);
        }
        public DatabaseOps()
        {
            InitializeComponent();

            custAdap.Fill(aset.Customers);
            ordAdap.Fill(aset.Orders);
            ord_det_extAdap.Fill(aset.Order_Details_Extended);
            Grid1.DataContext = aset.Customers;
        }
Exemple #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var ds = new Data.InvoicesDataSet();
            var ta = new CustomersTableAdapter();

            ta.Fill(ds.Customers);

            dgCustomers.DataSource = ds.Customers;
        }
        public CustomerDataProvider()
        {
            NorthwindDataSet dataset = NorthWindDataProvider.NorthwindDataSet;

            adapter = new CustomersTableAdapter();
            adapter.Fill(NorthWindDataProvider.NorthwindDataSet.Customers);

            dataset.Customers.CustomersRowChanged += new NorthwindDataSet.CustomersRowChangeEventHandler(CustomersRowModified);
            dataset.Customers.CustomersRowDeleted += new NorthwindDataSet.CustomersRowChangeEventHandler(CustomersRowModified);
        }
Exemple #7
0
        public StronglyTypedDataSetWindowsFormsDesignerMainForm()
        {
            InitializeComponent();

            // fill the datatables from the database

            inventoryTableAdapter.Fill(inventoryTable);
            customersTableAdapter.Fill(customersTable);
            ordersTableAdapter.Fill(ordersTable);

            // initialize the controls

            InitializeDataGridView(dataGridViewInventory, inventoryTable);
            InitializeDataGridView(dataGridViewCustomers, customersTable);
            InitializeDataGridView(dataGridViewOrders, ordersTable);

            // set the button event handler

            buttonUpdate.Click += ButtonUpdate_Click;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var ds = new NorthwindDataSet();

            using (var ta = new CustomersTableAdapter())
            {
                ta.Fill(ds.Customers);

                ds.WriteXml(Server.MapPath("~/App_data/veri.xml"),
                    System.Data.XmlWriteMode.WriteSchema);
            }
        }
Exemple #9
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();
        }
Exemple #10
0
        private void downloadData(string customerID)
        {
            DataSet1 myData = new DataSet1();
            CustomersTableAdapter customersTableAdapter = new CustomersTableAdapter();
            OrdersTableAdapter ordersTableAdapter = new OrdersTableAdapter();

            customersTableAdapter.Fill(myData.Customers, customerID);
            ordersTableAdapter.Fill(myData.Orders, customerID);

            dataGridView1.DataSource = myData.Tables["Customers"];
            dataGridView2.DataSource = myData.Tables["Orders"];

        }
        public DatabaseOps()
        {
            InitializeComponent();
            custAdap.Fill(aset.Customers);
            ordAdap.Fill(aset.Orders);
            ord_det_extAdap.Fill(aset.Order_Details_Extended);
            Grid1.DataContext = aset.Customers;

            ICollectionView aView;

            aView = CollectionViewSource.GetDefaultView(aset.Customers);
            aView.GroupDescriptions.Add(new PropertyGroupDescription("Country", new CountryGrouper()));

            aView.SortDescriptions.Add(new SortDescription("Country", ListSortDirection.Ascending));
        }
Exemple #12
0
    protected void PobierzDaneZamowienia(string idKlienta)
    {
        DataSet mojZbiorDanych             = new DataSet();
        CustomersTableAdapter klientDA     = new CustomersTableAdapter();
        OrdersTableAdapter    zamowieniaDA = new OrdersTableAdapter();

        klientDA.Fill(mojZbiorDanych.Customers, idKlienta);
        zamowieniaDA.Fill(mojZbiorDanych.Orders, idKlienta);

        GridView1.DataSource = mojZbiorDanych.Tables["Customers"];
        GridView1.DataBind();

        GridView2.DataSource = mojZbiorDanych.Tables["Orders"];
        GridView2.DataBind();
    }
Exemple #13
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            NorthwindDataSet      nwindDataSet          = new NorthwindDataSet();
            CustomersTableAdapter customersTableAdapter = new CustomersTableAdapter();

            customersTableAdapter.Fill(nwindDataSet.Customers);

            this.radMultiColumnComboBox1.DataSource = nwindDataSet.Customers;


            FilterDescriptor descriptor = new FilterDescriptor(this.radMultiColumnComboBox1.DisplayMember, FilterOperator.StartsWith, string.Empty);

            this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(descriptor);
            this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown;
            // Filtering END
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            var dataSet1 = new DataSet1();

            using (var categoriesAdapter = new CategoriesTableAdapter()) {
                categoriesAdapter.Fill(dataSet1.Categories);
                var categoriesProvider = new ObjectDataProvider(dataSet1);
                DataProviderRepository.Current.Register("Categories", "Categories", categoriesProvider);
            }

            var dataSet2 = new DataSet2();

            using (var customersAdapter = new CustomersTableAdapter()) {
                customersAdapter.Fill(dataSet2.Customers);
                var customersProvider = new ObjectDataProvider(dataSet2);
                DataProviderRepository.Current.Register("Customers", "Customers", customersProvider);
            }
        }
Exemple #15
0
        static void Main(string[] args)
        {
            var shopDB = new ShopDb();
            var customersTableAdapter = new CustomersTableAdapter();

            customersTableAdapter.Fill(shopDB.Customers); //this will fill shopdb.customers table with data, so easy!

            foreach (DataRow row in shopDB.Customers.Rows)
            {
                foreach (DataColumn column in shopDB.Customers.Columns)
                {
                    Console.WriteLine($"{column.ColumnName}: {row[column]}");
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }
Exemple #16
0
        public MainForm()
        {
            InitializeComponent();

            // Get Adapters.
            invTableAdapter    = new InventoryTableAdapter();
            custTableAdapter   = new CustomersTableAdapter();
            ordersTableAdapter = new OrdersTableAdapter();

            // Add tables to DS.
            invTableAdapter.Fill(autoLotDS.Inventory);
            custTableAdapter.Fill(autoLotDS.Customers);
            ordersTableAdapter.Fill(autoLotDS.Orders);

            // Bind to grids
            dataGridViewInventory.DataSource = autoLotDS.Inventory;
            dataGridViewCustomers.DataSource = autoLotDS.Customers;
            dataGridViewOrders.DataSource    = autoLotDS.Orders;
        }
Exemple #17
0
        private void Form1_Load(object sender, EventArgs e)
        {
            invoicesTableAdapter.Fill(mmaBooksDataSet.Invoices);
            customersTableAdapter.Fill(mmaBooksDataSet.Customers);

            var invoices = from invoice in mmaBooksDataSet.Invoices
                           join customer in mmaBooksDataSet.Customers
                           on invoice.CustomerID equals customer.CustomerID
                           orderby customer.Name, invoice.InvoiceTotal descending
                select new
            {
                customer.Name,
                invoice.InvoiceID,
                invoice.InvoiceDate,
                invoice.InvoiceTotal
            };

            string customerName = "";
            int    i            = 0;

            foreach (var invoice in invoices)
            {
                if (invoice.Name != customerName)
                {
                    lvInvoices.Items.Add(invoice.Name);
                    customerName = invoice.Name;
                }
                else
                {
                    lvInvoices.Items.Add("");
                }
                lvInvoices.Items[i].SubItems.Add(invoice.InvoiceID.ToString());
                lvInvoices.Items[i].SubItems.Add(
                    Convert.ToDateTime(invoice.InvoiceDate).ToShortDateString());
                lvInvoices.Items[i].SubItems.Add(invoice.InvoiceTotal.ToString("c"));
                i += 1;
            }
        }
Exemple #18
0
        //</Snippet3>
        //<Snippet4>
        private void CustomerRibbon_Load(object sender, RibbonUIEventArgs e)
        {
            customerTable = nwDataSet.Customers;
            customerTableAdapter.Fill(customerTable);

            var customerQuery = from customers in customerTable.AsEnumerable().Take(20)
                                select new
            {
                CustomerID   = customers.Field <string>("Customer ID"),
                CustomerName = customers.Field <string>("Contact Name")
            };


            // Execute the query.
            foreach (var item in customerQuery)
            {
                this.comboBox1.Items.Add(CreateRibbonDropDownItem());
                this.comboBox1.Items.Last().Label =
                    item.CustomerName + "|" + item.CustomerID.ToString();
            }
            this.comboBox1.Text = this.comboBox1.Items.First().Label;
            PopulateSalesOrderInfo();
        }
        private static object CreateDataSource()
        {
            var dataSource = new nwindDataSet();
            var connection = new OleDbConnection();

            connection.ConnectionString = Properties.Settings.Default.nwindConnectionString;

            CustomersTableAdapter customers = new CustomersTableAdapter();

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

            OrdersTableAdapter orders = new OrdersTableAdapter();

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

            var bindingSource = new BindingSource();

            bindingSource.DataSource = dataSource;
            bindingSource.DataMember = "Customers";
            return(bindingSource);
        }
Exemple #20
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            NorthwindDataSet      nwindDataSet          = new NorthwindDataSet();
            CustomersTableAdapter customersTableAdapter = new CustomersTableAdapter();

            customersTableAdapter.Fill(nwindDataSet.Customers);

            this.radMultiColumnComboBox1.DataSource = nwindDataSet.Customers;

            // Filtering START
            //FilterExpression filter = new FilterExpression(this.radMultiColumnComboBox1.DisplayMember, FilterExpression.BinaryOperation.AND,
            //    GridKnownFunction.StartsWith, GridFilterCellElement.ParameterName);

            //filter.Parameters.Add(GridFilterCellElement.ParameterName, string.Empty);

            //this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterExpressions.Add(filter);

            this.radMultiColumnComboBox1.MultiColumnComboBoxElement.AutoCompleteMode = AutoCompleteMode.None;
            this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown;
            // Filtering END
        }
        /// <summary>
        /// Display inventory, customers, and orders report.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OutputForm_Load(object sender, EventArgs e)
        {
            // Create new strongly typed datatables, and associated table adapters.

            var inventoryTable = new AutoLotDataSet.InventoryDataTable();
            var ordersTable    = new AutoLotDataSet.OrdersDataTable();
            var customersTable = new AutoLotDataSet.CustomersDataTable();

            InventoryTableAdapter inventoryAdapter = new InventoryTableAdapter();
            CustomersTableAdapter customersAdapter = new CustomersTableAdapter();
            OrdersTableAdapter    ordersAdapter    = new OrdersTableAdapter();

            // now fill the tables with data

            inventoryAdapter.Fill(inventoryTable);
            customersAdapter.Fill(customersTable);
            ordersAdapter.Fill(ordersTable);

            // display all of the cars from inventory

            textBoxOutput.AppendText($"Inventory Count = {inventoryTable.Count()}{Environment.NewLine}");

            foreach (var car in inventoryTable)
            {
                textBoxOutput.AppendText($"{car.CarId} {car.Make} {car.Color} {car.Name}{Environment.NewLine}");
            }


            // display  only cars with Id < 5

            var carsQuery =
                from car in inventoryTable
                where car.CarId < 5
                select car;

            textBoxOutput.AppendText($"{Environment.NewLine}LINQ result CarId < 5{Environment.NewLine}");

            foreach (var car in carsQuery)
            {
                textBoxOutput.AppendText($"{car.CarId} {car.Make} {car.Color} {car.Name}{Environment.NewLine}");
            }

            // display all orders, and show customer first and last name

            var ordersQuery =
                from order in ordersTable
                from car in inventoryTable
                from customer in customersTable
                where order.CustId == customer.CustId
                where order.CarId == car.CarId
                select new
            {
                order.OrderId,
                car.CarId,      // note use of implicit names for new anon object
                car.Name,
                car.Make,
                CustomerId   = customer.CustId,
                CustomerName = customer.FirstName + " " + customer.LastName,
            };

            textBoxOutput.AppendText($"{Environment.NewLine}Orders Count = {ordersQuery.Count()}{Environment.NewLine}");
            foreach (var order in ordersQuery)
            {
                textBoxOutput.AppendText($"#{order.OrderId} {order.CarId} {order.Make} {order.Name} by {order.CustomerId} {order.CustomerName}{Environment.NewLine}");
            }
        }