public EmployeeInfo GetApproverAtStep(int departmentID, int locationID, StepModuleList StepModule, int stepNumber) { EmployeeInfo approverInfo = null; CommonApproverModel approvalList = CreateApprovalList(departmentID, locationID); if (approvalList != null) { Type typeCommonApproverModel = typeof(CommonApproverModel); BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public; PropertyInfo approverProp = typeCommonApproverModel.GetProperty(string.Format("Approver{0}", stepNumber), bindingFlags); if (approverProp != null) { object approverValue = approverProp.GetValue(approvalList, null); if (approverValue != null) { approverInfo = approverValue as EmployeeInfo; } } } return(approverInfo); }
public CommonApproverModel CreateApprovalList(int departmentId, int locationId) { EmployeeInfoDAL _employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl); CommonApproverModel commonApproverModel = new CommonApproverModel(); // Department Head var departmentHead = _employeeInfoDAL.GetByPositionDepartment(Constants.StringConstant.EmployeePosition.DepartmentHead, departmentId, locationId); if (departmentHead.Count > 0) { commonApproverModel.Approver1 = departmentHead[0]; } // BOD var bodUser = DepartmentListSingleton.GetDepartmentByID(departmentId, SiteUrl).BOD; if (bodUser != null && bodUser.ID > 0) { var bodImployeeInfo = _employeeInfoDAL.GetByADAccount(bodUser.UserName); commonApproverModel.Approver2 = bodImployeeInfo; } // Department Head of HC int departmentIdHC = DepartmentListSingleton.GetDepartmentByCode("HR", SiteUrl).ID; if (departmentIdHC != departmentId) { var departmentHeadOfHC = _employeeInfoDAL.GetByPositionDepartment(Constants.StringConstant.EmployeePosition.DepartmentHead, departmentIdHC, locationId); if (departmentHeadOfHC.Count > 0) { commonApproverModel.Approver3 = departmentHeadOfHC[0]; } } return(commonApproverModel); }