Example #1
0
        public IDepartment GetDepartment(SysProcessParticipant part, SysProcessInstance pi, SysActivityInstance ai)
        {
            if (part == null)
            {
                throw new ArgumentNullException("part");
            }
            SysProcessParticipant participant = part.Param_Participant;

            if (participant == null)
            {
                throw new ApplicationException("部门经理参与人未指定基于参于人");
            }
            if (participant.FunctionType == 3)
            {
                SpecDepartmentFunc func = new SpecDepartmentFunc(base._context);
                return(func.GetDepartment(participant, pi, ai));
            }
            if (participant.FunctionType == 2)
            {
                StartDepartmentFunc func2 = new StartDepartmentFunc(base._context);
                return(func2.GetDepartment(pi));
            }
            if (participant.FunctionType == 5)
            {
                ParentDepartmentFunc func3 = new ParentDepartmentFunc(base._context);
                return(func3.GetDepartment(participant, pi, ai));
            }
            if (participant.FunctionType != 10)
            {
                throw new ApplicationException("部门经理参与人获得部门失败,可能是参数类型错误");
            }
            SpecialLevelParentDeptFunc func4 = new SpecialLevelParentDeptFunc(base._context);

            return(func4.GetDepartment(participant, pi, ai));
        }
Example #2
0
        public IDepartment GetDepartment(SysProcessParticipant part, SysProcessInstance pi, SysActivityInstance ai)
        {
            IDepartment department = null;

            if (part.Param_Participant == null)
            {
                throw new ApplicationException("父部门参与人未指定基于参于人");
            }
            SysProcessParticipant participant = part.Param_Participant;

            if (participant.FunctionType == 3)
            {
                department = new SpecDepartmentFunc(base._context).GetDepartment(participant, pi, ai);
            }
            else if (participant.FunctionType == 2)
            {
                department = new StartDepartmentFunc(base._context).GetDepartment(pi);
            }
            else if (participant.FunctionType == 5)
            {
                department = new ParentDepartmentFunc(base._context).GetDepartment(participant, pi, ai);
            }
            else
            {
                if (participant.FunctionType != 10)
                {
                    throw new ApplicationException("在SpecialLevelParentDeptFunc的GetDepartment中FunctionType有误!");
                }
                department = this.GetDepartment(participant, pi, ai);
            }
            string str = part.Param_Constant;

            if (!base._orgProxy.IsSupportDepartmentLevel())
            {
                throw new ApplicationException("OrgProxy未实现部门层级,请重载IsSupportDepartmentLevel方法");
            }
            IDepartment parentDepartment = department;

            if (parentDepartment == null)
            {
                throw new ApplicationException("在SpecialLevelParentDeptFunc的GetUsers中获取启动部门失败!");
            }
            for (string str2 = base._orgProxy.GetDepartmentLevelCode(parentDepartment.Department_ID).ToString(); (str != str2) && (parentDepartment != null); str2 = base._orgProxy.GetDepartmentLevelCode(parentDepartment.Department_ID).ToString())
            {
                parentDepartment = base._orgProxy.GetParentDepartment(parentDepartment.Department_ID);
            }
            if (parentDepartment == null)
            {
                throw new ApplicationException("在SpecialLevelParentDeptFunc中未能找到指定层级的上级部门!");
            }
            return(parentDepartment);
        }
        public override IList <IUser> GetUsers(SysProcessParticipant part, SysProcessInstance pi, SysActivityInstance ai)
        {
            if (part == null)
            {
                throw new ArgumentNullException("part");
            }
            if (part.Param_Participant == null)
            {
                throw new ApplicationException("部门角色参与人未指定基于参与人");
            }
            if (!part.Param_RoleId.HasValue)
            {
                throw new ApplicationException("未指定参与人的角色");
            }
            SysProcessParticipant participant = part.Param_Participant;
            IDepartment           department  = null;

            if (participant.FunctionType == 3)
            {
                department = new SpecDepartmentFunc(base._context).GetDepartment(participant, pi, ai);
            }
            else if (participant.FunctionType == 2)
            {
                department = new StartDepartmentFunc(base._context).GetDepartment(pi);
            }
            else if (participant.FunctionType == 5)
            {
                department = new ParentDepartmentFunc(base._context).GetDepartment(participant, pi, ai);
            }
            else
            {
                if (participant.FunctionType != 10)
                {
                    throw new ApplicationException("在DepartmentRoleFunc的GetUsers中FunctionType有误!");
                }
                department = new SpecialLevelParentDeptFunc(base._context).GetDepartment(participant, pi, ai);
            }
            return(base._orgProxy.GetDepartmentRoleUsers(department.Department_ID, part.Param_RoleId.Value));
        }