예제 #1
0
        public static ContractWorkload StatisHSDepartmentYearProjectWorkLoad(HSDepartment department, int year, ContractProject project)
        {
            if (department.IsHigherDepatmentHasSub() == true)   //  如果当前部门是一个有下属部门的一级部门
            {
                //Console.WriteLine("部门{0}是一个有子部门的一级部门", department.Name);
                return(DALContractStatistic.StatisHigherDepartmentYearProjectWorkLoad(department, year, project));
            }
            else if (department.IsHigherDepatmentNoSub() == true)
            {
                //Console.WriteLine("部门{0}是无子部门的一级部门", department.Name);

                return(DALContractStatistic.StatisDepartmentYearProjectWorkLoad(department, year, project));
            }
            else if (department.IsStatisTotalDepartment() == true)
            {
                //Console.WriteLine("部门{0}要求统计所有部门的总和", department.Name);
                return(DALContractStatistic.StatisYearProjectWorkLoad(year, project));
            }
            else if (department.IsStatisRegularDepartment() == true)
            {
                //Console.WriteLine("部门{0}要求统计计划任务额度", department.Name);
                return(DALContractStatistic.StatisYearProjectRegularLoad(year, project));
            }
            else if (department.IsSubDepartment() == true)      //  如果当前部门是一个下属子部门
            {
                //Console.WriteLine("部门{0}是下属子部门", department.Name);
                return(null);
            }

            return(null);
        }
예제 #2
0
        public static ContractWorkload StatisHigherDepartmentYearProjectWorkLoad(HSDepartment highDepartment, int year, ContractProject project)
        {
            //  首先获取到当前一级部门的所有下级部门信息
            List <HSDepartment> departments    = DALHSDepartment.QuerySubHSDepartment(highDepartment.Id);
            ContractWorkload    totalWorkloads = new ContractWorkload
            {
                Work    = 0,
                Expense = 0,
            };

            foreach (HSDepartment department in departments)
            {
                ContractWorkload workload = DALContractStatistic.StatisDepartmentYearProjectWorkLoad(department, year, project);
                totalWorkloads.Work    += workload.Work;
                totalWorkloads.Expense += workload.Expense;
            }

            return(totalWorkloads);
        }