Example #1
0
        public static ContractWorkload StatisHSDepartmentYearItemWorkLoad(HSDepartment department, int year, ContractItem item)
        {
            if (department.IsHigherDepatmentHasSub() == true)   //  如果当前部门是一个有下属部门的一级部门
            {
                //Console.WriteLine("部门{0}是一个有子部门的一级部门", department.Name);
                return(DALContractStatistic.StatisHigherDepartmentYearItemWorkLoad(department, year, item));
            }
            else if (department.IsHigherDepatmentNoSub() == true)
            {
                //Console.WriteLine("部门{0}是无子部门的一级部门", department.Name);
                return(DALContractStatistic.StatisDepartmentYearItemWorkLoad(department, year, item));
            }
            else if (department.IsStatisTotalDepartment() == true)
            {
                //Console.WriteLine("部门{0}要求统计计划任务的总和", department.Name);
                return(DALContractStatistic.StatisYearItemWorkLoad(year, item));
            }
            else if (department.IsStatisRegularDepartment() == true)
            {
                //Console.WriteLine("部门{0}要求统计计划任务额度", department.Name);
                return(DALContractStatistic.StatisYearItemRegularLoad(year, item));
            }
            else if (department.IsSubDepartment() == true)      //  如果当前部门是一个下属子部门
            {
                Console.WriteLine("部门{0}是下属子部门", department.Name);
                return(null);
            }

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

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

            return(totalWorkloads);
        }