public bool Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iDocumentID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsDocument.NameColumn - 1] = this.strName; strValues[clsDocument.PropertyColumn - 1] = this.iPropertyID.ToString(); strValues[clsDocument.TypeColumn - 1] = ((int)this.tType).ToString(); tbl.New(strValues); return tbl.Save(); } else { if ((this.iDocumentID < tbl.Length()) && (this.iDocumentID >= 0)) { if ( tbl.Update(this.iDocumentID, clsDocument.NameColumn, this.strName) && tbl.Update(this.iDocumentID, clsDocument.PropertyColumn, this.iPropertyID.ToString()) && tbl.Update(this.iDocumentID, clsDocument.TypeColumn, ((int)this.tType).ToString())) { return tbl.Save(); } else { return false; } } else { return false; } } }
public int Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iTransactionID == -1) // new cashflow, unassigned id { string[] strValues = new string[tbl.Width() - 1]; this.iTransactionID = tbl.Length(); strValues[clsCashflow.ActualColumn - 1] = this.bActual.ToString().ToUpper(); strValues[clsCashflow.TransactionTypeColumn - 1] = ((int)this.eTypeID).ToString(); strValues[clsCashflow.LoanColumn - 1] = this.iLoanID.ToString(); strValues[clsCashflow.AmountColumn - 1] = this.dAmount.ToString(); strValues[clsCashflow.TransactionDateColumn - 1] = this.dtPayDate.ToString("MM/dd/yyyy"); strValues[clsCashflow.RecordDateColumn - 1] = this.dtRecordDate.ToString("MM/dd/yyyy"); strValues[clsCashflow.DeleteDateColumn - 1] = this.dtDeleteDate.ToString("MM/dd/yyyy"); strValues[clsCashflow.CommentColumn - 1] = this.strComment; tbl.New(strValues); if (tbl.Save()) { return(this.iTransactionID); } else { return(clsCashflow.SaveFailedOnIO); } } else if (this.iTransactionID < tbl.Length()) // existing cashflow { if ( tbl.Update(this.iTransactionID, clsCashflow.ActualColumn, this.bActual.ToString()) && tbl.Update(this.iTransactionID, clsCashflow.TransactionTypeColumn, ((int)this.eTypeID).ToString()) && tbl.Update(this.iTransactionID, clsCashflow.LoanColumn, this.iLoanID.ToString()) && tbl.Update(this.iTransactionID, clsCashflow.AmountColumn, this.dAmount.ToString()) && tbl.Update(this.iTransactionID, clsCashflow.TransactionDateColumn, this.dtPayDate.ToString("MM/dd/yyyy")) && tbl.Update(this.iTransactionID, clsCashflow.RecordDateColumn, this.dtRecordDate.ToString("MM/dd/yyyy")) && tbl.Update(this.iTransactionID, clsCashflow.DeleteDateColumn, this.dtDeleteDate.ToString("MM/dd/yyyy")) && tbl.Update(this.iTransactionID, clsCashflow.CommentColumn, this.strComment) ) { if (tbl.Save()) { return(this.iTransactionID); } else { return(clsCashflow.SaveFailedOnIO); } } else { return(clsCashflow.SaveFailedOnDataInsertion); } } else // new cashflow, transactionID out of order past end of existing table { return(clsCashflow.SaveFailedOnIndexOutOfOrder); } }
public bool Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iEntityID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsEntity.NameColumn - 1] = this.strName; strValues[clsEntity.AddressColumn - 1] = this.strAddress; strValues[clsEntity.TownColumn - 1] = this.strTown; strValues[clsEntity.StateColumn - 1] = this.strState; strValues[clsEntity.ZipCodeColumn - 1] = this.iZipCode.ToString(); strValues[clsEntity.PhoneNumberColumn - 1] = this.strPhone; strValues[clsEntity.ContactNameColumn - 1] = this.strContactName; strValues[clsEntity.ContactEmailColumn - 1] = this.strEmail; strValues[clsEntity.PathAbbreviationColumn - 1] = this.strPathAbbrev; strValues[clsEntity.EntityTypeColumn - 1] = ((int)this.tType).ToString(); tbl.New(strValues); return(tbl.Save()); } else { if ((this.iEntityID < tbl.Length()) && (this.iEntityID >= 0)) { if ( tbl.Update(this.iEntityID, clsEntity.NameColumn, this.strName) && tbl.Update(this.iEntityID, clsEntity.AddressColumn, this.strAddress) && tbl.Update(this.iEntityID, clsEntity.TownColumn, this.strTown) && tbl.Update(this.iEntityID, clsEntity.StateColumn, this.strState) && tbl.Update(this.iEntityID, clsEntity.ZipCodeColumn, this.iZipCode.ToString()) && tbl.Update(this.iEntityID, clsEntity.PhoneNumberColumn, this.strPhone) && tbl.Update(this.iEntityID, clsEntity.ContactNameColumn, this.strContactName) && tbl.Update(this.iEntityID, clsEntity.PathAbbreviationColumn, this.strPathAbbrev) && tbl.Update(this.iEntityID, clsEntity.ContactEmailColumn, this.strEmail) && tbl.Update(this.iEntityID, clsEntity.EntityTypeColumn, ((int)this.tType).ToString())) { return(tbl.Save()); } else { return(false); } } else { return(false); } } }
private bool _Load(int loanID, string path) { this.iLoanID = loanID; clsCSVTable tbl = new clsCSVTable(path); if (loanID < tbl.Length()) { this.iPropertyID = Int32.Parse(tbl.Value(loanID, clsLoan.PropertyColumn)); this.iTitleHolderEntityID = Int32.Parse(tbl.Value(loanID, clsLoan.TitleHolderColumn)); this.iCoBorrowerEntityID = Int32.Parse(tbl.Value(loanID, clsLoan.CoBorrowerColumn)); this.iAcquisitionTitleCompanyEntityID = Int32.Parse(tbl.Value(loanID, clsLoan.TitleCompanyColumn)); this.iLenderEntityID = Int32.Parse(tbl.Value(loanID, clsLoan.LenderColumn)); this.dtMaturity = DateTime.Parse(tbl.Value(loanID, clsLoan.MaturityDateCoumn)); this.dtOrigination = DateTime.Parse(tbl.Value(loanID, clsLoan.OGDateColumn)); this.dRate = Double.Parse(tbl.Value(loanID, clsLoan.RateColumn)); this.dPenaltyRate = Double.Parse(tbl.Value(loanID, clsLoan.PenaltyRateColumn)); this.pProperty = new clsProperty(this.iPropertyID); this._LoadCashflows(); return(true); } else { return(false); } }
public static List <string> AddressList() { List <string> returnValue = new List <string>(); clsCSVTable tbl = new clsCSVTable(clsProperty.strPropertyPath); int streetNumber; string streetName; // compile list as [street name] [8 digit street number] for (int i = 0; i < tbl.Length(); i++) { string s = tbl.Value(i, clsProperty.AddressColumn); streetNumber = Int32.Parse(System.Text.RegularExpressions.Regex.Match(s, @"\d+").Value); streetName = System.Text.RegularExpressions.Regex.Replace(s, streetNumber.ToString(), "").Trim(); returnValue.Add(streetName + " " + streetNumber.ToString("00000000")); } // sort list, so it's alphabetical by street name and then street number returnValue.Sort(); // put list back to [street number] [street name] for (int i = 0; i < returnValue.Count; i++) { streetNumber = Int32.Parse(returnValue[i].Substring(returnValue[i].Length - 8)); streetName = returnValue[i].Substring(0, returnValue[i].Length - 9); returnValue[i] = streetNumber.ToString() + " " + streetName; } return(returnValue); }
public bool Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iDocumentRecordID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsDocumentRecord.DocumentColumn - 1] = this.iDocumentID.ToString(); strValues[clsDocumentRecord.ActionDateColumn - 1] = this.dtAction.ToString(); strValues[clsDocumentRecord.RecordDateColumn - 1] = this.dtRecord.ToString(); strValues[clsDocumentRecord.SenderColumn - 1] = this.iSenderEntityID.ToString(); strValues[clsDocumentRecord.ReceiverColumn - 1] = this.iReceiverEntityID.ToString(); strValues[clsDocumentRecord.StatusColumn - 1] = ((int)this.eStatus).ToString(); strValues[clsDocumentRecord.TransmissionColumn - 1] = ((int)this.eTransmission).ToString(); tbl.New(strValues); return(tbl.Save()); } else { if ((this.iDocumentRecordID < tbl.Length()) && (this.iDocumentRecordID >= 0)) { if ( tbl.Update(this.iDocumentRecordID, clsDocumentRecord.ActionDateColumn, this.dtAction.ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.DocumentColumn, this.iDocumentID.ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.ReceiverColumn, this.iReceiverEntityID.ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.RecordDateColumn, this.dtRecord.ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.SenderColumn, this.iSenderEntityID.ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.StatusColumn, ((int)this.eStatus).ToString()) && tbl.Update(this.iDocumentRecordID, clsDocumentRecord.TransmissionColumn, ((int)this.eTransmission).ToString())) { return(tbl.Save()); } else { return(false); } } else { return(false); } } }
public static Dictionary <string, int> LoanIDsByAddress() { Dictionary <string, int> dict = new Dictionary <string, int>(); clsCSVTable tblLoans = new clsCSVTable(clsLoan.strLoanPath); for (int i = 0; i < tblLoans.Length(); i++) { dict.Add((new clsLoan(i)).Property().Address(), i); } return(dict); }
public bool Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iPropertyID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsProperty.AddressColumn - 1] = this.strAddress; strValues[clsProperty.BPOColumn - 1] = this.dBPO.ToString(); strValues[clsProperty.CountyColumn - 1] = this.strCounty; strValues[clsProperty.TownColumn - 1] = this.strTown; strValues[clsProperty.NickNameColumn - 1] = this.strNickname; strValues[clsProperty.StateColumn - 1] = this.strState; tbl.New(strValues); return(tbl.Save()); } else { if ((this.iPropertyID < tbl.Length()) && (this.iPropertyID >= 0)) { if ( tbl.Update(this.iPropertyID, clsProperty.AddressColumn, this.strAddress) && tbl.Update(this.iPropertyID, clsProperty.BPOColumn, this.dBPO.ToString()) && tbl.Update(this.iPropertyID, clsProperty.CountyColumn, this.strCounty) && tbl.Update(this.iPropertyID, clsProperty.TownColumn, this.strTown) && tbl.Update(this.iPropertyID, clsProperty.NickNameColumn, this.strNickname) && tbl.Update(this.iPropertyID, clsProperty.StateColumn, this.strState)) { return(tbl.Save()); } else { return(false); } } else { return(false); } } }
public bool Save(string path) { clsCSVTable tbl = new clsCSVTable(path); if (this.iRecordingID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsLoanRecording.LoanIDColumn - 1] = this.iLoanID.ToString(); strValues[clsLoanRecording.BookColumn - 1] = this.iBook.ToString(); strValues[clsLoanRecording.PageColumn - 1] = this.iPage.ToString(); strValues[clsLoanRecording.InstrumentColumn - 1] = this.iInstrument.ToString(); strValues[clsLoanRecording.ParcelColumn - 1] = this.iParcel.ToString(); strValues[clsLoanRecording.RecordingDateColumn - 1] = this.dtRecording.ToString(); tbl.New(strValues); return(tbl.Save()); } else { if ((this.iRecordingID < tbl.Length()) && (this.iRecordingID >= 0)) { if ( tbl.Update(this.iRecordingID, clsLoanRecording.LoanIDColumn, this.iLoanID.ToString()) && tbl.Update(this.iRecordingID, clsLoanRecording.BookColumn, this.iBook.ToString()) && tbl.Update(this.iRecordingID, clsLoanRecording.PageColumn, this.iPage.ToString()) && tbl.Update(this.iRecordingID, clsLoanRecording.InstrumentColumn, this.iInstrument.ToString()) && tbl.Update(this.iRecordingID, clsLoanRecording.ParcelColumn, this.iParcel.ToString()) && tbl.Update(this.iRecordingID, clsLoanRecording.RecordingDateColumn, this.iRecordingID.ToString())) { return(tbl.Save()); } else { return(false); } } else { return(false); } } }
public static int IDFromAddress(string address) { clsCSVTable tbl = new clsCSVTable(clsProperty.strPropertyPath); int id = -1; for (int i = 0; i < tbl.Length(); i++) { if (tbl.Value(i, clsProperty.AddressColumn) == address) { id = i; } } return(id); }
private bool _Load(int id, clsCSVTable tbl) { if (id < tbl.Length()) { this.iDocumentID = id; this.strName = tbl.Value(id, clsDocument.NameColumn); this.iPropertyID = Int32.Parse(tbl.Value(id, clsDocument.PropertyColumn)); this.tType = (clsDocument.Type)Int32.Parse(tbl.Value(id, clsDocument.TypeColumn)); return true; } else { return false; } }
private bool _Load(int id) { clsCSVTable tbl = new clsCSVTable(clsDocument.strDocumentPath); if (id < tbl.Length()) { this.iDocumentID = id; this.strName = tbl.Value(id, clsDocument.NameColumn); this.iPropertyID = Int32.Parse(tbl.Value(id, clsDocument.PropertyColumn)); this.tType = (clsDocument.Type)Int32.Parse(tbl.Value(id, clsDocument.TypeColumn)); return(true); } else { return(false); } }
private void _LoadCashflows(string path) { clsCSVTable tbl = new clsCSVTable(path); this.cfCashflows = new List <clsCashflow>(); int iCFLoanID; for (int i = 0; i < tbl.Length(); i++) { if (Int32.TryParse(tbl.Value(i, clsCashflow.LoanColumn), out iCFLoanID)) { if (iCFLoanID == this.iLoanID) { this.cfCashflows.Add(new clsCashflow(i, tbl)); } } } }
private bool _Load(int loanRecordingID, clsCSVTable tbl) { this.iRecordingID = loanRecordingID; if (loanRecordingID < tbl.Length()) { this.iRecordingID = Int32.Parse(tbl.Value(loanRecordingID, clsLoanRecording.IndexColumn)); this.iBook = Int32.Parse(tbl.Value(loanRecordingID, clsLoanRecording.BookColumn)); this.iPage = Int32.Parse(tbl.Value(loanRecordingID, clsLoanRecording.PageColumn)); this.iInstrument = Int32.Parse(tbl.Value(loanRecordingID, clsLoanRecording.InstrumentColumn)); this.iParcel = Int32.Parse(tbl.Value(loanRecordingID, clsLoanRecording.ParcelColumn)); this.dtRecording = DateTime.Parse(tbl.Value(loanRecordingID, clsLoanRecording.RecordingDateColumn)); return(true); } else { return(false); } }
private bool _Load(int id, clsCSVTable tbl) { if (id < tbl.Length()) { this.iDocumentRecordID = id; this.dtAction = DateTime.Parse(tbl.Value(id, clsDocumentRecord.ActionDateColumn)); this.dtRecord = DateTime.Parse(tbl.Value(id, clsDocumentRecord.RecordDateColumn)); this.eStatus = (clsDocumentRecord.Status)Int32.Parse(tbl.Value(id, clsDocumentRecord.StatusColumn)); this.eTransmission = (clsDocumentRecord.Transmission)Int32.Parse(tbl.Value(id, clsDocumentRecord.TransmissionColumn)); this.iDocumentID = Int32.Parse(tbl.Value(id, clsDocumentRecord.DocumentColumn)); this.iSenderEntityID = Int32.Parse(tbl.Value(id, clsDocumentRecord.SenderColumn)); this.iReceiverEntityID = Int32.Parse(tbl.Value(id, clsDocumentRecord.ReceiverColumn)); return(true); } else { return(false); } }
private bool _Load(int propertyID, clsCSVTable tbl) { if (propertyID < tbl.Length()) { this.iPropertyID = propertyID; this.strAddress = tbl.Value(propertyID, clsProperty.AddressColumn); this.strTown = tbl.Value(propertyID, clsProperty.TownColumn); this.strCounty = tbl.Value(propertyID, clsProperty.CountyColumn); this.strState = tbl.Value(propertyID, clsProperty.StateColumn); if (!double.TryParse(tbl.Value(propertyID, clsProperty.BPOColumn), out this.dBPO)) { this.dBPO = 0; } // this.dBPO = Double.Parse(tbl.Value(propertyID, clsProperty.BPOColumn)); this.strNickname = tbl.Value(propertyID, clsProperty.NickNameColumn); return(true); } else { return(false); } }
public static int LoanID(string address) { clsCSVTable tblLoans = new clsCSVTable(clsLoan.strLoanPath); int loanID = -1; // Find PropertyID from Address First int propertyID = clsProperty.IDFromAddress(address); if (propertyID == -1) { return(-1); } // Now match propertyID to the loan for (int i = 0; i < tblLoans.Length(); i++) { if (tblLoans.Value(i, clsLoan.PropertyColumn) == propertyID.ToString()) { loanID = i; } } return(loanID); }
private bool _Load(int id) { clsCSVTable tbl = new clsCSVTable(clsEntity.strEntityPath); if (id < tbl.Length()) { this.iEntityID = id; this.strName = tbl.Value(id, clsEntity.NameColumn); this.strAddress = tbl.Value(id, clsEntity.AddressColumn); this.strTown = tbl.Value(id, clsEntity.TownColumn); this.strState = tbl.Value(id, clsEntity.StateColumn); Console.WriteLine(tbl.Value(id, clsEntity.ZipCodeColumn)); this.iZipCode = Int32.Parse(tbl.Value(id, clsEntity.ZipCodeColumn)); this.strPhone = tbl.Value(id, clsEntity.PhoneNumberColumn); this.strContactName = tbl.Value(id, clsEntity.ContactNameColumn); this.strEmail = tbl.Value(id, clsEntity.ContactEmailColumn); return(true); } else { return(false); } }
private bool _Load(int transactionID, clsCSVTable tbl) { if (transactionID < tbl.Length()) { this.iTransactionID = transactionID; this.dtPayDate = DateTime.Parse(tbl.Value(transactionID, clsCashflow.TransactionDateColumn)); this.dtRecordDate = DateTime.Parse(tbl.Value(transactionID, clsCashflow.RecordDateColumn)); this.dtDeleteDate = DateTime.Parse(tbl.Value(transactionID, clsCashflow.DeleteDateColumn)); if (this.dtDeleteDate > new DateTime(2999, 12, 31)) { this.dtDeleteDate = DateTime.MaxValue; } this.dAmount = Double.Parse(tbl.Value(transactionID, clsCashflow.AmountColumn)); this.iLoanID = Int32.Parse(tbl.Value(transactionID, clsCashflow.LoanColumn)); this.eTypeID = (clsCashflow.Type)Int32.Parse(tbl.Value(transactionID, clsCashflow.TransactionTypeColumn)); this.bActual = Boolean.Parse(tbl.Value(transactionID, clsCashflow.ActualColumn)); this.strComment = tbl.Value(transactionID, clsCashflow.CommentColumn); return(true); } else { return(false); } }
private int _NewLoanID() { clsCSVTable tbl = new clsCSVTable(clsLoan.strLoanPath); return(tbl.Length()); }
private int _NewEntityID() { clsCSVTable tbl = new clsCSVTable(clsEntity.strEntityPath); return(tbl.Length()); }
private int _NewPropertyID() { clsCSVTable tbl = new clsCSVTable(clsProperty.strPropertyPath); return(tbl.Length()); }
private int _NewDocumentID() { clsCSVTable tbl = new clsCSVTable(clsDocument.strDocumentPath); return tbl.Length(); }
private int _NewDocumentRecordID() { clsCSVTable tbl = new clsCSVTable(clsDocumentRecord.strDocumentRecordPath); return(tbl.Length()); }
public bool Save(string path, bool saveCashflows, string cfPath) { clsCSVTable tbl = new clsCSVTable(path); if (this.iLoanID < 0) { this.iLoanID = tbl.Length(); } if (this.iLoanID == tbl.Length()) { string[] strValues = new string[tbl.Width() - 1]; strValues[clsLoan.CoBorrowerColumn - 1] = this.iCoBorrowerEntityID.ToString(); strValues[clsLoan.MaturityDateCoumn - 1] = this.dtMaturity.ToShortDateString(); strValues[clsLoan.OGDateColumn - 1] = this.dtOrigination.ToShortDateString(); strValues[clsLoan.PenaltyRateColumn - 1] = this.dPenaltyRate.ToString(); strValues[clsLoan.PropertyColumn - 1] = this.iPropertyID.ToString(); strValues[clsLoan.RateColumn - 1] = this.dRate.ToString(); strValues[clsLoan.TitleCompanyColumn - 1] = this.iAcquisitionTitleCompanyEntityID.ToString(); strValues[clsLoan.TitleHolderColumn - 1] = this.iTitleHolderEntityID.ToString(); strValues[clsLoan.LenderColumn - 1] = this.iLenderEntityID.ToString(); tbl.New(strValues); if (tbl.Save()) { if (saveCashflows) { bool bCashflowsSaved = true; foreach (clsCashflow cf in this.cfCashflows) { if (cf.Save(cfPath) < 0) { bCashflowsSaved = false; } } return(bCashflowsSaved); } else { return(true); } } else { return(false); } } else { if ((this.iLoanID < tbl.Length()) && (this.iLoanID >= 0)) { if ( tbl.Update(this.iLoanID, clsLoan.CoBorrowerColumn, this.iCoBorrowerEntityID.ToString()) && tbl.Update(this.iLoanID, clsLoan.MaturityDateCoumn, this.dtMaturity.ToShortDateString()) && tbl.Update(this.iLoanID, clsLoan.OGDateColumn, this.dtOrigination.ToShortDateString()) && tbl.Update(this.iLoanID, clsLoan.PenaltyRateColumn, this.dPenaltyRate.ToString()) && tbl.Update(this.iLoanID, clsLoan.PropertyColumn, this.iPropertyID.ToString()) && tbl.Update(this.iLoanID, clsLoan.RateColumn, this.dRate.ToString()) && tbl.Update(this.iLoanID, clsLoan.TitleCompanyColumn, this.iAcquisitionTitleCompanyEntityID.ToString()) && tbl.Update(this.iLoanID, clsLoan.LenderColumn, this.iLenderEntityID.ToString()) && tbl.Update(this.iLoanID, clsLoan.TitleHolderColumn, this.iTitleHolderEntityID.ToString())) { if (tbl.Save()) { if (saveCashflows) { bool bCashflowsSaved = true; foreach (clsCashflow cf in this.cfCashflows) { if (cf.Save(cfPath) < 0) { bCashflowsSaved = false; } } return(bCashflowsSaved); } else { return(true); } } else { return(false); } } else { return(false); } } else { return(false); } } }
private int _NewLoanRecordingID(clsCSVTable tbl) { return(tbl.Length()); }