Beispiel #1
0
        private void PrepareEditView()
        {
            HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity = CurrentHREmployeeSalaryInfoHistoryEntity;


            if (!hREmployeeSalaryInfoHistoryEntity.IsNew)
            {
                if (ddlEmployeeSalaryInfoID.Items.Count > 0 && hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoID != null)
                {
                    ddlEmployeeSalaryInfoID.SelectedValue = hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoID.ToString();
                }

                txtDesignationID.Text   = hREmployeeSalaryInfoHistoryEntity.DesignationID.ToString();
                txtFiscalYearID.Text    = hREmployeeSalaryInfoHistoryEntity.FiscalYearID.ToString();
                txtSalarySessionID.Text = hREmployeeSalaryInfoHistoryEntity.SalarySessionID.ToString();
                txtEmployeeID.Text      = hREmployeeSalaryInfoHistoryEntity.EmployeeID.ToString();
                chkIsDeposite.Checked   = hREmployeeSalaryInfoHistoryEntity.IsDeposite;
                txtSalaryAmount.Text    = hREmployeeSalaryInfoHistoryEntity.SalaryAmount.ToString();
                txtPayCycleID.Text      = hREmployeeSalaryInfoHistoryEntity.PayCycleID.ToString();
                txtPayscaleID.Text      = hREmployeeSalaryInfoHistoryEntity.PayscaleID.ToString();
                txtEmployeeCode.Text    = hREmployeeSalaryInfoHistoryEntity.EmployeeCode.ToString();
                txtProjectID.Text       = hREmployeeSalaryInfoHistoryEntity.ProjectID.ToString();
                txtDepartmentID.Text    = hREmployeeSalaryInfoHistoryEntity.DepartmentID.ToString();
                txtCreateDate.Text      = hREmployeeSalaryInfoHistoryEntity.CreateDate.ToStringDefault();
                if (ddlCreatedByEmployeeID.Items.Count > 0 && hREmployeeSalaryInfoHistoryEntity.CreatedByEmployeeID != null)
                {
                    ddlCreatedByEmployeeID.SelectedValue = hREmployeeSalaryInfoHistoryEntity.CreatedByEmployeeID.ToString();
                }


                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Beispiel #2
0
        Int64 IHREmployeeSalaryInfoHistoryDataAccess.Add(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private void SaveHREmployeeSalaryInfoHistoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity = BuildHREmployeeSalaryInfoHistoryEntity();

                    Int64 result = -1;

                    if (hREmployeeSalaryInfoHistoryEntity.IsNew)
                    {
                        result = FCCHREmployeeSalaryInfoHistory.GetFacadeCreate().Add(hREmployeeSalaryInfoHistoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryInfoHistoryEntity.FLD_NAME_EmployeeSalaryInfoHistoryID, hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoHistoryID.ToString(), SQLMatchType.Equal);
                        result = FCCHREmployeeSalaryInfoHistory.GetFacadeCreate().Update(hREmployeeSalaryInfoHistoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EmployeeSalaryInfoHistoryID       = 0;
                        _HREmployeeSalaryInfoHistoryEntity = new HREmployeeSalaryInfoHistoryEntity();
                        PrepareInitialView();
                        BindHREmployeeSalaryInfoHistoryList();

                        if (hREmployeeSalaryInfoHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Info History Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Info History Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hREmployeeSalaryInfoHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Salary Info History Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Salary Info History Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #4
0
        private Int64 Update(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryInfoHistory_SET";

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

                Database.AddInParameter(cmd, "@EmployeeSalaryInfoHistoryID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoHistoryID);
                Database.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoID);
                Database.AddInParameter(cmd, "@DesignationID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.DesignationID);
                Database.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.FiscalYearID);
                Database.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.SalarySessionID);
                Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeID);
                Database.AddInParameter(cmd, "@IsDeposite", DbType.Boolean, hREmployeeSalaryInfoHistoryEntity.IsDeposite);
                Database.AddInParameter(cmd, "@SalaryAmount", DbType.Decimal, hREmployeeSalaryInfoHistoryEntity.SalaryAmount);
                Database.AddInParameter(cmd, "@PayCycleID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.PayCycleID);
                Database.AddInParameter(cmd, "@PayscaleID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.PayscaleID);
                Database.AddInParameter(cmd, "@EmployeeCode", DbType.String, hREmployeeSalaryInfoHistoryEntity.EmployeeCode);
                Database.AddInParameter(cmd, "@ProjectID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.ProjectID);
                Database.AddInParameter(cmd, "@DepartmentID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.DepartmentID);
                Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeSalaryInfoHistoryEntity.CreateDate);
                Database.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.CreatedByEmployeeID);

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

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

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

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

            return(returnCode);
        }
Beispiel #5
0
        protected void lvHREmployeeSalaryInfoHistory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 EmployeeSalaryInfoHistoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryInfoHistoryEntity.FLD_NAME_EmployeeSalaryInfoHistoryID, EmployeeSalaryInfoHistoryID.ToString(), SQLMatchType.Equal);

                        HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity = new HREmployeeSalaryInfoHistoryEntity();


                        result = FCCHREmployeeSalaryInfoHistory.GetFacadeCreate().Delete(hREmployeeSalaryInfoHistoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EmployeeSalaryInfoHistoryID       = 0;
                            _HREmployeeSalaryInfoHistoryEntity = new HREmployeeSalaryInfoHistoryEntity();
                            PrepareInitialView();
                            BindHREmployeeSalaryInfoHistoryList();

                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Info History has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Salary Info History.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #6
0
        private Int64 DeleteTran(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryInfoHistory_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);
        }
Beispiel #7
0
        private Int64 Delete(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryInfoHistory_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("HREmployeeSalaryInfoHistoryEntity already exists. Please specify another HREmployeeSalaryInfoHistoryEntity.");
                    }

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

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

            return(returnCode);
        }
Beispiel #8
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _EmployeeSalaryInfoHistoryID       = 0;
     _HREmployeeSalaryInfoHistoryEntity = new HREmployeeSalaryInfoHistoryEntity();
     PrepareInitialView();
 }
Beispiel #9
0
        private HREmployeeSalaryInfoHistoryEntity BuildHREmployeeSalaryInfoHistoryEntity()
        {
            HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity = CurrentHREmployeeSalaryInfoHistoryEntity;

            if (ddlEmployeeSalaryInfoID.Items.Count > 0)
            {
                if (ddlEmployeeSalaryInfoID.SelectedValue == "0")
                {
                }
                else
                {
                    hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoID = Int64.Parse(ddlEmployeeSalaryInfoID.SelectedValue);
                }
            }

            if (!txtDesignationID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.DesignationID = Int64.Parse(txtDesignationID.Text.Trim());
            }
            else
            {
                hREmployeeSalaryInfoHistoryEntity.DesignationID = null;
            }

            if (!txtFiscalYearID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.FiscalYearID = Int64.Parse(txtFiscalYearID.Text.Trim());
            }

            if (!txtSalarySessionID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.SalarySessionID = Int64.Parse(txtSalarySessionID.Text.Trim());
            }

            if (!txtEmployeeID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.EmployeeID = Int64.Parse(txtEmployeeID.Text.Trim());
            }

            hREmployeeSalaryInfoHistoryEntity.IsDeposite = chkIsDeposite.Checked;

            if (!txtSalaryAmount.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.SalaryAmount = Decimal.Parse(txtSalaryAmount.Text.Trim());
            }

            if (!txtPayCycleID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.PayCycleID = Int64.Parse(txtPayCycleID.Text.Trim());
            }
            else
            {
                hREmployeeSalaryInfoHistoryEntity.PayCycleID = null;
            }

            if (!txtPayscaleID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.PayscaleID = Int64.Parse(txtPayscaleID.Text.Trim());
            }
            else
            {
                hREmployeeSalaryInfoHistoryEntity.PayscaleID = null;
            }

            hREmployeeSalaryInfoHistoryEntity.EmployeeCode = txtEmployeeCode.Text.Trim();
            if (!txtProjectID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.ProjectID = Int64.Parse(txtProjectID.Text.Trim());
            }
            else
            {
                hREmployeeSalaryInfoHistoryEntity.ProjectID = null;
            }

            if (!txtDepartmentID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.DepartmentID = Int64.Parse(txtDepartmentID.Text.Trim());
            }
            else
            {
                hREmployeeSalaryInfoHistoryEntity.DepartmentID = null;
            }

            if (txtCreateDate.Text.Trim().IsNotNullOrEmpty())
            {
                hREmployeeSalaryInfoHistoryEntity.CreateDate = MiscUtil.ParseToDateTime(txtCreateDate.Text);
            }

            if (ddlCreatedByEmployeeID.Items.Count > 0)
            {
                if (ddlCreatedByEmployeeID.SelectedValue == "0")
                {
                }
                else
                {
                    hREmployeeSalaryInfoHistoryEntity.CreatedByEmployeeID = Int64.Parse(ddlCreatedByEmployeeID.SelectedValue);
                }
            }


            return(hREmployeeSalaryInfoHistoryEntity);
        }
Beispiel #10
0
 Int64 IHREmployeeSalaryInfoHistoryFacade.Delete(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeSalaryInfoHistoryDataAccess().Delete(hREmployeeSalaryInfoHistoryEntity, filterExpression, option, reqTran));
 }
Beispiel #11
0
 Int64 IHREmployeeSalaryInfoHistoryFacade.Add(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeSalaryInfoHistoryDataAccess().Add(hREmployeeSalaryInfoHistoryEntity, option, reqTran));
 }
Beispiel #12
0
        private Int64 UpdateTran(HREmployeeSalaryInfoHistoryEntity hREmployeeSalaryInfoHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryInfoHistory_SET";

            Database db = DatabaseFactory.CreateDatabase();

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

                db.AddInParameter(cmd, "@EmployeeSalaryInfoHistoryID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoHistoryID);
                db.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeSalaryInfoID);
                db.AddInParameter(cmd, "@DesignationID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.DesignationID);
                db.AddInParameter(cmd, "@FiscalYearID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.FiscalYearID);
                db.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.SalarySessionID);
                db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.EmployeeID);
                db.AddInParameter(cmd, "@IsDeposite", DbType.Boolean, hREmployeeSalaryInfoHistoryEntity.IsDeposite);
                db.AddInParameter(cmd, "@SalaryAmount", DbType.Decimal, hREmployeeSalaryInfoHistoryEntity.SalaryAmount);
                db.AddInParameter(cmd, "@PayCycleID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.PayCycleID);
                db.AddInParameter(cmd, "@PayscaleID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.PayscaleID);
                db.AddInParameter(cmd, "@EmployeeCode", DbType.String, hREmployeeSalaryInfoHistoryEntity.EmployeeCode);
                db.AddInParameter(cmd, "@ProjectID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.ProjectID);
                db.AddInParameter(cmd, "@DepartmentID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.DepartmentID);
                db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeSalaryInfoHistoryEntity.CreateDate);
                db.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hREmployeeSalaryInfoHistoryEntity.CreatedByEmployeeID);

                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);
        }