private void btnUpdateItem_Click(object sender, RoutedEventArgs e)
        {
            decimal price;
            if (txtItemActualPrice.Text.Trim().CompareTo("N.A") == 0)
            {
                txtItemActualPrice.Text = "-1.00";
            }
            bool isdecimal = decimal.TryParse(txtItemActualPrice.Text, out price);
            if (!isdecimal)
            {
                MessageBox.Show("Invalid Actual Price");
                txtItemActualPrice.Text = "";
                txtItemActualPrice.Focus();
                return;
            }

            OptimizedBudgetItemsDetails budgetItem = lvBItem.GetEditItem();
            BudgetHelper client = new BudgetHelper();
            try
            {
                Items item2Edit = client.GetItemDetail(budgetItem);
                client.UpdateActualPrice(user, item2Edit, price);
                clearBudgetItemForm();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occured: " + ex.Message,
                    "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                client.Close();
            }
            loadBudgetItems();
        }
        private void loadBudgetItems()
        {
            budgetItemList = new List<BudgetItemState>();
            BudgetHelper client = new BudgetHelper();
            try
            {
                decimal totalAmount = 0;
                OptimizedBudgetItems budgetItems = client.GetBudgetItem(event_.EventID);
                if (budgetItems != null)
                {
                    List<OptimizedBudgetItemsDetails> budgetItemsList = budgetItems.BudgetItemsList.ToList<OptimizedBudgetItemsDetails>();

                    foreach (OptimizedBudgetItemsDetails budgetItem in budgetItemsList)
                    {
                        Items item = client.GetItemDetail(budgetItem);
                        BudgetItemState bis = new BudgetItemState(item, budgetItem.IsBought);
                        if (budgetItem.IsBought)
                        {
                            totalAmount += item.ActualPrice;
                        }
                        else
                        {
                            item.ActualPrice = 0;
                            totalAmount += item.EstimatedPrice;
                        }

                        budgetItemList.Add(bis);
                    }

                    lvBudgetItem.ItemsSource = budgetItemList;
                }
                //.ItemsSource = incomeList;
                txtTotalExpenditure.Text = "$" + totalAmount.ToString("0.00");
                expenditure = totalAmount;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                client.Close();
            }
        }
        private void lv_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Helper.IdleHelper.startIdleTimer();
            if (lvBItem.lv.SelectedIndex == -1)
            {
                Helper.IdleHelper.stopIdleTimer();
                clearBudgetItemForm();
                return;
            }

            OptimizedBudgetItemsDetails budgetItem = lvBItem.GetEditItem();
            BudgetHelper client = new BudgetHelper();
            try
            {
                Items item2Edit = client.GetItemDetail(budgetItem);
                if (item2Edit != null)
                {
                    mapItem(item2Edit);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occured: " + ex.Message,
                    "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                client.Close();
            }
        }