Example #1
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 #2
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);
            }
        }