public void OpenDocument(string BorrowerCode) { BorrowerManager oManager = new BorrowerManager(); BorrowerUnit oUnit = new BorrowerUnit(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); DataTable dtBorrowerInfo = oManager.GetBorrowersRecord(BorrowerCode); DataRow oRow = dtBorrowerInfo.Rows[0]; cboType.Text = oRow["CardType"].ToString(); txtBorrowerCode.Text = oRow["BorrowerCode"].ToString(); txtLastName.Text = oRow["LastName"].ToString(); txtFirstName.Text = oRow["FirstName"].ToString(); txtMiddleName.Text = oRow["MiddleName"].ToString(); txtAddress.Text = oRow["Address"].ToString(); txtContactNumber.Text = oRow["ContactNumber"].ToString(); cboEmployer.EditValue = oRow["Employer"].ToString(); cboGuarantorFinancer.EditValue = oRow["GuarantorID"].ToString(); txtATMNo.Text = oRow["ATMNo"].ToString(); cboEmploymentStatus.Text = oRow["EmploymentStatus"].ToString(); dtEffectiveDate.EditValue = Convert.ToDateTime(oRow["EffectiveDate"].ToString()); cboFrequencyOfPayment.Text = oRow["FrequencyOfPayment"].ToString(); txtInterestRate.Text = oRow["InterestRate"].ToString(); cboPayDayCode.EditValue = oRow["PayDayCode"].ToString(); txtMortgageInfo.Text = oRow["MortgageInfo"].ToString(); txtCreditLimit.Text = oRow["CreditLimit"].ToString(); txtBorrowerCode.Enabled = false; oManager.Close(); }
void BindGrid(string sSearch) { BorrowerManager oManager = new BorrowerManager(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); gridControl1.DataSource = oManager.SearchBorrowersInfo(sSearch); gridControl1.Refresh(); oManager.Close(); }
private void BindBorrowers() { BorrowerManager oManager = new BorrowerManager(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); grdCtlBorrowerInfo.DataSource = oManager.GetBorrowersRecord(); grdCtlBorrowerInfo.Refresh(); oManager.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { BorrowerManager oManager = new BorrowerManager(); BorrowerUnit oUnit = new BorrowerUnit(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); // Details oUnit.CardType = cboType.Text; oUnit.BorrowerCode = txtBorrowerCode.Text; oUnit.LastName = txtLastName.Text; oUnit.FirstName = txtFirstName.Text; oUnit.MiddleName = txtMiddleName.Text; oUnit.Address = txtAddress.Text; oUnit.ContactNumber = txtContactNumber.Text; oUnit.Employer = cboEmployer.EditValue.ToString(); oUnit.GuarantorID = cboGuarantorFinancer.EditValue.ToString(); oUnit.GuarantorName = cboGuarantorFinancer.Text; oUnit.ATMNo = txtATMNo.Text; oUnit.EmploymentStatus = cboEmploymentStatus.Text; oUnit.EffectiveDate = Convert.ToDateTime(dtEffectiveDate.EditValue); oUnit.InterestRate = txtInterestRate.Text; oUnit.PayDayCode = cboPayDayCode.EditValue.ToString(); oUnit.MortgageInfo = txtMortgageInfo.Text; oUnit.CreditLimit = Convert.ToDouble(txtCreditLimit.Text); oManager.UpdateBorrower(oUnit); oManager.Close(); txtBorrowerCode.Enabled = false; }
private void barSaveAndNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (txtBorrowerCode.Enabled == true) { if (txtBorrowerCode.Text == "") { MessageBox.Show("Blank code is not permitted!!!", "Code", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } BorrowerManager oManager = new BorrowerManager(); BorrowerUnit oUnit = new BorrowerUnit(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); if (oManager.isBorrowerCodeExists(txtBorrowerCode.Text)) { oManager.Close(); MessageBox.Show("Code already exists!!! Please try another code", "Code", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } oUnit.CardType = cboType.Text; oUnit.BorrowerCode = txtBorrowerCode.Text; oUnit.LastName = txtLastName.Text; oUnit.FirstName = txtFirstName.Text; oUnit.MiddleName = txtMiddleName.Text; oUnit.Address = txtAddress.Text; oUnit.ContactNumber = txtContactNumber.Text; oUnit.Employer = cboEmployer.EditValue.ToString(); oUnit.GuarantorID = cboGuarantorFinancer.EditValue.ToString(); oUnit.GuarantorName = cboGuarantorFinancer.Text; oUnit.ATMNo = txtATMNo.Text; oUnit.EmploymentStatus = cboEmploymentStatus.Text; oUnit.EffectiveDate = Convert.ToDateTime(dtEffectiveDate.EditValue); oUnit.InterestRate = txtInterestRate.Text; oUnit.FrequencyOfPayment = cboFrequencyOfPayment.Text; if (cboPayDayCode.EditValue == null) { oUnit.PayDayCode = ""; } else { oUnit.PayDayCode = cboPayDayCode.EditValue.ToString(); } oUnit.MortgageInfo = txtMortgageInfo.Text; oUnit.CreditLimit = Convert.ToDouble(txtCreditLimit.Text); // Details oManager.AddBorrower(oUnit); oManager.Close(); txtBorrowerCode.Enabled = false; MessageBox.Show("Adding successfull!!!", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BorrowerManager oManager = new BorrowerManager(); BorrowerUnit oUnit = new BorrowerUnit(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); oUnit.CardType = cboType.Text; oUnit.BorrowerCode = txtBorrowerCode.Text; oUnit.LastName = txtLastName.Text; oUnit.FirstName = txtFirstName.Text; oUnit.MiddleName = txtMiddleName.Text; oUnit.Address = txtAddress.Text; oUnit.ContactNumber = txtContactNumber.Text; oUnit.Employer = cboEmployer.Text; oUnit.GuarantorID = cboGuarantorFinancer.EditValue.ToString(); oUnit.GuarantorName = cboGuarantorFinancer.Text; oUnit.ATMNo = txtATMNo.Text; oUnit.EmploymentStatus = cboEmploymentStatus.Text; oUnit.EffectiveDate = Convert.ToDateTime(dtEffectiveDate.EditValue); oUnit.InterestRate = txtInterestRate.Text; oUnit.FrequencyOfPayment = cboFrequencyOfPayment.Text; if (cboPayDayCode.EditValue == null) { oUnit.PayDayCode = ""; } else { oUnit.PayDayCode = cboPayDayCode.EditValue.ToString(); } oUnit.MortgageInfo = txtMortgageInfo.Text; oUnit.CreditLimit = Convert.ToDouble(txtCreditLimit.Text); // Details oManager.UpdateBorrower(oUnit); oManager.Close(); txtBorrowerCode.Enabled = false; MessageBox.Show("Updating successfull!!!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } }