private void CalculateButton_Click(object sender, RoutedEventArgs e) { try { ResidentialRentalItems rentalItems = new ResidentialRentalItems(this.ReportTitleTextBox.Text, this.AddressTextBox.Text, this.CityTextBox.Text, this.StateTextBox.Text, (this.ZipTextBox.Text), (this.PropertyTaxTextBox.Text), (this.MLSNumberTextBox.Text), Convert.ToInt32((this.GrossMonthlyRentTextBox.Text)) + Convert.ToInt32((this.OtherMonthlyIncomeTextBox.Text)), Convert.ToInt32((this.ElectricityTextBox.Text)) + Convert.ToInt32((this.WaterSewerTextBox.Text)) + Convert.ToInt32((this.PMITextBox.Text)) + Convert.ToInt32((this.GarbageTextBox.Text)) + Convert.ToInt32((this.HOATextBox.Text)) + Convert.ToInt32((this.MonthlyInsuranceTextBox.Text)) + Convert.ToInt32((this.PropertyTaxTextBox.Text)) / 12 + Convert.ToInt32((this.OtherExpensesTextBox.Text)), Convert.ToInt32((this.VacancyTextBox.Text)) + Convert.ToInt32((this.RepairsMaintenanceTextBox.Text)) + Convert.ToInt32((CapitalExpendituresTextBox.Text)) + Convert.ToInt32((ManagementFeesTextBox.Text)), Convert.ToDouble((this.AnnualIncomeGrowthTextBox.Text)), Convert.ToDouble((this.AnnualPVGrowthTextBox.Text)), Convert.ToDouble((this.AnnualExpensesGrowthTextBox.Text)), Convert.ToDouble((this.SalesExpensesTextBox.Text)), Convert.ToDouble((this.TermTextBox.Text)), Convert.ToDouble((this.InterestRateTextBox.Text)), Convert.ToDouble((this.PurchasePriceTextBox.Text)), Convert.ToDouble((this.DownPaymentTextBox.Text)), Convert.ToDouble((this.AfterRepairsTextBox.Text)), Convert.ToDouble((this.EstimatedRepairsTextBox.Text)), Convert.ToDouble((this.ClosingCostTextBox.Text)), Convert.ToDouble((this.YearsToOwnTextBox.Text)) ); ResultsWindow mResultsWindow = new ResultsWindow(rentalItems); mResultsWindow.Show(); } catch { MessageBox.Show("ERROR: Input must be a number."); } }
public ResultsWindow(ResidentialRentalItems rentalItems) { InitializeComponent(); mRentalItems = rentalItems; this.Title = "Results for: " + rentalItems.mAddress; PriceTextBox.Text = rentalItems.mPurchasePrice.ToString(); ClosingCostTextBox.Text = rentalItems.mClosingCost.ToString(); RepairsTextBox.Text = rentalItems.mRepairCost.ToString(); //TotalCostTextBox.Text = rentalItems.total InterestRateTextBox.Text = rentalItems.mInterestRate.ToString(); YearsTextBox.Text = rentalItems.mMortgageYears.ToString() + " years"; AfterRepairsValueTextBox.Text = rentalItems.mAfterRepairValue.ToString(); LoanAmountTextBox.Text = rentalItems.mPrincipal.ToString(); DownPaymentTextBox.Text = rentalItems.mDownPayment.ToString(); MothlyIncomeTextBox.Text = rentalItems.mMonthlyIncome.ToString(); MonthlyExpensesTextBox.Text = (rentalItems.mMonthlyExpenses + rentalItems.mMonthlyVariableExpenses).ToString(); CashFlowTextBlock.Text = rentalItems.mMonthlyCashflow.ToString(); ProFormaCapTextBox.Text = rentalItems.mProFormaCap.ToString(); NOITextBox.Text = rentalItems.mNOI.ToString(); TotalCashNeededTextBox.Text = rentalItems.mTotalCashNeeded.ToString(); CAPRateTextBox.Text = rentalItems.mPurchaseCapRate.ToString(); try { ROITextBox.Text = rentalItems.mCashOnCashRoi.ToString().Split('.')[1] + "%"; } catch { ROITextBox.Text = "0"; }; try { CAPRateTextBox.Text = rentalItems.mPurchaseCapRate.ToString().Split('.')[1] + "%"; } catch { CAPRateTextBox.Text = "0"; }; try { ProFormaCapTextBox.Text = rentalItems.mProFormaCap.ToString().Split('.')[1] + "%"; } catch { CAPRateTextBox.Text = "0"; }; MothlyPITextBox.Text = rentalItems.mMortgagePayment.ToString(); List <string> chartTypes = new List <string> { "Cash Flow", "Amoritization" }; foreach (var item in chartTypes) { ChartTypeComboBox.Items.Add(item); } }