Пример #1
0
        } // SaveLoyaltyAccount_Button_Click

        private void UpdateInventory_Click(object sender, EventArgs e)
        {
            // Get the currently selected item in the ListBox.
            try
            {
                string curItem  = ((BoxFormat)Inventory_Listbox.SelectedItem).databaseID;
                string quantity = ItemCount_Textbox.Text.ToString();

                if (string.IsNullOrWhiteSpace(quantity))
                {
                    quantity = "0";
                }

                // connect to DB if it is not connected
                if (!nsadb.Connected())
                {
                    nsadb.OpenConnection();
                }

                // Update the database to mark selected order Refunded and refresh inventory list
                nsadb.ManagerUpdateInventory(curItem, quantity);
                LoadManagerInventoryList();

                // Inform User that Inventory was Successfully Updated.
                MessageBox.Show("Component #" + curItem + " Updated.", "Update Inventory", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                MessageBox.Show("Component Not Selected!", "Update Inventory", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        } // DeleteUpdateInventory_Click