private void PrepareEditView()
        {
            HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity = CurrentHREmployeeBankAccountInformationEntity;


            if (!hREmployeeBankAccountInformationEntity.IsNew)
            {
                txtBankAccountNo.Text = hREmployeeBankAccountInformationEntity.BankAccountNo.ToString();
                txtBankName.Text      = hREmployeeBankAccountInformationEntity.BankName.ToString();
                txtBankAddress.Text   = hREmployeeBankAccountInformationEntity.BankAddress.ToString();
                if (ddlCityID.Items.Count > 0 && hREmployeeBankAccountInformationEntity.CityID != null)
                {
                    ddlCityID.SelectedValue = hREmployeeBankAccountInformationEntity.CityID.ToString();
                }

                txtZipCode.Text = hREmployeeBankAccountInformationEntity.ZipCode.ToString();
                if (ddlBankAccountCategoryID.Items.Count > 0 && hREmployeeBankAccountInformationEntity.BankAccountCategoryID != null)
                {
                    ddlBankAccountCategoryID.SelectedValue = hREmployeeBankAccountInformationEntity.BankAccountCategoryID.ToString();
                }

                txtSwipeCode.Text           = hREmployeeBankAccountInformationEntity.SwipeCode.ToString();
                txtRoutingNo.Text           = hREmployeeBankAccountInformationEntity.RoutingNo.ToString();
                chkIsSalaryAccotunt.Checked = hREmployeeBankAccountInformationEntity.IsSalaryAccotunt;
                chkIsDefault.Checked        = hREmployeeBankAccountInformationEntity.IsDefault;

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Example #2
0
        Int64 IHREmployeeBankAccountInformationDataAccess.Add(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(hREmployeeBankAccountInformationEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(hREmployeeBankAccountInformationEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        private Int64 AddTran(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeBankAccountInformation_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddNullPrimaryKeyParameter(cmd, "EmployeeBankAccountInformationID", db);

                db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeBankAccountInformationEntity.EmployeeID);
                db.AddInParameter(cmd, "@BankAccountNo", DbType.String, hREmployeeBankAccountInformationEntity.BankAccountNo);
                db.AddInParameter(cmd, "@BankName", DbType.String, hREmployeeBankAccountInformationEntity.BankName);
                db.AddInParameter(cmd, "@BankAddress", DbType.String, hREmployeeBankAccountInformationEntity.BankAddress);
                db.AddInParameter(cmd, "@CityID", DbType.Int64, hREmployeeBankAccountInformationEntity.CityID);
                db.AddInParameter(cmd, "@ZipCode", DbType.String, hREmployeeBankAccountInformationEntity.ZipCode);
                db.AddInParameter(cmd, "@POBox", DbType.Binary, hREmployeeBankAccountInformationEntity.POBox);
                db.AddInParameter(cmd, "@BankAccountCategoryID", DbType.Int64, hREmployeeBankAccountInformationEntity.BankAccountCategoryID);
                db.AddInParameter(cmd, "@SwipeCode", DbType.String, hREmployeeBankAccountInformationEntity.SwipeCode);
                db.AddInParameter(cmd, "@RoutingNo", DbType.String, hREmployeeBankAccountInformationEntity.RoutingNo);
                db.AddInParameter(cmd, "@IsSalaryAccotunt", DbType.Boolean, hREmployeeBankAccountInformationEntity.IsSalaryAccotunt);
                db.AddInParameter(cmd, "@IsDefault", DbType.Boolean, hREmployeeBankAccountInformationEntity.IsDefault);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    returnCode = db.ExecuteNonQuery(cmd, transaction);

                    returnCode = GetReturnCodeFromParameter(cmd, db);

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
        private void SaveHREmployeeBankAccountInformationEntity()
        {
            if (IsValid)
            {
                try
                {
                    HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity = BuildHREmployeeBankAccountInformationEntity();

                    Int64 result = -1;

                    if (hREmployeeBankAccountInformationEntity.IsNew)
                    {
                        result = FCCHREmployeeBankAccountInformation.GetFacadeCreate().Add(hREmployeeBankAccountInformationEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeBankAccountInformationEntity.FLD_NAME_EmployeeBankAccountInformationID, hREmployeeBankAccountInformationEntity.EmployeeBankAccountInformationID.ToString(), SQLMatchType.Equal);
                        result = FCCHREmployeeBankAccountInformation.GetFacadeCreate().Update(hREmployeeBankAccountInformationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EmployeeBankAccountInformationID       = 0;
                        _HREmployeeBankAccountInformationEntity = new HREmployeeBankAccountInformationEntity();
                        PrepareInitialView();
                        BindHREmployeeBankAccountInformationList();

                        if (hREmployeeBankAccountInformationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Bank Account Information Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Bank Account Information Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hREmployeeBankAccountInformationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Bank Account Information Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Bank Account Information Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvHREmployeeBankAccountInformation_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 EmployeeBankAccountInformationID;

            Int64.TryParse(e.CommandArgument.ToString(), out EmployeeBankAccountInformationID);

            if (EmployeeBankAccountInformationID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _EmployeeBankAccountInformationID = EmployeeBankAccountInformationID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeBankAccountInformationEntity.FLD_NAME_EmployeeBankAccountInformationID, EmployeeBankAccountInformationID.ToString(), SQLMatchType.Equal);

                        HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity = new HREmployeeBankAccountInformationEntity();


                        result = FCCHREmployeeBankAccountInformation.GetFacadeCreate().Delete(hREmployeeBankAccountInformationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EmployeeBankAccountInformationID       = 0;
                            _HREmployeeBankAccountInformationEntity = new HREmployeeBankAccountInformationEntity();
                            PrepareInitialView();
                            BindHREmployeeBankAccountInformationList();

                            MiscUtil.ShowMessage(lblMessage, "Employee Bank Account Information has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Bank Account Information.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Example #6
0
        private Int64 Update(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeBankAccountInformation_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@EmployeeBankAccountInformationID", DbType.Int64, hREmployeeBankAccountInformationEntity.EmployeeBankAccountInformationID);
                Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeBankAccountInformationEntity.EmployeeID);
                Database.AddInParameter(cmd, "@BankAccountNo", DbType.String, hREmployeeBankAccountInformationEntity.BankAccountNo);
                Database.AddInParameter(cmd, "@BankName", DbType.String, hREmployeeBankAccountInformationEntity.BankName);
                Database.AddInParameter(cmd, "@BankAddress", DbType.String, hREmployeeBankAccountInformationEntity.BankAddress);
                Database.AddInParameter(cmd, "@CityID", DbType.Int64, hREmployeeBankAccountInformationEntity.CityID);
                Database.AddInParameter(cmd, "@ZipCode", DbType.String, hREmployeeBankAccountInformationEntity.ZipCode);
                Database.AddInParameter(cmd, "@POBox", DbType.Binary, hREmployeeBankAccountInformationEntity.POBox);
                Database.AddInParameter(cmd, "@BankAccountCategoryID", DbType.Int64, hREmployeeBankAccountInformationEntity.BankAccountCategoryID);
                Database.AddInParameter(cmd, "@SwipeCode", DbType.String, hREmployeeBankAccountInformationEntity.SwipeCode);
                Database.AddInParameter(cmd, "@RoutingNo", DbType.String, hREmployeeBankAccountInformationEntity.RoutingNo);
                Database.AddInParameter(cmd, "@IsSalaryAccotunt", DbType.Boolean, hREmployeeBankAccountInformationEntity.IsSalaryAccotunt);
                Database.AddInParameter(cmd, "@IsDefault", DbType.Boolean, hREmployeeBankAccountInformationEntity.IsDefault);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity already exists. Please specify another HREmployeeBankAccountInformationEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity already exists. Please specify another HREmployeeBankAccountInformationEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Example #7
0
        private Int64 DeleteTran(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeBankAccountInformation_SET";

            Database db = DatabaseFactory.CreateDatabase();


            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);


                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode >= 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
        private HREmployeeBankAccountInformationEntity BuildHREmployeeBankAccountInformationEntity()
        {
            HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity = CurrentHREmployeeBankAccountInformationEntity;


            hREmployeeBankAccountInformationEntity.EmployeeID = OverviewEmployeeID;

            hREmployeeBankAccountInformationEntity.BankAccountNo = txtBankAccountNo.Text.Trim();
            hREmployeeBankAccountInformationEntity.BankName      = txtBankName.Text.Trim();
            hREmployeeBankAccountInformationEntity.BankAddress   = txtBankAddress.Text.Trim();
            if (ddlCityID.Items.Count > 0)
            {
                if (ddlCityID.SelectedValue == "0")
                {
                }
                else
                {
                    hREmployeeBankAccountInformationEntity.CityID = Int64.Parse(ddlCityID.SelectedValue);
                }
            }

            hREmployeeBankAccountInformationEntity.ZipCode = txtZipCode.Text.Trim();
            if (ddlBankAccountCategoryID.Items.Count > 0)
            {
                if (ddlBankAccountCategoryID.SelectedValue == "0")
                {
                }
                else
                {
                    hREmployeeBankAccountInformationEntity.BankAccountCategoryID = Int64.Parse(ddlBankAccountCategoryID.SelectedValue);
                }
            }

            hREmployeeBankAccountInformationEntity.SwipeCode        = txtSwipeCode.Text.Trim();
            hREmployeeBankAccountInformationEntity.RoutingNo        = txtRoutingNo.Text.Trim();
            hREmployeeBankAccountInformationEntity.IsSalaryAccotunt = chkIsSalaryAccotunt.Checked;

            hREmployeeBankAccountInformationEntity.IsDefault = chkIsDefault.Checked;


            return(hREmployeeBankAccountInformationEntity);
        }
Example #9
0
        private Int64 Delete(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeBankAccountInformation_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);


                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity already exists. Please specify another HREmployeeBankAccountInformationEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("HREmployeeBankAccountInformationEntity already exists. Please specify another HREmployeeBankAccountInformationEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Example #10
0
 Int64 IHREmployeeBankAccountInformationFacade.Delete(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeBankAccountInformationDataAccess().Delete(hREmployeeBankAccountInformationEntity, filterExpression, option, reqTran));
 }
Example #11
0
 Int64 IHREmployeeBankAccountInformationFacade.Add(HREmployeeBankAccountInformationEntity hREmployeeBankAccountInformationEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeBankAccountInformationDataAccess().Add(hREmployeeBankAccountInformationEntity, option, reqTran));
 }
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _EmployeeBankAccountInformationID       = 0;
     _HREmployeeBankAccountInformationEntity = new HREmployeeBankAccountInformationEntity();
     PrepareInitialView();
 }