/** * Return list of vacancy which have this status. */ public static TransactionResponse getAllActiveVacancy(string status) { TransactionResponse response = new TransactionResponse(); IDictionary<string, object> statusParams = new Dictionary<string, object>(); statusParams.Add("@status", status); statusParams.Add("@districtId", PageAccessManager.getDistrictID()); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spAllActiveVacancy, statusParams); try { DataTable dataTable = dpOperation.getRecord(); response.Data = dataTable; response.setSuccess(true); } catch (SqlException ex) { //Other SqlException is catched response.setSuccess(false); response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { if (!IsPostBack) { populateVacancy(); } // Get a reference to the currently logged on user MembershipUser currentUser = Membership.GetUser(); // Determine the currently logged on user's UserId value Guid currentUserId = (Guid)currentUser.ProviderUserKey; //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@UserId", currentUserId); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeBranchDetail, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { loggedInEmpID = row["Emp_ID"].ToString(); } } } }
public static DataTable getAllBranchEmpStatus() { //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetAllBranchEmployeeStatus, null); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public static DataTable getAllBranchEmpStatus() { //Pass Stored Procedure Name and parameter list. IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@district", PageAccessManager.getDistrictID()); DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetAllBranchEmployeeStatus, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public static DataTable getAssignedEmployeeFormOtherDistrict() { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetListOfAssignedEmployeefromOtherDistrict, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public static DataTable getSpecBranchEmpStatus(int branchID) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@branch", branchID); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetBranchEmployeeStatus, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public static TransactionResponse getAllNotificationsForCurrentEmployee(MembershipUser currentUser) { //get detail of the logged on user. Employee employee = EmployeeManager.getLoggedOnUser((Guid)currentUser.ProviderUserKey); if (employee == null) { return EmployeeManager.handleLoggedInUserCanNotBeIdentfied(); } TransactionResponse response = new TransactionResponse(); try { IDictionary<string, object> employeeIdMap = new Dictionary<string, object>(); employeeIdMap.Add("@EMP_ID", employee.EmpID); employeeIdMap.Add("@destrictID", PageAccessManager.getDistrictID()); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spGetAllNotificationForTheCurrentEmployee, employeeIdMap); DataTable dataTable = dbOperation.getRecord(); //put the data on Transaction response response.Data = dataTable; response.setSuccess(true); response.setMessageType(TransactionResponse.SeverityLevel.INFO); response.setMessage(DBOperationErrorConstants.M_NOTIFICATION_INFO); //get Notifications inside the TransactionResponse. return response; } catch (SqlException ex) { response.setErrorCode(DBOperationErrorConstants.E_ERROR_WHILE_READING_NOTIFICATION); response.setMessage(DBOperationErrorConstants.M_ERROR_WHILE_READING_NOTIF); response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setSuccess(false); return response; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR); response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR); response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setSuccess(false); return response; } }
public static TransactionResponse getDistrictSettingValue(string paramTag) { TransactionResponse response = new TransactionResponse(); IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@paramter_tag", paramTag); argumentsMap.Add("@districtID", PageAccessManager.getDistrictID()); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spGetDistrictSetting, argumentsMap); try { DataTable dataTable = dbOperation.getRecord(); if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { //put the data on Transaction reponse response.Data = row["parameter_value"].ToString(); response.setSuccess(true); return response; } } response.Data = PARAMETER_NOT_DEFINED + DBOperationErrorConstants.CONTACT_ADMIN; response.setSuccess(false); return response; } catch (SqlException ex) { response.Data = PARAMETER_NOT_DEFINED + DBOperationErrorConstants.CONTACT_ADMIN; response.setSuccess(false); return response; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); response.Data = PARAMETER_NOT_DEFINED + DBOperationErrorConstants.CONTACT_ADMIN; response.setSuccess(false); return response; } }
private TransactionResponse sendInsertPromotionToDb(string spName, IDictionary<string, object> parameters) { //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(spName, parameters); TransactionResponse response = new TransactionResponse(); try { //call store to DB mathod and get reponse. storeToDb.instertNewRecord(); response.setSuccess(true); response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setMessage(DBOperationErrorConstants.M_PROMOTION_REGISTER_OK); } catch (SqlException ex) { //Determine if the cause was duplicate KEY. if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR)) { response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_DUPLICATE_PROMOTION_KEY_ERROR); response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR); } else { //Other SqlException is catched response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_APP_RATING_REGISTER); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION); } } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { // Get a reference to the currently logged on user MembershipUser currentUser = Membership.GetUser(); // Determine the currently logged on user's UserId value Guid currentUserId = (Guid)currentUser.ProviderUserKey; //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@UserId", currentUserId); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeBranchDetail, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { fName = row["First_Name"].ToString(); mName = row["Middle_Name"].ToString(); jTittle = row["Job_Tittle"].ToString(); branchName = row["branchName"].ToString(); branchID = Convert.ToInt16(row["branch"].ToString()); } } else { //something went wrong, show correct error to the user } lblBranch.Text = branchName; } if (!IsPostBack) { DataTable getds = BranchEmployeeStatusManager.getSpecBranchEmpStatus(branchID); BindDataSetToGV(getds); } }
public TransactionResponse addNewPromotionAssignment() { //Add List of Arguments for new promotion Assigment IDictionary<string, object> promotionAssigmentParameters = new Dictionary<string, object>(); promotionAssigmentParameters.Add("@minNo", promotionAssigment.MinuteNo); promotionAssigmentParameters.Add("@hROfficerID", promotionAssigment.HROfficerID); promotionAssigmentParameters.Add("@deadLine", promotionAssigment.DeadLine); promotionAssigmentParameters.Add("@remark", promotionAssigment.Remark); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spAddPromotionAssignmentToHROfficer, promotionAssigmentParameters); TransactionResponse response = new TransactionResponse(); try { //call update to DB mathod and get reponse. dpOperation.updateRecord(); response.setSuccess(true); response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setMessage(DBOperationErrorConstants.M_VACANCY_ASSIGNED_SUCCESS); } catch (SqlException ex) { //Other SqlException is catched response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR + ". "+ DBOperationErrorConstants.M_DUPLICATE_PROMOTION_ASSIGNEMENT); response.setErrorCode(DBOperationErrorConstants.E_PROMOTION_ASSIGNEMETN_FAILED); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
/** * gets list of Current branch */ public static DataTable getCurrentBranch() { //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetBranchsList, null); DataTable dataTable = null; try { return dataTable = storeToDb.getRecord(); } catch (SqlException ex) { //return emptylist return dataTable; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); return dataTable; } }
public DataTable getUnassignedPromotion() { //Pass Stored Procedure Name and parameter list. IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@districtID", PageAccessManager.getDistrictID()); DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetPromotionAssignedToHROfficer, parameters); DataTable dataTable = null; try { return dataTable = storeToDb.getRecord(); } catch (SqlException ex) { //return emptylist return dataTable; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return dataTable; } }
//this methode return a list of promoted or Assigned Employee for specified Post public DataTable getSpecifiedPromotionResult(int postID, string promotionOrAssigned) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Post", postID); argumentsMap.Add("@status", promotionOrAssigned); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetPromotedEmpBasedOnPostAndStatus, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public DataTable getmanagerialPosition(string branch) { //Pass Stored Procedure Name and parameter list. //Add List of Arguments TO GET managerial position IDictionary<string, object> branchID = new Dictionary<string, object>(); branchID.Add("@branch", branch); DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmpAtManagerialPosition, branchID); DataTable dataTable = null; try { return dataTable = storeToDb.getRecord(); } catch (SqlException ex) { //return emptylist return dataTable; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return dataTable; } }
public DataTable getAllPromotedEmployee(string promotionStatus) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Promostatus", promotionStatus); DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetAllPromotedEmp, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
public DataTable UpdateemployeeEducationalQual(string EID, string eduLevel, string qualif) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Emp_ID", EID); argumentsMap.Add("@EducationLevel", eduLevel); argumentsMap.Add("@Qualification", qualif); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spUpdateEmpEducLevel, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
//delete resigned employee from database public TransactionResponse deleteResignedEmployee() { TransactionResponse response = new TransactionResponse(); try { IDictionary<string, object> argumentMap = new Dictionary<string, object>(); //task referance argumentMap.Add("@UserId", employee.UserName); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spDeleteEmployeeInfor, argumentMap); bool isDeleteOk = dbOperation.deleteRecord(); //put the data on Transaction response response.Data = isDeleteOk; response.setSuccess(true); //get delete status inside the TransactionResponse. return response; } catch (SqlException ex) { response.setErrorCode(DBOperationErrorConstants.E_ERROR_WHILE_REMOVING_INACTIVE_EMPLOYEE); response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_REMOVING_INACTIVE_EMPLOYEE); response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setSuccess(false); return response; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR); response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR); response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setSuccess(false); return response; } }
private DBOperationsUtil getDBOperationToUpdatePromotionStatus4Assignment(IDictionary<string, object> parameters, Promotion promotion, string promoStatus) { DBOperationsUtil dpOperation = null; //Pass Stored Procedure Name and parameter list. parameters.Add("@Emp_ID", 0); parameters.Add("@Minute_No", promotion.MinuteNo); parameters.Add("@vacancy_No", 0); parameters.Add("@forAssOrAnnounce", promoStatus); dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdatePromotionStatus, parameters); return dpOperation; }
/** * gets list of employee for a given Branch */ public List<Employee> getListOfEmployeeByFirstNameOrEmpIdAtBranch() { IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@txtEmpID", employee.UserName); argumentsMap.Add("@branch", employee.Branch); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeByFirstNameAutoCompleteSpecBranch, argumentsMap); //call getRecord method and get SqlDataReader DataTable dataTable = null; try { dataTable = storeToDb.getRecord(); //format the Result to return to presentation layer. List<Employee> listOfEmployee = null; if (dataTable != null) { listOfEmployee = new List<Employee>(); foreach (DataRow row in dataTable.Rows) { Employee emply = new Employee(); emply.FName = row["First_Name"].ToString(); emply.MName = row["Middle_Name"].ToString(); emply.LName = row["Last_Name"].ToString(); emply.EmpID = row["Emp_ID"].ToString(); listOfEmployee.Add(emply); } } return listOfEmployee; } catch (SqlException ex) { //return emptylist return new List<Employee>(); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return new List<Employee>(); } }
/** * Get Inactive employee by date interval */ public TransactionResponse getInactiveEmployeeResult(string startedDate, string endDate) { TransactionResponse response = new TransactionResponse(); try { //Add List of Arguments for new employee IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@startDate", startedDate); parameters.Add("@endDate", endDate); DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetInactiveEmployeeDetail, parameters); DataTable getResult = dpOperation.getRecord(); if (getResult != null && getResult.Rows.Count > 0) { response.Data = getResult; response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setMessage(DBOperationErrorConstants.M_REPORT_GENERATED_SUCCESS); response.setSuccess(true); return response; } else { response.setMessageType(TransactionResponse.SeverityLevel.INFO); response.setMessage(DBOperationErrorConstants.M_GENERATE_INACTIVE_EMPLOYEE_REPORT_EMPTY); response.setSuccess(false); return response; } } catch (SqlException ex) { //Other SqlException is catched response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_GENERATE_INACTIVE_EMPLOYEE); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION); response.setSuccess(false); } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }
/** * Gives the current active HR amanger. */ public static string getCurrentHRManager() { //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetCurrentHrManager, null); //call getRecord method and get SqlDataReader DataTable dataTable = null; try { dataTable = storeToDb.getRecord(); //The if there was a result if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { return row["HrManagerEmpID"].ToString(); } } return PageConstants.ERROR; } catch (SqlException ex) { return PageConstants.ERROR; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); return PageConstants.ERROR; } }
public static Employee getLoggedOnUser(Guid userId) { //Add List of Arguments for new employee IDictionary<string, object> userIdMap = new Dictionary<string, object>(); userIdMap.Add("@UserId", userId); //Pass Stored Procedure Name and parameter list. DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spGetLoggedOnUser, userIdMap); //get Record. DataTable dataTable = null; Employee employee = null; try { dataTable = dbOperation.getRecord(); employee = new Employee(); if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { employee = new Employee(); employee.FName = row["First_Name"].ToString(); employee.EmpID = row["Emp_ID"].ToString(); } } return employee; } catch (SqlException ex) { return employee; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. LoggerManager.LogError(ex.ToString(), logger); return employee; } }
public Employee detailOfEmployeToBeEvaluated(string vacancyNo, string vacancyDate) { //create parameter to pass IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Emp_ID", employee.EmpID); argumentsMap.Add("@vacancyNo", vacancyNo); argumentsMap.Add("@vacancyDate", vacancyDate); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeToBeEvaluated, argumentsMap); //call getRecord method and get SqlDataReader DataTable dataTable = null; Employee employeeRply = null; try { dataTable = storeToDb.getRecord(); //The if there was a result if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { employeeRply = new Employee(); employeeRply.EmpID = employee.EmpID; employeeRply.FName = row["First_Name"].ToString(); employeeRply.MName = row["Middle_Name"].ToString(); employeeRply.LName = row["Last_Name"].ToString(); employeeRply.EducationalQualification = row["Educational Level"].ToString(); employeeRply.JobTitle = row["JobTitle"].ToString(); employeeRply.Branch = row["branchName"].ToString(); employeeRply.EmployeeType = row["applicant_type"].ToString(); if (row["proccessed_date"] != null && !row["proccessed_date"].ToString().Equals("")) { employeeRply.ProcessedDate = row["proccessed_date"].ToString(); } if (row["checked_date"] != null && !row["checked_date"].ToString().Equals("")) { employeeRply.CheckedDate = row["checked_date"].ToString(); } //We are seaarching Employee by ID, there an only be only employee return employeeRply; } } return employeeRply; } catch (SqlException ex) { return employeeRply; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return employeeRply; } }
//Update Promoted Employee Status public DataTable UpdatePromotedemployee() { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@prev_branch", promotion.PrevBranch); argumentsMap.Add("@branch", promotion.Branch); argumentsMap.Add("@Post", promotion.Post); argumentsMap.Add("@status", promotion.Status); argumentsMap.Add("@Minute_No", promotion.MinuteNo); argumentsMap.Add("@promotionDate", promotion.PromotionDate); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spUpdatePromotedEmp, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
/** * Checks if Employee is duplicate by selecting and checking returned result. */ public Boolean isEmployeeAlreadyExist() { //Add List of Arguments for new employee IDictionary<string, object> employeeIDArgumentaMap = new Dictionary<string, object>(); employeeIDArgumentaMap.Add("@Emp_ID", employee.EmpID); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeDetail, employeeIDArgumentaMap); //get Record. DataTable dataTable = null; try { dataTable = storeToDb.getRecord(); //if there is anything returned it means employee is duplicate. return dataTable != null && dataTable.Rows.Count > 0; } catch (SqlException ex) { return false; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return false; } }
private DBOperationsUtil getDBOperationToUpdatePromotionStatus(IDictionary<string, object> parameters, Promotion promotion, string vacNo) { DBOperationsUtil dpOperation = null; //Pass Stored Procedure Name and parameter list. parameters.Add("@Emp_ID", promotion.EmpID); parameters.Add("@Minute_No", promotion.MinuteNo); parameters.Add("@vacancy_No", vacNo); parameters.Add("@forAssOrAnnounce", PromotionConstants.VACANCY_ANNOUNCED_FOR_PROMOTION); dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdatePromotionStatus, parameters); return dpOperation; }
public DataTable UpdateHROfficerPMSResult(string EID, string vacNo, string evaFor, string grade, string remark) { //prepare parameters IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@hr_office_EID", EID); argumentsMap.Add("@vacancy_No", vacNo); argumentsMap.Add("@evaluated_for", evaFor); argumentsMap.Add("@grade", grade); argumentsMap.Add("@remark", remark); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spUpdateHROfficerClerkPMSResult, argumentsMap); //call getRecord method and get DataTable DataTable dataTable = storeToDb.getRecord(); return dataTable; }
/** * get employee Job title and branch detail. */ public Employee getEmployeeJobTitleAndBranchDetail() { //create parameter to pass IDictionary<string, object> argumentsMap = new Dictionary<string, object>(); argumentsMap.Add("@Emp_ID", employee.EmpID); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spGetEmployeeJobTitleBranchAndDistrict, argumentsMap); //call getRecord method and get SqlDataReader DataTable dataTable = null; Employee employeeRply = null; try { dataTable = storeToDb.getRecord(); //The if there was a result if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { employeeRply = new Employee(); employeeRply.EmpID = employee.EmpID; employeeRply.UserName = row["UserId"].ToString(); employeeRply.FName = row["First_Name"].ToString(); employeeRply.MName = row["Middle_Name"].ToString(); employeeRply.LName = row["Last_Name"].ToString(); employeeRply.Sex = row["Sex"].ToString(); employeeRply.PrevJob = row["PrevJob"].ToString(); employeeRply.JobTitle = row["JobTitle"].ToString(); employeeRply.Branch = row["branchName"].ToString(); employeeRply.BranchID = row["branch"].ToString(); employeeRply.JobGrade = row["Grade"].ToString(); employeeRply.Salary = row["Salary"].ToString(); employeeRply.Hdate = row["HDate"].ToString(); employeeRply.District = row["distric_name"].ToString(); //We are seaarching Employee by ID, there an only be only employee return employeeRply; } } return employeeRply; } catch (SqlException ex) { return employeeRply; } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); return employeeRply; } }
/** * calls Store to DB utility for the current employee. */ public TransactionResponse AddHROfficerOrClerk(string SPName, string EmpID) { //Add List of Arguments for new employee IDictionary<string, object> paramater = new Dictionary<string, object>(); paramater.Add("@Emp_ID", EmpID); //Pass Stored Procedure Name and parameter list. DBOperationsUtil storeToDb = new DBOperationsUtil(SPName, paramater); TransactionResponse response = new TransactionResponse(); //call store to DB mathod and get reponse. try { storeToDb.instertNewRecord(); response.setMessageType(TransactionResponse.SeverityLevel.SUCESS); response.setSuccess(true); response.setMessage(DBOperationErrorConstants.M_HR_OFFICER_REGISTER_OK); } catch (SqlException ex) { //Determine if the cause was duplicate KEY. if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR)) { response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR); response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR); } else { //Other SqlException is catched response.setMessageType(TransactionResponse.SeverityLevel.ERROR); response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER); response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION); } } //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error catch (Exception ex) { //Write this exception to file for investigation of the issue later. logException(ex); LoggerManager.upDateWithGenericErrorMessage(response); } return response; }