예제 #1
0
        private void btnUpdateInventory_Click(object sender, EventArgs e)
        {
            DataTable changedDT = (DataTable)inventoryGrid.DataSource;

            try {
                _dal.UpdateInventory(changedDT);
                inventoryGrid.DataSource = _dal.GetAllInventory();
            } catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #2
0
        public MainForm()
        {
            InitializeComponent();

            string cnStr = @"Data Source=(local);Initial Catalog=AutoLot;Integrated Security=True;Pooling=False";

            _dal = new InventoryDALDC(cnStr);

            inventoryGrid.DataSource = _dal.GetAllInventory();
        }
예제 #3
0
        public MainForm()
        {
            InitializeComponent();

            string cnString = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=AutoLot; Integrated Security=True;Pooling=False";

            //Create our data access object
            _dal = new InventoryDALDC(cnString);

            //Fill up our grid
            inventoryGrid.DataSource = _dal.GetAllInventory();
        }
예제 #4
0
        public MainForm()
        {
            InitializeComponent();

            string cnStr = @"Data Source=CODY-PC\NUCODE;Initial Catalog=AutoLot;Integrated Security=True;Pooling=False";

            //Create our data access object
            _dal = new InventoryDALDC(cnStr);

            //fill up our grid!
            inventoryGrid.DataSource = _dal.GetAllInventory();
        }
        public MainForm()
        {
            InitializeComponent();

            string cnStr =
                @"Data Source=.\SQLEXPRESS;Initial Catalog=AutoLot;" +
                "Integrated Security=True;Pooling=False";

            //Create data access object by instantiating InventoryDALDC type with passing in connection information.
            _dal = new InventoryDALDC(cnStr);

            // Fill up our grid by Inventory DataTable records.
            inventoryGrid.DataSource = _dal.GetAllInventory();
        }
예제 #6
0
        private void btnUpdateInventory_Click(object sender, EventArgs e)
        {
            //Get modified data from the grid
            DataTable changedDT = (DataTable)inventoryGrid.DataSource;

            try
            {
                //COmmit our changes
                _dal.UpdateInventory(changedDT);
                inventoryGrid.DataSource = _dal.GetAllInventory();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnUpdateInventory_Click(object sender, EventArgs e)
        {
            // Get modified data from the grid, and assign it to changedDT.
            DataTable changedDT = (DataTable)inventoryGrid.DataSource;

            try
            {
                // Commit our changes.
                _dal.UpdateInventory(changedDT);

                //Retrieve modified data and bind to DataGridView.
                inventoryGrid.DataSource = _dal.GetAllInventory();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public DisconnectedGUIMainForm()
        {
            InitializeComponent();

            // register button event handler
            buttonUpdateInventory.Click += ButtonUpdateInventory_Click;

            // this is just for fun ...
            // buttonUpdateInventory.MouseHover += ButtonMouseOver;

            string connectionString =
                @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AutoLot;" +
                "Integrated Security=True;Pooling=False";

            // Create our data access object.
            inventoryDAL = new InventoryDALDC(connectionString);

            // Fill up our grid!
            inventoryTable           = inventoryDAL.GetAllInventory();
            inventoryGrid.DataSource = inventoryTable;
        }
 /// <summary>
 /// Update the database with the in memory datatable, then fill back from the database
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonUpdateInventory_Click(object sender, EventArgs e)
 {
     inventoryDAL.UpdateInventory(inventoryTable);
     inventoryTable = inventoryDAL.GetAllInventory();
 }