Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgIncomeCustomer_InitializingNewItem(object sender, InitializingNewItemEventArgs e)
        {
            FinancialIncome obj = e.NewItem as FinancialIncome;

            if (obj != null)
            {
                NewFinancialIncomeList.Add(obj);
                obj.ProductID = SelectedProduct.ProductID;
                UpdateLabels();
            }
        }
Ejemplo n.º 2
0
 private void Button_Add_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(IncomeName) || Amount <= 0)
     {
         MessageBox.Show("Please Enter an Amount & a Name");
     }
     else
     {
         Income = new FinancialIncome(Amount);
         Income.SetName(IncomeName);
         Income.SetCategory(Category);
         Income.SetDescription(Description);
         Income.SetActionDate(Date);
         User.Calendar.AllFinances[Date].AddNewIncome(Income);
         this.Close();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Delete the selected row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show("Är du säker på att du vill ta bort denna raden helt?" + Environment.NewLine + "Detta går inte att ångra.", "Ta Bort Rad", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                try
                {
                    FinancialIncome fi = (FinancialIncome)dgIncomeCustomer.SelectedItem;
                    RevenueManagement.Instance.DeleteFinancialIncome(fi);
                    UpdateLabels();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditedCustomerName(object sender, RoutedEventArgs e)
        {
            FinancialIncome fi = (FinancialIncome)dgIncomeCustomer.SelectedItem;

            var autoCompleteBox = sender as AutoCompleteBox;

            // Check if Name is correct

            Customer tempCustomer = CustomerManagement.Instance.GetCustomerByName(autoCompleteBox.Text);

            if (tempCustomer != null)
            {
                fi.CustomerName = tempCustomer.CustomerName;
                fi.CustomerID   = tempCustomer.CustomerID;

                DataGridCell cellID = GetCell(dgIncomeCustomer.SelectedIndex, 0);   //Pass the row and column
                cellID.IsEnabled = false;
                DataGridCell cellName = GetCell(dgIncomeCustomer.SelectedIndex, 1); //Pass the row and column
                cellName.IsEnabled = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditedProductName(object sender, RoutedEventArgs e)
        {
            FinancialIncome fi = (FinancialIncome)dgIncomeProduct.SelectedItem;

            var autoCompleteBox = sender as AutoCompleteBox;

            // Check if Name is correct

            Product tempProduct = ProductManagement.Instance.GetProductByName(autoCompleteBox.Text);

            if (tempProduct != null)
            {
                fi.ProductName = tempProduct.ProductName;
                fi.ProductID   = tempProduct.ProductID;

                DataGridCell cellID = GetCell(dgIncomeProduct.SelectedIndex, 0);   //Pass the row and column
                cellID.IsEnabled = false;
                DataGridCell cellName = GetCell(dgIncomeProduct.SelectedIndex, 1); //Pass the row and column
                cellName.IsEnabled = false;
            }
        }