Int64 IHREmployeeEvaluationDataAccess.Add(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Add(hREmployeeEvaluationEntity, option); break; } case TransactionRequired.Yes: { retValues = AddTran(hREmployeeEvaluationEntity, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
private void PrepareEditView() { HREmployeeEvaluationEntity hREmployeeEvaluationEntity = CurrentHREmployeeEvaluationEntity; if (!hREmployeeEvaluationEntity.IsNew) { } }
private Int64 Update(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeEvaluation_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); Database.AddInParameter(cmd, "@EmployeeEvaluationID", DbType.Int64, hREmployeeEvaluationEntity.EmployeeEvaluationID); Database.AddInParameter(cmd, "@SessionID", DbType.Int64, hREmployeeEvaluationEntity.SessionID); Database.AddInParameter(cmd, "@EvaluationName", DbType.String, hREmployeeEvaluationEntity.EvaluationName); Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeEvaluationEntity.EmployeeID); Database.AddInParameter(cmd, "@EmployeeFullName", DbType.String, hREmployeeEvaluationEntity.EmployeeFullName); Database.AddInParameter(cmd, "@EmployeeCode", DbType.String, hREmployeeEvaluationEntity.EmployeeCode); Database.AddInParameter(cmd, "@EmployeeDepartmentName", DbType.String, hREmployeeEvaluationEntity.EmployeeDepartmentName); Database.AddInParameter(cmd, "@EmployeeLevel", DbType.String, hREmployeeEvaluationEntity.EmployeeLevel); Database.AddInParameter(cmd, "@SupervisorEmployeeID", DbType.Int64, hREmployeeEvaluationEntity.SupervisorEmployeeID); Database.AddInParameter(cmd, "@SupervisorFullName", DbType.String, hREmployeeEvaluationEntity.SupervisorFullName); Database.AddInParameter(cmd, "@SupervisorEmployeeCode", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeCode); Database.AddInParameter(cmd, "@SupervisorEmployeeDepartmentName", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeDepartmentName); Database.AddInParameter(cmd, "@SupervisorEmployeeLevel", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeLevel); Database.AddInParameter(cmd, "@EmployeeSubmitDate", DbType.DateTime, hREmployeeEvaluationEntity.EmployeeSubmitDate); Database.AddInParameter(cmd, "@SupervisorSubmitDate", DbType.DateTime, hREmployeeEvaluationEntity.SupervisorSubmitDate); Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeEvaluationEntity.CreateDate); Database.AddInParameter(cmd, "@EvaluatedByID", DbType.Int64, hREmployeeEvaluationEntity.EvaluatedByID); Database.AddInParameter(cmd, "@Remarks", DbType.String, hREmployeeEvaluationEntity.Remarks); Database.AddInParameter(cmd, "@Extra", DbType.String, hREmployeeEvaluationEntity.Extra); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("HREmployeeEvaluationEntity already exists. Please specify another HREmployeeEvaluationEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeeEvaluationEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeeEvaluationEntity already exists. Please specify another HREmployeeEvaluationEntity."); } } } } return(returnCode); }
private void SaveHREmployeeEvaluationEntity() { if (IsValid) { try { HREmployeeEvaluationEntity hREmployeeEvaluationEntity = BuildHREmployeeEvaluationEntity(); Int64 result = -1; if (hREmployeeEvaluationEntity.IsNew) { result = FCCHREmployeeEvaluation.GetFacadeCreate().Add(hREmployeeEvaluationEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEvaluationEntity.FLD_NAME_EmployeeEvaluationID, hREmployeeEvaluationEntity.EmployeeEvaluationID.ToString(), SQLMatchType.Equal); result = FCCHREmployeeEvaluation.GetFacadeCreate().Update(hREmployeeEvaluationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _EmployeeEvaluationID = 0; _HREmployeeEvaluationEntity = new HREmployeeEvaluationEntity(); PrepareInitialView(); BindHREmployeeEvaluationList(); if (hREmployeeEvaluationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Employee Evaluation Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Employee Evaluation Information has been updated successfully.", false); } } else { if (hREmployeeEvaluationEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Evaluation Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Evaluation Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvHREmployeeEvaluation_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 EmployeeEvaluationID; Int64.TryParse(e.CommandArgument.ToString(), out EmployeeEvaluationID); if (EmployeeEvaluationID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _EmployeeEvaluationID = EmployeeEvaluationID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEvaluationEntity.FLD_NAME_EmployeeEvaluationID, EmployeeEvaluationID.ToString(), SQLMatchType.Equal); HREmployeeEvaluationEntity hREmployeeEvaluationEntity = new HREmployeeEvaluationEntity(); result = FCCHREmployeeEvaluation.GetFacadeCreate().Delete(hREmployeeEvaluationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _EmployeeEvaluationID = 0; _HREmployeeEvaluationEntity = new HREmployeeEvaluationEntity(); PrepareInitialView(); BindHREmployeeEvaluationList(); MiscUtil.ShowMessage(lblMessage, "Employee Evaluation has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Evaluation.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private Int64 DeleteTran(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeEvaluation_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); }
protected void btnSubmit_Click(object sender, EventArgs e) { //String fe1 = SqlExpressionBuilder.PrepareFilterExpression("HREmployeeEvaluation.EmployeeID", MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember).ToString(), SQLMatchType.Equal); //String fe2 = SqlExpressionBuilder.PrepareFilterExpression("HRSession.SessionID", "1", SQLMatchType.Equal); //String fe3 = "HREmployeeEvaluationResult.EmployeeResult is not null"; //String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); //fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe3); //IList<HREmployeeEvaluationSession_CustomEntity> lst = FCCHREmployeeEvaluationSession_Custom.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe); //if(lst!=null && lst.cou // UpdateEvaluationInfo(); if (_EmployeeEvaluationID > 0) { HREmployeeEvaluationEntity hREmployeeEvaluationEntity = FCCHREmployeeEvaluation.GetFacadeCreate().GetByID(_EmployeeEvaluationID); if (Action == "Supervisor") { hREmployeeEvaluationEntity.SupervisorSubmitDate = System.DateTime.Now; } if (Action == "Employee") { hREmployeeEvaluationEntity.EmployeeSubmitDate = System.DateTime.Now; } Int64 result = -1; String fe_update = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEvaluationEntity.FLD_NAME_EmployeeEvaluationID, _EmployeeEvaluationID.ToString(), SQLMatchType.Equal); result = FCCHREmployeeEvaluation.GetFacadeCreate().Update(hREmployeeEvaluationEntity, fe_update, DatabaseOperationType.Update, TransactionRequired.No); if (result > 0) { MiscUtil.ShowMessage(lblMessage, "Submitted Successfully.", false); SubmitButtonEnable(); } else { MiscUtil.ShowMessage(lblMessage, "Some Error Occoured.", false); } } }
private void PrepareEditView() { HREmployeeEvaluationEntity hREmployeeEvaluationEntity = CurrentHREmployeeEvaluationEntity; if (!hREmployeeEvaluationEntity.IsNew) { if (ddlSessionID.Items.Count > 0 && hREmployeeEvaluationEntity.SessionID != null) { ddlSessionID.SelectedValue = hREmployeeEvaluationEntity.SessionID.ToString(); } txtEvaluationName.Text = hREmployeeEvaluationEntity.EvaluationName.ToString(); if (ddlEmployeeID.Items.Count > 0 && hREmployeeEvaluationEntity.EmployeeID != null) { ddlEmployeeID.SelectedValue = hREmployeeEvaluationEntity.EmployeeID.ToString(); } txtEmployeeFullName.Text = hREmployeeEvaluationEntity.EmployeeFullName.ToString(); txtEmployeeCode.Text = hREmployeeEvaluationEntity.EmployeeCode.ToString(); txtEmployeeDepartmentName.Text = hREmployeeEvaluationEntity.EmployeeDepartmentName.ToString(); txtEmployeeLevel.Text = hREmployeeEvaluationEntity.EmployeeLevel.ToString(); if (ddlSupervisorEmployeeID.Items.Count > 0 && hREmployeeEvaluationEntity.SupervisorEmployeeID != null) { ddlSupervisorEmployeeID.SelectedValue = hREmployeeEvaluationEntity.SupervisorEmployeeID.ToString(); } txtSupervisorFullName.Text = hREmployeeEvaluationEntity.SupervisorFullName.ToString(); txtSupervisorEmployeeCode.Text = hREmployeeEvaluationEntity.SupervisorEmployeeCode.ToString(); txtSupervisorEmployeeDepartmentName.Text = hREmployeeEvaluationEntity.SupervisorEmployeeDepartmentName.ToString(); txtSupervisorEmployeeLevel.Text = hREmployeeEvaluationEntity.SupervisorEmployeeLevel.ToString(); txtEmployeeSubmitDate.Text = hREmployeeEvaluationEntity.EmployeeSubmitDate.ToStringDefault(); txtSupervisorSubmitDate.Text = hREmployeeEvaluationEntity.SupervisorSubmitDate.ToStringDefault(); txtCreateDate.Text = hREmployeeEvaluationEntity.CreateDate.ToStringDefault(); if (ddlEvaluatedByID.Items.Count > 0 && hREmployeeEvaluationEntity.EvaluatedByID != null) { ddlEvaluatedByID.SelectedValue = hREmployeeEvaluationEntity.EvaluatedByID.ToString(); } txtRemarks.Text = hREmployeeEvaluationEntity.Remarks.ToString(); txtExtra.Text = hREmployeeEvaluationEntity.Extra.ToString(); btnSubmit.Text = "Update"; btnAddNew.Visible = true; } }
private Int64 Delete(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeEvaluation_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("HREmployeeEvaluationEntity already exists. Please specify another HREmployeeEvaluationEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("HREmployeeEvaluationEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("HREmployeeEvaluationEntity already exists. Please specify another HREmployeeEvaluationEntity."); } } } } return(returnCode); }
private Int64 UpdateTran(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.HREmployeeEvaluation_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, "@EmployeeEvaluationID", DbType.Int64, hREmployeeEvaluationEntity.EmployeeEvaluationID); db.AddInParameter(cmd, "@SessionID", DbType.Int64, hREmployeeEvaluationEntity.SessionID); db.AddInParameter(cmd, "@EvaluationName", DbType.String, hREmployeeEvaluationEntity.EvaluationName); db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, hREmployeeEvaluationEntity.EmployeeID); db.AddInParameter(cmd, "@EmployeeFullName", DbType.String, hREmployeeEvaluationEntity.EmployeeFullName); db.AddInParameter(cmd, "@EmployeeCode", DbType.String, hREmployeeEvaluationEntity.EmployeeCode); db.AddInParameter(cmd, "@EmployeeDepartmentName", DbType.String, hREmployeeEvaluationEntity.EmployeeDepartmentName); db.AddInParameter(cmd, "@EmployeeLevel", DbType.String, hREmployeeEvaluationEntity.EmployeeLevel); db.AddInParameter(cmd, "@SupervisorEmployeeID", DbType.Int64, hREmployeeEvaluationEntity.SupervisorEmployeeID); db.AddInParameter(cmd, "@SupervisorFullName", DbType.String, hREmployeeEvaluationEntity.SupervisorFullName); db.AddInParameter(cmd, "@SupervisorEmployeeCode", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeCode); db.AddInParameter(cmd, "@SupervisorEmployeeDepartmentName", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeDepartmentName); db.AddInParameter(cmd, "@SupervisorEmployeeLevel", DbType.String, hREmployeeEvaluationEntity.SupervisorEmployeeLevel); db.AddInParameter(cmd, "@EmployeeSubmitDate", DbType.DateTime, hREmployeeEvaluationEntity.EmployeeSubmitDate); db.AddInParameter(cmd, "@SupervisorSubmitDate", DbType.DateTime, hREmployeeEvaluationEntity.SupervisorSubmitDate); db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hREmployeeEvaluationEntity.CreateDate); db.AddInParameter(cmd, "@EvaluatedByID", DbType.Int64, hREmployeeEvaluationEntity.EvaluatedByID); db.AddInParameter(cmd, "@Remarks", DbType.String, hREmployeeEvaluationEntity.Remarks); db.AddInParameter(cmd, "@Extra", DbType.String, hREmployeeEvaluationEntity.Extra); 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); }
Int64 IHREmployeeEvaluationFacade.Delete(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeEvaluationDataAccess().Delete(hREmployeeEvaluationEntity, filterExpression, option, reqTran)); }
Int64 IHREmployeeEvaluationFacade.Add(HREmployeeEvaluationEntity hREmployeeEvaluationEntity, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateHREmployeeEvaluationDataAccess().Add(hREmployeeEvaluationEntity, option, reqTran)); }
protected void btnAddNew_Click(object sender, EventArgs e) { _EmployeeEvaluationID = 0; _HREmployeeEvaluationEntity = new HREmployeeEvaluationEntity(); PrepareInitialView(); }
private HREmployeeEvaluationEntity BuildHREmployeeEvaluationEntity() { HREmployeeEvaluationEntity hREmployeeEvaluationEntity = CurrentHREmployeeEvaluationEntity; if (ddlSessionID.Items.Count > 0) { if (ddlSessionID.SelectedValue == "0") { } else { hREmployeeEvaluationEntity.SessionID = Int64.Parse(ddlSessionID.SelectedValue); } } hREmployeeEvaluationEntity.EvaluationName = txtEvaluationName.Text.Trim(); if (ddlEmployeeID.Items.Count > 0) { if (ddlEmployeeID.SelectedValue == "0") { hREmployeeEvaluationEntity.EmployeeID = null; } else { hREmployeeEvaluationEntity.EmployeeID = Int64.Parse(ddlEmployeeID.SelectedValue); } } hREmployeeEvaluationEntity.EmployeeFullName = txtEmployeeFullName.Text.Trim(); hREmployeeEvaluationEntity.EmployeeCode = txtEmployeeCode.Text.Trim(); hREmployeeEvaluationEntity.EmployeeDepartmentName = txtEmployeeDepartmentName.Text.Trim(); hREmployeeEvaluationEntity.EmployeeLevel = txtEmployeeLevel.Text.Trim(); if (ddlSupervisorEmployeeID.Items.Count > 0) { if (ddlSupervisorEmployeeID.SelectedValue == "0") { hREmployeeEvaluationEntity.SupervisorEmployeeID = null; } else { hREmployeeEvaluationEntity.SupervisorEmployeeID = Int64.Parse(ddlSupervisorEmployeeID.SelectedValue); } } hREmployeeEvaluationEntity.SupervisorFullName = txtSupervisorFullName.Text.Trim(); hREmployeeEvaluationEntity.SupervisorEmployeeCode = txtSupervisorEmployeeCode.Text.Trim(); hREmployeeEvaluationEntity.SupervisorEmployeeDepartmentName = txtSupervisorEmployeeDepartmentName.Text.Trim(); hREmployeeEvaluationEntity.SupervisorEmployeeLevel = txtSupervisorEmployeeLevel.Text.Trim(); if (txtEmployeeSubmitDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeEvaluationEntity.EmployeeSubmitDate = MiscUtil.ParseToDateTime(txtEmployeeSubmitDate.Text); } else { hREmployeeEvaluationEntity.EmployeeSubmitDate = null; } if (txtSupervisorSubmitDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeEvaluationEntity.SupervisorSubmitDate = MiscUtil.ParseToDateTime(txtSupervisorSubmitDate.Text); } else { hREmployeeEvaluationEntity.SupervisorSubmitDate = null; } if (txtCreateDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeEvaluationEntity.CreateDate = MiscUtil.ParseToDateTime(txtCreateDate.Text); } else { hREmployeeEvaluationEntity.CreateDate = null; } if (ddlEvaluatedByID.Items.Count > 0) { if (ddlEvaluatedByID.SelectedValue == "0") { } else { hREmployeeEvaluationEntity.EvaluatedByID = Int64.Parse(ddlEvaluatedByID.SelectedValue); } } hREmployeeEvaluationEntity.Remarks = txtRemarks.Text.Trim(); hREmployeeEvaluationEntity.Extra = txtExtra.Text.Trim(); return(hREmployeeEvaluationEntity); }