Exemple #1
0
        private void OnMenuItem_Delete(object sender, RoutedEventArgs e)
        {
            if (this.treeView1.SelectedItem is RentalBuildingSingleYear)
            {
                RentalBuildingSingleYear toDelete = this.treeView1.SelectedItem as RentalBuildingSingleYear;
                if (toDelete != null)
                {
                    if (MessageBoxEx.Show("Delete " + toDelete.Period, "Rental", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        toDelete.Building.Years.Remove(toDelete.Year);
                        this.treeView1.Items.Refresh();
                    }
                }
            }
            else
            {
                if (this.treeView1.SelectedItem is RentBuilding)
                {
                    RentBuilding toDelete = this.treeView1.SelectedItem as RentBuilding;

                    if (MessageBoxEx.Show("Delete " + toDelete.Name, "Rental", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        myMoney.Buildings.RemoveBuilding(toDelete);
                    }
                }
            }
        }
Exemple #2
0
        private void OnMenuItem_Edit(object sender, RoutedEventArgs e)
        {
            RentBuilding x = this.treeView1.SelectedItem as RentBuilding;

            if (x != null)
            {
                EditProperties(x);
            }
        }
Exemple #3
0
        bool EditProperties(RentBuilding a)
        {
            Walkabout.Dialogs.BuildingDialog dialog = new Dialogs.BuildingDialog(myMoney);
            dialog.TheBuilding = a;
            dialog.Owner       = Application.Current.MainWindow;
            if (dialog.ShowDialog() == true)
            {
                return(true);
            }

            return(false);
        }
Exemple #4
0
        public void SetViewToRentBuilding(RentBuilding value)
        {
            this.Building     = value;
            this.BuildingName = value.Name;
            this.Period       = value.Period;

            this.TotalIncomes             = value.TotalIncome;
            this.TotalExpensesTaxes       = value.TotalExpense.TotalTaxes;
            this.TotalExpensesRepairs     = value.TotalExpense.TotalRepairs;
            this.TotalExpensesManagement  = value.TotalExpense.TotalManagement;
            this.TotalExpensesMaintenance = value.TotalExpense.TotalMaintenance;
            this.TotalExpensesInterest    = value.TotalExpense.TotalInterest;

            UpdateAllDataBindings();
        }
Exemple #5
0
        private void OnMenuNewRental_Click(object sender, RoutedEventArgs e)
        {
            RentBuilding rb = new RentBuilding(this.MyMoney.Buildings);

            rb.Name = "New Rental";

            if (rb != null)
            {
                if (EditProperties(rb) == true)
                {
                    this.MyMoney.Buildings.Add(rb);

                    ReloadTreeView();
                }
            }
        }