Exemple #1
0
        private void PrepareEditView()
        {
            HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity = CurrentHREmployeeSalaryBreakdownHistoryEntity;


            if (!hREmployeeSalaryBreakdownHistoryEntity.IsNew)
            {
                txtEmployeeSalaryBreakdownHistoryID.Text = hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakdownHistoryID.ToString();
                if (ddlEmployeeSalaryBreakDownID.Items.Count > 0 && hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakDownID != null)
                {
                    ddlEmployeeSalaryBreakDownID.SelectedValue = hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakDownID.ToString();
                }

                txtEmployeeSalaryInfoID.Text = hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryInfoID.ToString();
                txtEmployeeID.Text           = hREmployeeSalaryBreakdownHistoryEntity.EmployeeID.ToString();
                txtYearlyRate.Text           = hREmployeeSalaryBreakdownHistoryEntity.YearlyRate.ToString();
                txtMonthlyRate.Text          = hREmployeeSalaryBreakdownHistoryEntity.MonthlyRate.ToString();
                txtDailyRate.Text            = hREmployeeSalaryBreakdownHistoryEntity.DailyRate.ToString();
                txtOTHourlyRate.Text         = hREmployeeSalaryBreakdownHistoryEntity.OTHourlyRate.ToString();
                txtHoulryRate.Text           = hREmployeeSalaryBreakdownHistoryEntity.HoulryRate.ToString();
                txtCreateDate.Text           = hREmployeeSalaryBreakdownHistoryEntity.CreateDate.ToStringDefault();
                if (ddlCreatedByEmployeeID.Items.Count > 0 && hREmployeeSalaryBreakdownHistoryEntity.CreatedByEmployeeID != null)
                {
                    ddlCreatedByEmployeeID.SelectedValue = hREmployeeSalaryBreakdownHistoryEntity.CreatedByEmployeeID.ToString();
                }


                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Exemple #2
0
        Int64 IHREmployeeSalaryBreakdownHistoryDataAccess.Add(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        private Int64 UpdateTran(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryBreakdownHistory_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, "@EmployeeSalaryBreakdownHistoryID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakdownHistoryID);
                db.AddInParameter(cmd, "@EmployeeSalaryBreakDownID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakDownID);
                db.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryInfoID);
                db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeID);
                db.AddInParameter(cmd, "@YearlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.YearlyRate);
                db.AddInParameter(cmd, "@MonthlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.MonthlyRate);
                db.AddInParameter(cmd, "@DailyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.DailyRate);
                db.AddInParameter(cmd, "@OTHourlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.OTHourlyRate);
                db.AddInParameter(cmd, "@HoulryRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.HoulryRate);
                db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeSalaryBreakdownHistoryEntity.CreateDate);
                db.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.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);
        }
Exemple #4
0
        private void SaveHREmployeeSalaryBreakdownHistoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity = BuildHREmployeeSalaryBreakdownHistoryEntity();

                    Int64 result = -1;

                    if (hREmployeeSalaryBreakdownHistoryEntity.IsNew)
                    {
                        result = FCCHREmployeeSalaryBreakdownHistory.GetFacadeCreate().Add(hREmployeeSalaryBreakdownHistoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryBreakdownHistoryEntity.FLD_NAME_EmployeeSalaryBreakdownHistoryID, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakdownHistoryID.ToString(), SQLMatchType.Equal);
                        result = FCCHREmployeeSalaryBreakdownHistory.GetFacadeCreate().Update(hREmployeeSalaryBreakdownHistoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EmployeeSalaryBreakdownHistoryID       = 0;
                        _HREmployeeSalaryBreakdownHistoryEntity = new HREmployeeSalaryBreakdownHistoryEntity();
                        PrepareInitialView();
                        BindHREmployeeSalaryBreakdownHistoryList();

                        if (hREmployeeSalaryBreakdownHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Breakdown History Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Breakdown History Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hREmployeeSalaryBreakdownHistoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Salary Breakdown History Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Salary Breakdown History Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemple #5
0
        protected void lvHREmployeeSalaryBreakdownHistory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 EmployeeSalaryBreakdownHistoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryBreakdownHistoryEntity.FLD_NAME_EmployeeSalaryBreakdownHistoryID, EmployeeSalaryBreakdownHistoryID.ToString(), SQLMatchType.Equal);

                        HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity = new HREmployeeSalaryBreakdownHistoryEntity();


                        result = FCCHREmployeeSalaryBreakdownHistory.GetFacadeCreate().Delete(hREmployeeSalaryBreakdownHistoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EmployeeSalaryBreakdownHistoryID       = 0;
                            _HREmployeeSalaryBreakdownHistoryEntity = new HREmployeeSalaryBreakdownHistoryEntity();
                            PrepareInitialView();
                            BindHREmployeeSalaryBreakdownHistoryList();

                            MiscUtil.ShowMessage(lblMessage, "Employee Salary Breakdown History has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Salary Breakdown History.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Exemple #6
0
        private Int64 DeleteTran(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryBreakdownHistory_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);
        }
Exemple #7
0
        private Int64 Update(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryBreakdownHistory_SET";

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

                Database.AddInParameter(cmd, "@EmployeeSalaryBreakdownHistoryID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakdownHistoryID);
                Database.AddInParameter(cmd, "@EmployeeSalaryBreakDownID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakDownID);
                Database.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryInfoID);
                Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.EmployeeID);
                Database.AddInParameter(cmd, "@YearlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.YearlyRate);
                Database.AddInParameter(cmd, "@MonthlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.MonthlyRate);
                Database.AddInParameter(cmd, "@DailyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.DailyRate);
                Database.AddInParameter(cmd, "@OTHourlyRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.OTHourlyRate);
                Database.AddInParameter(cmd, "@HoulryRate", DbType.Decimal, hREmployeeSalaryBreakdownHistoryEntity.HoulryRate);
                Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeSalaryBreakdownHistoryEntity.CreateDate);
                Database.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hREmployeeSalaryBreakdownHistoryEntity.CreatedByEmployeeID);

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

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

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

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

            return(returnCode);
        }
Exemple #8
0
        private Int64 Delete(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HREmployeeSalaryBreakdownHistory_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("HREmployeeSalaryBreakdownHistoryEntity already exists. Please specify another HREmployeeSalaryBreakdownHistoryEntity.");
                    }

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

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

            return(returnCode);
        }
Exemple #9
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _EmployeeSalaryBreakdownHistoryID       = 0;
     _HREmployeeSalaryBreakdownHistoryEntity = new HREmployeeSalaryBreakdownHistoryEntity();
     PrepareInitialView();
 }
Exemple #10
0
        private HREmployeeSalaryBreakdownHistoryEntity BuildHREmployeeSalaryBreakdownHistoryEntity()
        {
            HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity = CurrentHREmployeeSalaryBreakdownHistoryEntity;

            if (!txtEmployeeSalaryBreakdownHistoryID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakdownHistoryID = Int64.Parse(txtEmployeeSalaryBreakdownHistoryID.Text.Trim());
            }

            if (ddlEmployeeSalaryBreakDownID.Items.Count > 0)
            {
                if (ddlEmployeeSalaryBreakDownID.SelectedValue == "0")
                {
                }
                else
                {
                    hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryBreakDownID = Int64.Parse(ddlEmployeeSalaryBreakDownID.SelectedValue);
                }
            }

            if (!txtEmployeeSalaryInfoID.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.EmployeeSalaryInfoID = Int64.Parse(txtEmployeeSalaryInfoID.Text.Trim());
            }

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

            if (!txtYearlyRate.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.YearlyRate = Decimal.Parse(txtYearlyRate.Text.Trim());
            }

            if (!txtMonthlyRate.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.MonthlyRate = Decimal.Parse(txtMonthlyRate.Text.Trim());
            }

            if (!txtDailyRate.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.DailyRate = Decimal.Parse(txtDailyRate.Text.Trim());
            }

            if (!txtOTHourlyRate.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.OTHourlyRate = Decimal.Parse(txtOTHourlyRate.Text.Trim());
            }

            if (!txtHoulryRate.Text.Trim().IsNullOrEmpty())
            {
                hREmployeeSalaryBreakdownHistoryEntity.HoulryRate = Decimal.Parse(txtHoulryRate.Text.Trim());
            }

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

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


            return(hREmployeeSalaryBreakdownHistoryEntity);
        }
 Int64 IHREmployeeSalaryBreakdownHistoryFacade.Delete(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeSalaryBreakdownHistoryDataAccess().Delete(hREmployeeSalaryBreakdownHistoryEntity, filterExpression, option, reqTran));
 }
 Int64 IHREmployeeSalaryBreakdownHistoryFacade.Add(HREmployeeSalaryBreakdownHistoryEntity hREmployeeSalaryBreakdownHistoryEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHREmployeeSalaryBreakdownHistoryDataAccess().Add(hREmployeeSalaryBreakdownHistoryEntity, option, reqTran));
 }