示例#1
0
        private void btnButton_Click(object sender, EventArgs e)
        {
            if (btnButton.Text.Trim() == "IMPORT")
            {
                if (txtImportPath.Text.Trim() == String.Empty)
                {
                    MessageBox.Show("Please select file to import");
                    return;
                }

                #region Import
                try
                {
                    if (cboImport.SelectedText == "BORROWER" || cboImport.Text == "BORROWER")
                    {
                        if (dgImport.Rows.Count > 0)
                        {
                            foreach (var iData in lstBorrower)
                            {
                                oBorrower = new DataAccess.Borrower();
                                if (!oBorrower.IsRecordExists(iData))
                                {
                                    oBorrower.InsertBorrower(iData);
                                }
                            }

                            oFrmMsgBox = new Forms.frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
                            oFrmMsgBox.m_MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                            oFrmMsgBox.ShowDialog();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                #endregion
            }
            else
            {
                if (txtExportPath.Text.Trim() == string.Empty)
                {
                    MessageBox.Show(eVariable.TransactionMessage.PLEASE_SELECT_DISTINATION_PATH_TO_SAVE_THE_FILE.ToString().Replace("_", " "));
                    return;
                }

                if (dgExport.Rows.Count == 0)
                {
                    MessageBox.Show(eVariable.TransactionMessage.PLEASE_POPULATE_A_RECORD_FIRST.ToString().Replace("_", " "));
                    return;
                }

                #region Export
                ExtractData();
                #endregion
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            oMBorrower      = new Model.Borrower();
            oBorrower       = new DataAccess.Borrower();
            oCommonFunction = new CommonFunction.CommonFunction();
            oImageFunction  = new CommonFunction.CommonFunction();

            if (eVariable.IsFieldEmpty(pnlMain))
            {
                oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " "));
                oFrmMsgBox.ShowDialog();
                return;
            }

            oMBorrower.PERSON_ID   = txtBorrowerID.Text;
            oMBorrower.FIRST_NAME  = txtFname.Text;
            oMBorrower.MIDDLE_NAME = txtMname.Text;
            oMBorrower.LAST_NAME   = txtLname.Text;
            oMBorrower.DOB         = dtDOB.Value.ToString("yyyy-MM-dd");
            oMBorrower.AGE         = txtAge.Text;
            oMBorrower.CONTACT_NO  = txtContactNo.Text;
            oMBorrower.ADDRESS     = txtAddress.Text;

            if (pImage.Image != null)
            {
                oMBorrower.PROFILE_PIC = oCommonFunction.CompressString(oImageFunction.ImageToBaseString(pImage.Image, ImageFormat.Png));
            }


            if (eVariable.m_ActionType == eVariable.ACTION_TYPE.EDIT)
            {
                oMBorrower.MODIFIED_BY   = eVariable.sUsername;
                oMBorrower.MODIFIED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oBorrower.UpdateBorrower(oMBorrower);
            }
            else
            {
                oMBorrower.ADDED_BY   = eVariable.sUsername;
                oMBorrower.ADDED_DATE = DateTime.Now.ToString("yyyy-MM-dd");
                oBorrower.InsertBorrower(oMBorrower);
            }

            oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " "));
            oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
            oFrmMsgBox.ShowDialog();
            oFrmBorrowerLst.LoadBorrower();
            eVariable.ClearText(pnlMain);
            ResetFields();
            Close();
        }