Exemplo n.º 1
0
        private void button7_Click(object sender, EventArgs e)
        {
            AddItem AddItem = new AddItem(_user, this, button7, _connectionString);

            AddItem.Show();
            button7.Enabled = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// event listener for adding new item to new or existing invoice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddNewItem_Click(object sender, RoutedEventArgs e)
        {
            if (cbSearchByInvoiceNum.SelectedIndex > -1)
            {
                AddItem newItem = new AddItem(); // garbage collector should hopefully handle disposal of any old instances
                newItem.ShowDialog();

                id.AddItemToInvoice(cbSearchByInvoiceNum.SelectedValue.ToString(), newItem.ItemDescription, newItem.Quantity);

                FillInvoice(cbSearchByInvoiceNum.SelectedItem.ToString());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// edit invoice item - essentially deletes selected row then adds in new one with modifications
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditItem_Click(object sender, RoutedEventArgs e)
        {
            if (this.dgvInvoice.SelectedIndex > -1)
            {
                string invoiceNumber = cbSearchByInvoiceNum.SelectedItem.ToString();
                // casts as an invoiceline struct
                string itemName = ((InvoiceLine)dgvInvoice.Items[dgvInvoice.SelectedIndex]).ItemDescr.ToString();
                string quantity = ((InvoiceLine)dgvInvoice.Items[dgvInvoice.SelectedIndex]).Qty.ToString();

                // call add item second constructor so the selected values are populated in the popup
                AddItem ai = new AddItem(itemName, quantity);
                ai.ShowDialog();

                //delete old item line
                id.DeleteInvoiceItem(invoiceNumber, itemName);

                //inserting new item(s)
                id.AddItemToInvoice(invoiceNumber, ai.ItemDescription, ai.Quantity);
                FillInvoice(invoiceNumber);
            }
        }