Пример #1
0
        /// <summary>
        /// Edit an existing Invoice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Enable Buttons
                tbInvoiceNumber.IsEnabled = true;
                dpInvoiceDate.IsEnabled   = true;
                txtbxTotalCost.IsEnabled  = true;
                cmbInvoiceItem.IsEnabled  = true;
                cmbxItemsAdded.IsEnabled  = true;

                //Enable Save button
                btnSaveInvoice.IsEnabled = true;

                //disable edit and delete buttons
                btnEditInvoice.IsEnabled   = false;
                btnDeleteInvoice.IsEnabled = false;

                //get items from line item
                List <clsLineItems> i    = ml.getInvoiceItems(InvoiceNum);
                List <String>       code = i.Select(a => a.ItemCode).ToList();

                List <clsItems> temp = new List <clsItems>();

                foreach (var item in code)
                {
                    temp = ml.GetItemsByCode(item);
                }
                List <String> desc = new List <String>();
                desc = temp.Select(a => a.ItemDesc).ToList();
                addeditems.AddRange(desc);

                cmbxItemsAdded.ItemsSource = addeditems;
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }