/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(Borrowers borrowers, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. Borrower newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(borrowers.ContainsType[0]) as Borrower; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance borrowers.Add(newobj); } }
public void DeleteBorrower(string name, bool shouldSaveToFile = true) { foreach (var borrower in Borrowers) { if (borrower.Name == name) { Borrowers.Remove(borrower); break; } } if (shouldSaveToFile) { var borrowersToSave = new List <string>(); foreach (var borrower in Borrowers) { borrowersToSave.Add(borrower.ToString()); } File.Delete(FileName); File.WriteAllLines(FileName, borrowersToSave); } }
public override string ToString() { var separator = "\t"; return($"{Person.Name}{separator}{Math.Round(InitialDeb, 2)}{separator}" + $"{string.Concat(Borrowers.Select(x => $"\r\n{separator}debs to{separator}{x.Key.Person.Name}{separator}{Math.Round(x.Value, 2)}"))}"); }
/// <summary> /// Fill method for populating an entire collection of Borrowers /// </summary> public virtual void Fill(Borrowers borrowers) { // create the connection to use SqlConnection cnn = new SqlConnection(Borrower.GetConnectionString()); try { using (cnn) { // open the connection cnn.Open(); // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectBorrowers"); // Send the collection and data to the object factory CreateObjectsFromData(borrowers, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
public void DeleteBorrower(string name, bool shouldSaveToFile = true) { foreach (var borrower in Borrowers) { if (borrower.Name == name) { Borrowers.Remove(borrower); Console.WriteLine("Udało się usunąć dłużnika"); break; } else { Console.WriteLine(); Console.WriteLine("Nie ma takiego dłużnika"); break; } } if (shouldSaveToFile) { var borrowersToSave = new List <string>(); foreach (var borrower in Borrowers) { borrowersToSave.Add(borrower.ToString()); } File.Delete(FileName); File.WriteAllLines(FileName, borrowersToSave); } }
/// <summary> /// Gets the objects for the BORROWER relationship. /// </summary> public Borrowers GetBorrowers() { Borrowers borrowers = new Borrowers(); BorrowerBase.ServiceObject.FillByPrintPositionType(borrowers, _id); return(borrowers); }
/// <summary> /// Gets the objects for the BORROWER relationship. /// </summary> public Borrowers GetBorrowers() { Borrowers borrowers = new Borrowers(); BorrowerBase.ServiceObject.FillByMaritalStatusType(borrowers, _id); return(borrowers); }
/// <summary> /// Gets the objects for the BORROWER relationship. /// </summary> public Borrowers GetBorrowers() { Borrowers borrowers = new Borrowers(); BorrowerBase.ServiceObject.FillByJointAssetLiabilityReportingType(borrowers, _id); return(borrowers); }
/// <summary> /// Gets the objects for the BORROWER relationship. /// </summary> public Borrowers GetBorrowers() { Borrowers borrowers = new Borrowers(); BorrowerBase.ServiceObject.FillByLoanApplication(borrowers, _id); return(borrowers); }
private void UpdateBorrower() { if (mf.scMain.Panel2.Controls.Count > 0) { RegisterBorrower rb = (RegisterBorrower)mf.scMain.Panel2.Controls[0]; rb.UpdateNow(); Borrowers b = (Borrowers)mf.scMain.Panel1.Controls[0]; b.LoadList(); } }
private void btnApproveRegistration_ItemClick(object sender, ItemClickEventArgs e) { ClearPanel(); ss = SaveSender.ApproveBorrower; scMain.SplitterPosition = 0; Borrowers b = new Borrowers(ss); b.Dock = DockStyle.Fill; scMain.Panel2.Enabled = true; scMain.Panel2.Controls.Add(b); ClearCheckDoCheck(btnApproveRegistration); }
public void Test_for_SearchLoan() { Borrowers borrowers = new Borrowers() { BorrowerId = 1 }; var Result = _LoanClerkServices.SearchLoan(borrowers.BorrowerId); var GetLoan = _LoanClerkServices.GetLoan(borrowers.BorrowerId); Assert.Equal(GetLoan, Result); }
private void btnEditBorrower_ItemClick(object sender, ItemClickEventArgs e) { ClearPanel(); ss = SaveSender.EditBorrower; scMain.SplitterPosition = this.Size.Width; Borrowers b = new Borrowers(ss); b.Dock = DockStyle.Fill; scMain.Panel1.Enabled = true; scMain.Panel1.Controls.Add(b); ClearCheckDoCheck(btnEditBorrower); }
/// <summary> /// Gets all the available objects. /// </summary> public virtual Borrowers GetAll() { // create a new instance of the return object Borrowers objects = new Borrowers(); // fill the objects this.Fill(objects); // return the filled object from the service return(objects); }
public void PayDeb(Borrower b) { var value = Math.Min(b.Borrow, Debt); if (value <= 0) { return; } Debt -= value; Borrowers.Add(b, value); b.Decrease(value); }
private void BorrowersGrid() { var record = Borrowers.SelectAll(); dgvBorrowersRecord.DataSource = null; dgvBorrowersRecord.DataSource = record; // Set borrowers in Rental cboBorrowerIDRental.DataSource = null; cboBorrowerIDRental.DataSource = record; cboBorrowerIDRental.ValueMember = "id"; cboBorrowerIDRental.DisplayMember = "FullName"; // or nothing, let ToString do its work }
public bool DeleteBorrower(string name) { foreach (var borrower in Borrowers) { if (borrower.Name == name) { Borrowers.Remove(borrower); SaveBorrowersToFile(true); return(true); } } return(false); }
public void BoundaryTest_ForPhoneNo_Length() { Borrowers borrower = new Borrowers() { ContectNumber = " 981114564" }; var MinLength = 10; var MaxLength = 10; //Action var actualLength = borrower.ContectNumber.ToString().Length; //Assert Assert.InRange(actualLength, MinLength, MaxLength); }
private void btnDeleteBorrowers_Click(object sender, EventArgs e) { string confirmationMessage = $"Are you sure you want to delete this record: ID {txtIDBorrowers.Text}? This cannot be undone!"; DialogResult choice = MessageBox.Show(confirmationMessage, "Confirm Delete", MessageBoxButtons.YesNo); if (choice == DialogResult.Yes) { var record = new Borrowers { Id = Convert.ToInt64(txtIDBorrowers.Text), }; Borrowers.Delete(record); BorrowersGrid(); } }
private void ApproveForm() { ClearPanel(); ss = SaveSender.ApproveBorrower; scMain.SplitterPosition = 0; Borrowers b = new Borrowers(ss); b.Dock = DockStyle.Fill; scMain.Panel2.Enabled = true; scMain.Panel2.Controls.Add(b); ClearCheckDoCheck(btnApproveBorrowerRegistration); rpgReceiveTools.Visible = false; rpgBorrowingTools.Visible = false; rpgBorrowingSave.Visible = true; }
public void AddBorrower(string name, decimal amount, bool shouldSaveToFile = true) { var borrower = new Borrower { Name = name, CashAmount = amount }; Borrowers.Add(borrower); if (shouldSaveToFile) { File.WriteAllLines(FileName, new List <string> { borrower.ToString() }); } }
public void AddBorrower(string name, decimal amount, DateTime date, bool shouldSaveToFile = true) { var borrower = new Borrower { Name = name, Amount = amount, Date = date }; Borrowers.Add(borrower); if (shouldSaveToFile) { File.AppendAllLines(FileName, new List <string> { borrower.ToString() }); } }
public void Test_for_RepaymentsReceived() { LoanRepayment loanRepayment = new LoanRepayment() { LoanNumber = "dd", ChequeNumber = "dd", AmmountRepaid = 11, MadeOfPayment = "dd" }; Borrowers borrowers = new Borrowers() { BorrowerId = 1 }; var Result = _LoanClerkServices.RepaymentsReceived(loanRepayment, borrowers.BorrowerId); Assert.True(Result); }
/// <summary> /// Fill method for populating an entire collection of Borrowers using the selection service GetBySSN /// </summary> public virtual void GetBySSN(Borrowers borrowers, System.String sSN) { // create the connection to use SqlConnection cnn = new SqlConnection(Borrower.GetConnectionString()); try { // discover the sql parameters SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(Borrower.GetConnectionString(), "gsp_BorrowersGetBySSN"); using (cnn) { // open the connection cnn.Open(); // Start setting the requirement SP parameters sqlparams["@sSN"].Value = sSN; // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_BorrowersGetBySSN", sqlparams); // Send the collection and data to the object factory CreateObjectsFromData(borrowers, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
/// <summary> /// Fill method for populating a collection by PrintPositionType /// </summary> public void FillByPrintPositionType(Borrowers borrowers, System.Int16 id) { // create the connection to use SqlConnection cnn = new SqlConnection(Borrower.GetConnectionString()); try { // discover the sql parameters SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(Borrower.GetConnectionString(), "gsp_SelectBorrowersByPrintPositionType"); using (cnn) { // open the connection cnn.Open(); // set the parameters sqlparams["@printPositionType"].Value = id; // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectBorrowersByPrintPositionType", sqlparams); // Send the collection and data to the object factory. CreateObjectsFromData(borrowers, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
public void Test_for_ApproveLoan() { LoanAcceptance loanAcceptance = new LoanAcceptance() { LoanNumber = 11, PropertId = 1, SanctionedDate = DateTime.Now, SanctioningOfficial = "ss", RegionalOffice = "ss" }; Borrowers borrowers = new Borrowers() { BorrowerId = 1 }; var Result = _ManagerServices.ApproveLoan(loanAcceptance, borrowers.BorrowerId); Assert.True(Result); }
private void btnSaveBorrowers_Click(object sender, EventArgs e) { var record = new Borrowers { FirstName = txtFirstNameBorrowers.Text, LastName = txtLastNameBorrowers.Text, Phone = txtPhoneBorrowers.Text, Email = txtEmailBorrowers.Text }; if (txtIDBorrowers.Text.Equals("")) { Borrowers.Insert(record); } else { record.Id = Convert.ToInt64(txtIDBorrowers.Text); Borrowers.Update(record); } BorrowersGrid(); }
private void btnFindBorrowers_Click(object sender, EventArgs e) { try { var record = new Borrowers { Id = Convert.ToInt64(txtIDBorrowers.Text), }; // reassign record to the found results record = Borrowers.Find(record); txtFirstNameBorrowers.Text = record.FirstName; txtLastNameBorrowers.Text = record.LastName; txtPhoneBorrowers.Text = record.Phone; txtEmailBorrowers.Text = record.Email; } catch { MessageBox.Show($"There is no record ID {txtIDBorrowers.Text}"); } }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(Borrowers borrowers, System.Data.SqlClient.SqlDataReader data) { // Do nothing if we have nothing if (data == null) { return; } // Create a local variable for the new instance. Borrower newobj = null; // Iterate through the data reader while (data.Read()) { // Create a new object instance newobj = System.Activator.CreateInstance(borrowers.ContainsType[0]) as Borrower; // Let the instance set its own members newobj.SetMembers(ref data); // Add the new object to the collection instance borrowers.Add(newobj); } }
public void AddBorrower(string name, decimal amount, bool shouldSaveToFile = true) { var isNotExist = true; foreach (var checkborrower in Borrowers) { if (checkborrower.Name == name) { isNotExist = false; break; } } if (isNotExist) { var borrower = new Borrower { Name = name, Amount = amount }; Borrowers.Add(borrower); if (shouldSaveToFile) { File.AppendAllLines(FileName, new List <string> { borrower.ToString() }); } } else { Console.WriteLine(); Console.WriteLine("Taki dłużnik już istnieje!"); Console.ReadLine(); } }