partial void dateChangeClicked(AppKit.NSButton sender) { if (Int32.TryParse(CashflowIDPopUp.SelectedItem.Title, out int i)) { clsLoan loan = new clsLoan(chosenID); DateTime newDate = (DateTime)(dateChanger.DateValue); // Delete existing (old) cashflow clsCashflow cf = new clsCashflow(Int32.Parse(CashflowIDPopUp.SelectedItem.Title)); cf.Delete(System.DateTime.Today); cf.Save(); // Create new cashflow with new date clsCashflow updatedCF = new clsCashflow(newDate, System.DateTime.Today, System.DateTime.MaxValue, cf.LoanID(), cf.Amount(), false, cf.TypeID()); loan.AddCashflow(updatedCF); updatedCF.Save(); loadRehabInfo(); } }
private void RedrawTable() { clsCSVTable tbl = new clsCSVTable(clsCashflow.strCashflowPath); string selected = this.TypePopUpButton.TitleOfSelectedItem; this.typeChosen = clsCashflow.Type.Unknown; foreach (clsCashflow.Type t in Enum.GetValues(typeof(clsCashflow.Type))) { if (t.ToString() == selected) { this.typeChosen = t; } } List <int> IDs = tbl.Matches(clsCashflow.TransactionTypeColumn, ((int)this.typeChosen).ToString()); this.dataSource.Cashflows.Clear(); foreach (int id in IDs) { clsCashflow newCf = new clsCashflow(id); if (((this.showExpired) || (newCf.DeleteDate() > System.DateTime.Today.AddYears(50))) && (newCf.LoanID() == -this.entityID)) { this.dataSource.Cashflows.Add(newCf); } } this.CashflowsTableView.ReloadData(); }
partial void dateChangeClicked(AppKit.NSButton sender) { clsLoan loan = new clsLoan(chosenID); int cfID = 0; cfID = Int32.Parse(cashflowID.StringValue); DateTime newDate = (DateTime)(dateChanger.DateValue); clsCashflow cf = new clsCashflow(cfID); cf.Delete(System.DateTime.Today); cf.Save(); clsCashflow updatedCF = new clsCashflow(newDate, System.DateTime.Today, System.DateTime.MaxValue, cf.LoanID(), cf.Amount(), false, cf.TypeID()); loan.AddCashflow(updatedCF); updatedCF.Save(); loadRehabInfo(); }