Example #1
0
        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();
        }
        public void AddBorrower(BorrowerUnit oUnit)
        {
            SqlCommand oCommand = new SqlCommand();

            oCommand.Connection = this.Connection;
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.CommandText = "SP_TRANS_INSERT_BORROWER";
            oCommand.Parameters.Add(new SqlParameter("@CardType", oUnit.CardType));
            oCommand.Parameters.Add(new SqlParameter("@BorrowerCode", oUnit.BorrowerCode));
            oCommand.Parameters.Add(new SqlParameter("@LastName", oUnit.LastName));
            oCommand.Parameters.Add(new SqlParameter("@FirstName", oUnit.FirstName));
            oCommand.Parameters.Add(new SqlParameter("@MiddleName", oUnit.MiddleName));
            oCommand.Parameters.Add(new SqlParameter("@Address", oUnit.Address));
            oCommand.Parameters.Add(new SqlParameter("@ContactNumber", oUnit.ContactNumber));
            oCommand.Parameters.Add(new SqlParameter("@Employer", oUnit.Employer));
            oCommand.Parameters.Add(new SqlParameter("@GuarantorID", oUnit.GuarantorID));
            oCommand.Parameters.Add(new SqlParameter("@GuarantorName", oUnit.GuarantorName));
            oCommand.Parameters.Add(new SqlParameter("@ATMNo", oUnit.ATMNo));
            oCommand.Parameters.Add(new SqlParameter("@EmploymentStatus", oUnit.EmploymentStatus));
            oCommand.Parameters.Add(new SqlParameter("@EffectiveDate", oUnit.EffectiveDate));
            oCommand.Parameters.Add(new SqlParameter("@FrequencyOfPayment", oUnit.FrequencyOfPayment));
            oCommand.Parameters.Add(new SqlParameter("@InterestRate", oUnit.InterestRate));
            oCommand.Parameters.Add(new SqlParameter("@PayDayCode", oUnit.PayDayCode));
            oCommand.Parameters.Add(new SqlParameter("@MortgageInfo", oUnit.MortgageInfo));
            oCommand.Parameters.Add(new SqlParameter("@CreditLimit", oUnit.CreditLimit));

            oCommand.ExecuteNonQuery();
        }
Example #3
0
        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;
        }
Example #4
0
        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);
            }
        }