//private Department GetDepartment(int deptID, int deep) //{ // Department department = _DepartmentBll.GetParentDept(deptID, null); // if (department == null) // { // return null; // } // else // { // if (deep == OperatorType.ParentDepartmentLeader.Id) // { // return department; // } // else // { // return GetDepartment(department.Id, --deep); // } // } //} /// <summary> /// /// </summary> private Account GetAccountByOperatorType(ParameterBase operatortype, int accountid) { if (operatortype.Id == OperatorType.YourSelf.Id) { return(_AccountBll.GetAccountById(accountid)); } else if (operatortype.Id == OperatorType.DepartmentLeader.Id) { return(_AccountBll.GetLeaderByAccountId(accountid)); } else if (operatortype.Id == OperatorType.ParentDepartmentLeader.Id) { Account account2 = _AccountBll.GetAccountById(accountid); return(_DepartmentBll.GetParentDept(account2.Dept.Id, null).Leader); } else if (operatortype.Id == OperatorType.GrandDepartmentLeader.Id) { Account account3 = _AccountBll.GetAccountById(accountid); Department department3 = _DepartmentBll.GetParentDept(account3.Dept.Id, null); return(_DepartmentBll.GetParentDept(department3.Id, null).Leader); } else if (operatortype.Id == OperatorType.GrandGrandDepartmentLeader.Id) { Account account4 = _AccountBll.GetAccountById(accountid); Department department4 = _DepartmentBll.GetParentDept(account4.Dept.Id, null); department4 = _DepartmentBll.GetParentDept(department4.Id, null); return(_DepartmentBll.GetParentDept(department4.Id, null).Leader); } else if (operatortype.Id == OperatorType.GrandGrandGrandDepartmentLeader.Id) { Account account5 = _AccountBll.GetAccountById(accountid); Department department5 = _DepartmentBll.GetParentDept(account5.Dept.Id, null); department5 = _DepartmentBll.GetParentDept(department5.Id, null); department5 = _DepartmentBll.GetParentDept(department5.Id, null); return(_DepartmentBll.GetParentDept(department5.Id, null).Leader); } else { return(null); } }
/// <summary> /// /// </summary> /// <param name="positionApplication"></param> /// <param name="diyStep"></param> /// <returns></returns> internal int ChangeOperatorToEmployee(PositionApplication positionApplication, DiyStep diyStep) { int accountID = 0; try { switch (diyStep.OperatorType.Id) { //"本人" case 0: accountID = positionApplication.Account.Id; break; //"部门主管" case 1: accountID = _IAccountBll.GetLeaderByAccountId(positionApplication.Account.Id).Id; break; //"上级部门主管"; case 2: Account account2 = _IAccountBll.GetAccountById(positionApplication.Account.Id); accountID = _IDepartmentBll.GetParentDept(account2.Dept.Id, null).Leader.Id; break; //"上上级部门主管" case 3: Account account3 = _IAccountBll.GetAccountById(positionApplication.Account.Id); Department department3 = _IDepartmentBll.GetParentDept(account3.Dept.Id, null); accountID = _IDepartmentBll.GetParentDept(department3.Id, null).Leader.Id; break; //"上上上级部门主管" case 4: Account account4 = _IAccountBll.GetAccountById(positionApplication.Account.Id); Department department4 = _IDepartmentBll.GetParentDept(account4.Dept.Id, null); department4 = _IDepartmentBll.GetParentDept(department4.Id, null); accountID = _IDepartmentBll.GetParentDept(department4.Id, null).Leader.Id; break; //"上上上上级部门主管" case 5: Account account5 = _IAccountBll.GetAccountById(positionApplication.Account.Id); Department department5 = _IDepartmentBll.GetParentDept(account5.Dept.Id, null); department5 = _IDepartmentBll.GetParentDept(department5.Id, null); department5 = _IDepartmentBll.GetParentDept(department5.Id, null); accountID = _IDepartmentBll.GetParentDept(department5.Id, null).Leader.Id; break; //"其他" case 6: accountID = diyStep.OperatorID; break; default: break; } } catch { //-1 全部;0 新增;1 提交;2 审核不通过;3 审核通过;4 取消请假; //5 拒绝取消假期;6 批准取消假期;7 审核中;8 审核取消中 RequestStatus status; switch (positionApplication.Status.Id) { case 4: case 8: status = RequestStatus.ApproveCancelFail; break; default: //1 7 status = RequestStatus.ApproveFail; break; } ApproveFailPositionApplication approveFailPositionApplication = new ApproveFailPositionApplication(positionApplication.PKID, Account.AdminPkid, status, HrmisUtility._No_Account); approveFailPositionApplication.Excute(); } return(accountID); }
/// <summary> /// 获取请假,报销,考评流程字符串 /// </summary> /// <param name="account"></param> /// <param name="diyStep"></param> /// <returns></returns> private string GetStepOperator(Account account, DiyStep diyStep) { StringBuilder operate = new StringBuilder(); try { switch (diyStep.OperatorType.Id) { //"本人" case 0: operate.Append(account.Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"部门主管" case 1: int leaderId = _IAccountBll.GetLeaderByAccountId(account.Id).Id; operate.Append(_IAccountBll.GetAccountById(leaderId).Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"上级部门主管"; case 2: int id = _IDepartmentBll.GetParentDept(account.Dept.Id, null).Leader.Id; operate.Append(_IAccountBll.GetAccountById(id).Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"上上级部门主管" case 3: Department department3 = _IDepartmentBll.GetParentDept(account.Dept.Id, null); id = _IDepartmentBll.GetParentDept(department3.Id, null).Leader.Id; operate.Append(_IAccountBll.GetAccountById(id).Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"上上上级部门主管" case 4: Department department4 = _IDepartmentBll.GetParentDept(account.Dept.Id, null); department4 = _IDepartmentBll.GetParentDept(department4.Id, null); id = _IDepartmentBll.GetParentDept(department4.Id, null).Leader.Id; operate.Append(_IAccountBll.GetAccountById(id).Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"上上上上级部门主管" case 5: Department department5 = _IDepartmentBll.GetParentDept(account.Dept.Id, null); department5 = _IDepartmentBll.GetParentDept(department5.Id, null); id = _IDepartmentBll.GetParentDept(department5.Id, null).Leader.Id; operate.Append(_IAccountBll.GetAccountById(id).Name); operate.Append(" "); operate.Append(diyStep.Status); break; //"其他" case 6: operate.Append(_IAccountBll.GetAccountById(diyStep.OperatorID).Name); operate.Append(" "); operate.Append(diyStep.Status); break; default: break; } } catch { operate.Append("无人"); operate.Append(diyStep.Status); } return(operate.ToString()); }
/// <summary> /// /// </summary> /// <param name="traineeApplication"></param> /// <returns></returns> /// <param name="diyStep"></param> public int ChangeOperatorToEmployee(TraineeApplication traineeApplication, DiyStep diyStep) { int accountID = 0; try { switch (diyStep.OperatorType.Id) { //"本人" case 0: accountID = traineeApplication.Applicant.Id; break; //"部门主管" case 1: accountID = _IAccountBll.GetLeaderByAccountId(traineeApplication.Applicant.Id).Id; break; //"上级部门主管"; case 2: Account account2 = _IAccountBll.GetAccountById(traineeApplication.Applicant.Id); accountID = _IDepartmentBll.GetParentDept(account2.Dept.Id, null).Leader.Id; break; //"上上级部门主管" case 3: Account account3 = _IAccountBll.GetAccountById(traineeApplication.Applicant.Id); Department department3 = _IDepartmentBll.GetParentDept(account3.Dept.Id, null); accountID = _IDepartmentBll.GetParentDept(department3.Id, null).Leader.Id; break; //"上上上级部门主管" case 4: Account account4 = _IAccountBll.GetAccountById(traineeApplication.Applicant.Id); Department department4 = _IDepartmentBll.GetParentDept(account4.Dept.Id, null); department4 = _IDepartmentBll.GetParentDept(department4.Id, null); accountID = _IDepartmentBll.GetParentDept(department4.Id, null).Leader.Id; break; //"上上上上级部门主管" case 5: Account account5 = _IAccountBll.GetAccountById(traineeApplication.Applicant.Id); Department department5 = _IDepartmentBll.GetParentDept(account5.Dept.Id, null); department5 = _IDepartmentBll.GetParentDept(department5.Id, null); department5 = _IDepartmentBll.GetParentDept(department5.Id, null); accountID = _IDepartmentBll.GetParentDept(department5.Id, null).Leader.Id; break; //"其他" case 6: accountID = traineeApplication.CurrentStep.OperatorID; break; default: break; } } catch { //todo ////-1 全部;0 新增;1 提交;2 审核不通过;3 审核通过;4 取消请假; ////5 拒绝取消假期;6 批准取消假期;7 审核中;8 审核取消中 //RequestStatus status; //switch (traineeApplication.Status.Id) //{ // case 4: // case 8: // status = RequestStatus.ApproveCancelFail; // break; // default: //1 7 // status = RequestStatus.ApproveFail; // break; //} //ApproveFailTraineeApplicationItem approveFailTraineeApplicationItem = // new ApproveFailTraineeApplicationItem(traineeApplication.PKID, item.TraineeApplicationItemID, // Account.AdminPkid, // status, HrmisUtility._No_Account); //approveFailTraineeApplicationItem.Excute(); } return(accountID); }