Int64 IHREmployeePhoneBillAdjustmentDataAccess.Add(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Add(hREmployeePhoneBillAdjustmentEntity, option); break; } case TransactionRequired.Yes: { retValues = AddTran(hREmployeePhoneBillAdjustmentEntity, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
private void DeleteAllCurrentData() { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeMonthlyTimeSheetSummaryEntity.FLD_NAME_SalarySessionID, (Int64.Parse(ddlSalarySessionID.SelectedValue)).ToString(), SQLMatchType.Equal); HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity = new HREmployeePhoneBillAdjustmentEntity(); result = FCCHREmployeePhoneBillAdjustment.GetFacadeCreate().Delete(hREmployeePhoneBillAdjustmentEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _PhoneBillAdjustmentID = 0; _HREmployeePhoneBillAdjustmentEntity = new HREmployeePhoneBillAdjustmentEntity(); PrepareInitialView(); MiscUtil.ShowMessage(lblMessage, "Phone Bill Adjustment has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Phone Bill Adjustment.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } }
private Int64 UpdateTran(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeePhoneBillAdjustment_SET"; Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option, db); AddOutputParameter(cmd, db); AddFilterExpressionParameter(cmd, filterExpression, db); Database.AddInParameter(cmd, "@PhoneBillAdjustmentID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.PhoneBillAdjustmentID); db.AddInParameter(cmd, "@PhoneBillAdjustmentID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.PhoneBillAdjustmentID); db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.EmployeeID); db.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.SalarySessionID); db.AddInParameter(cmd, "@PhoneBillAmount", DbType.Decimal, hREmployeePhoneBillAdjustmentEntity.PhoneBillAmount); db.AddInParameter(cmd, "@PhoneBillNote", DbType.String, hREmployeePhoneBillAdjustmentEntity.PhoneBillNote); db.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, hREmployeePhoneBillAdjustmentEntity.IsRemoved); 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 Int64 DeleteTran(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeePhoneBillAdjustment_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 Int64 Update(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeePhoneBillAdjustment_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); Database.AddInParameter(cmd, "@PhoneBillAdjustmentID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.PhoneBillAdjustmentID); Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.EmployeeID); Database.AddInParameter(cmd, "@SalarySessionID", DbType.Int64, hREmployeePhoneBillAdjustmentEntity.SalarySessionID); Database.AddInParameter(cmd, "@PhoneBillAmount", DbType.Decimal, hREmployeePhoneBillAdjustmentEntity.PhoneBillAmount); Database.AddInParameter(cmd, "@PhoneBillNote", DbType.String, hREmployeePhoneBillAdjustmentEntity.PhoneBillNote); Database.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, hREmployeePhoneBillAdjustmentEntity.IsRemoved); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("HREmployeePhoneBillAdjustmentEntity already exists. Please specify another HREmployeePhoneBillAdjustmentEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeePhoneBillAdjustmentEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeePhoneBillAdjustmentEntity already exists. Please specify another HREmployeePhoneBillAdjustmentEntity."); } } } } return(returnCode); }
private void UpdateHREmployeePhoneBillAdjustment() { try { IList <ListViewDataItem> list = lvHREmployeeAllowanceCustom_Detailed.Items; if (list != null && list.Count > 0) { Int32 tempDataItemIndex = 0; foreach (ListViewDataItem lvdi in list) { DataKey currentDataKey = lvHREmployeeAllowanceCustom_Detailed.DataKeys[tempDataItemIndex++]; Int64 _employeeID = (Int64)currentDataKey["EmployeeID"]; Boolean isSaveFlag = true; String fe1 = SqlExpressionBuilder.PrepareFilterExpression(HREmployeePhoneBillAdjustmentEntity.FLD_NAME_EmployeeID, _employeeID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(HREmployeePhoneBillAdjustmentEntity.FLD_NAME_SalarySessionID, ddlSalarySessionID.SelectedValue.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); IList <HREmployeePhoneBillAdjustmentEntity> lstHREmployeePhoneBillAdjustment = FCCHREmployeePhoneBillAdjustment.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lstHREmployeePhoneBillAdjustment != null && lstHREmployeePhoneBillAdjustment.Count > 0) { isSaveFlag = false; } //String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeMonthlyTimeSheetSummaryEntity.em) HREmployee_DetailedEntity employeeEntity = GetHREmployeeInfo(_employeeID); TextBox txtEmployeeName = (TextBox)lvdi.FindControl("txtEmployeeName"); TextBox txtDesignation = (TextBox)lvdi.FindControl("txtDesignation"); TextBox txtEmployeeJobTypeID = (TextBox)lvdi.FindControl("txtEmployeeJobTypeID"); TextBox txtSalaryLevel = (TextBox)lvdi.FindControl("txtSalaryLevel"); TextBox txtPhoneBillAmount = (TextBox)lvdi.FindControl("txtPhoneBillAmount"); TextBox txtPhoneBillNote = (TextBox)lvdi.FindControl("txtPhoneBillNote"); TextBox txtPhoneAllowance = (TextBox)lvdi.FindControl("txtPhoneAllowance"); String remarks = String.Empty; Decimal a = 0; a = Decimal.Parse(txtPhoneBillAmount.Text) - Decimal.Parse(txtPhoneAllowance.Text); if (a <= 0) { a = 0; } txtPhoneBillNote.Text = "Actual Bill - Phone Ceiling: " + txtPhoneBillAmount.Text + "-" + txtPhoneAllowance.Text + " = " + a + " TK Deducted."; HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity = new HREmployeePhoneBillAdjustmentEntity(); hREmployeePhoneBillAdjustmentEntity.EmployeeID = employeeEntity.EmployeeID; hREmployeePhoneBillAdjustmentEntity.SalarySessionID = Int64.Parse(ddlSalarySessionID.SelectedValue); hREmployeePhoneBillAdjustmentEntity.PhoneBillAmount = Decimal.Parse(txtPhoneBillAmount.Text); hREmployeePhoneBillAdjustmentEntity.PhoneBillNote = txtPhoneBillNote.Text; hREmployeePhoneBillAdjustmentEntity.IsRemoved = false; if (isSaveFlag) { FCCHREmployeePhoneBillAdjustment.GetFacadeCreate().Add(hREmployeePhoneBillAdjustmentEntity, DatabaseOperationType.Add, TransactionRequired.No); MiscUtil.ShowMessage(lblMessage, "Employee phone adjustment Information has been saved successfully.", false); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeePhoneBillAdjustmentEntity.FLD_NAME_PhoneBillAdjustmentID, lstHREmployeePhoneBillAdjustment[0].PhoneBillAdjustmentID.ToString(), SQLMatchType.Equal); FCCHREmployeePhoneBillAdjustment.GetFacadeCreate().Update(hREmployeePhoneBillAdjustmentEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); MiscUtil.ShowMessage(lblMessage, "Employee phone adjustment Information has been updated successfully.", false); } BindList(); //PrepareInitialView(); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, "Failed to Employee Monthly Time Sheet Summary Information.", true); } }
Int64 IHREmployeePhoneBillAdjustmentFacade.Delete(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeePhoneBillAdjustmentDataAccess().Delete(hREmployeePhoneBillAdjustmentEntity, filterExpression, option, reqTran)); }
Int64 IHREmployeePhoneBillAdjustmentFacade.Add(HREmployeePhoneBillAdjustmentEntity hREmployeePhoneBillAdjustmentEntity, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeePhoneBillAdjustmentDataAccess().Add(hREmployeePhoneBillAdjustmentEntity, option, reqTran)); }