Int64 IHREmployeeSalaryBreakDownDataAccess.Add(HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Add(hREmployeeSalaryBreakDownEntity, option); break; } case TransactionRequired.Yes: { retValues = AddTran(hREmployeeSalaryBreakDownEntity, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
private Int64 UpdateTran(HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeSalaryBreakDown_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, "@EmployeeSalaryBreakDownID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeSalaryBreakDownID); db.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeSalaryInfoID); db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeID); db.AddInParameter(cmd, "@YearlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.YearlyRate); db.AddInParameter(cmd, "@MonthlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.MonthlyRate); db.AddInParameter(cmd, "@DailyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.DailyRate); db.AddInParameter(cmd, "@OTHourlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.OTHourlyRate); db.AddInParameter(cmd, "@HoulryRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.HoulryRate); 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 void SaveHREmployeeSalaryBreakDownEntity() { if (IsValid) { try { HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity = BuildHREmployeeSalaryBreakDownEntity(); Int64 result = -1; if (hREmployeeSalaryBreakDownEntity.IsNew) { result = FCCHREmployeeSalaryBreakDown.GetFacadeCreate().Add(hREmployeeSalaryBreakDownEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryBreakDownEntity.FLD_NAME_EmployeeSalaryBreakDownID, hREmployeeSalaryBreakDownEntity.EmployeeSalaryBreakDownID.ToString(), SQLMatchType.Equal); result = FCCHREmployeeSalaryBreakDown.GetFacadeCreate().Update(hREmployeeSalaryBreakDownEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _EmployeeSalaryBreakDownID = 0; _HREmployeeSalaryBreakDownEntity = new HREmployeeSalaryBreakDownEntity(); PrepareInitialView(); BindHREmployeeSalaryBreakDownList(); if (hREmployeeSalaryBreakDownEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Employee Salary Break Down Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Employee Salary Break Down Information has been updated successfully.", false); } } else { if (hREmployeeSalaryBreakDownEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Salary Break Down Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Salary Break Down Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvHREmployeeSalaryBreakDown_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 EmployeeSalaryBreakDownID; Int64.TryParse(e.CommandArgument.ToString(), out EmployeeSalaryBreakDownID); if (EmployeeSalaryBreakDownID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _EmployeeSalaryBreakDownID = EmployeeSalaryBreakDownID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeSalaryBreakDownEntity.FLD_NAME_EmployeeSalaryBreakDownID, EmployeeSalaryBreakDownID.ToString(), SQLMatchType.Equal); HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity = new HREmployeeSalaryBreakDownEntity(); result = FCCHREmployeeSalaryBreakDown.GetFacadeCreate().Delete(hREmployeeSalaryBreakDownEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _EmployeeSalaryBreakDownID = 0; _HREmployeeSalaryBreakDownEntity = new HREmployeeSalaryBreakDownEntity(); PrepareInitialView(); BindHREmployeeSalaryBreakDownList(); MiscUtil.ShowMessage(lblMessage, "Employee Salary Break Down has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Salary Break Down.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private Int64 Update(HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeSalaryBreakDown_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); Database.AddInParameter(cmd, "@EmployeeSalaryBreakDownID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeSalaryBreakDownID); Database.AddInParameter(cmd, "@EmployeeSalaryInfoID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeSalaryInfoID); Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeSalaryBreakDownEntity.EmployeeID); Database.AddInParameter(cmd, "@YearlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.YearlyRate); Database.AddInParameter(cmd, "@MonthlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.MonthlyRate); Database.AddInParameter(cmd, "@DailyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.DailyRate); Database.AddInParameter(cmd, "@OTHourlyRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.OTHourlyRate); Database.AddInParameter(cmd, "@HoulryRate", DbType.Decimal, hREmployeeSalaryBreakDownEntity.HoulryRate); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("HREmployeeSalaryBreakDownEntity already exists. Please specify another HREmployeeSalaryBreakDownEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeeSalaryBreakDownEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeeSalaryBreakDownEntity already exists. Please specify another HREmployeeSalaryBreakDownEntity."); } } } } return(returnCode); }
private HREmployeeSalaryBreakDownEntity BuildHREmployeeSalaryBreakDownEntity() { HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity = CurrentHREmployeeSalaryBreakDownEntity; hREmployeeSalaryBreakDownEntity.EmployeeSalaryInfoID = OverViewEmployeeSalaryInfoID; if (ddlEmployeeID.Items.Count > 0) { if (ddlEmployeeID.SelectedValue == "0") { } else { hREmployeeSalaryBreakDownEntity.EmployeeID = Int64.Parse(ddlEmployeeID.SelectedValue); } } if (!txtYearlyRate.Text.Trim().IsNullOrEmpty()) { hREmployeeSalaryBreakDownEntity.YearlyRate = Decimal.Parse(txtYearlyRate.Text.Trim()); } if (!txtMonthlyRate.Text.Trim().IsNullOrEmpty()) { hREmployeeSalaryBreakDownEntity.MonthlyRate = Decimal.Parse(txtMonthlyRate.Text.Trim()); } if (!txtDailyRate.Text.Trim().IsNullOrEmpty()) { hREmployeeSalaryBreakDownEntity.DailyRate = Decimal.Parse(txtDailyRate.Text.Trim()); } if (!txtOTHourlyRate.Text.Trim().IsNullOrEmpty()) { hREmployeeSalaryBreakDownEntity.OTHourlyRate = Decimal.Parse(txtOTHourlyRate.Text.Trim()); } if (!txtHoulryRate.Text.Trim().IsNullOrEmpty()) { hREmployeeSalaryBreakDownEntity.HoulryRate = Decimal.Parse(txtHoulryRate.Text.Trim()); } return(hREmployeeSalaryBreakDownEntity); }
private void PrepareEditView() { HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity = CurrentHREmployeeSalaryBreakDownEntity; if (!hREmployeeSalaryBreakDownEntity.IsNew) { if (ddlEmployeeID.Items.Count > 0 && hREmployeeSalaryBreakDownEntity.EmployeeID != null) { ddlEmployeeID.SelectedValue = hREmployeeSalaryBreakDownEntity.EmployeeID.ToString(); } txtYearlyRate.Text = hREmployeeSalaryBreakDownEntity.YearlyRate.ToString(); txtMonthlyRate.Text = hREmployeeSalaryBreakDownEntity.MonthlyRate.ToString(); txtDailyRate.Text = hREmployeeSalaryBreakDownEntity.DailyRate.ToString(); txtOTHourlyRate.Text = hREmployeeSalaryBreakDownEntity.OTHourlyRate.ToString(); txtHoulryRate.Text = hREmployeeSalaryBreakDownEntity.HoulryRate.ToString(); btnSubmit.Text = "Update"; btnAddNew.Visible = true; } }
protected void btnAddNew_Click(object sender, EventArgs e) { _EmployeeSalaryBreakDownID = 0; _HREmployeeSalaryBreakDownEntity = new HREmployeeSalaryBreakDownEntity(); PrepareInitialView(); }
Int64 IHREmployeeSalaryBreakDownFacade.Delete(HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeSalaryBreakDownDataAccess().Delete(hREmployeeSalaryBreakDownEntity, filterExpression, option, reqTran)); }
Int64 IHREmployeeSalaryBreakDownFacade.Add(HREmployeeSalaryBreakDownEntity hREmployeeSalaryBreakDownEntity, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeSalaryBreakDownDataAccess().Add(hREmployeeSalaryBreakDownEntity, option, reqTran)); }