Пример #1
0
        public void AddSummery()
        {
            _ReportFields.RemoveAll(d => d.Id == -1);//Removes all previously constructed summeries
            ReportDepartmentViewModel summ = new ReportDepartmentViewModel()
            {
                Id                      = -1,
                Name                    = "GESAMT:",
                NrOContracts            = (from d in _ReportFields select d.NrOContracts).Sum(),
                NrOSupervisingContracts = (from d in _ReportFields select d.NrOSupervisingContracts).Sum(),
                NrAdaptable             = (from d in _ReportFields select d.NrAdaptable).Sum(),
            };

            _ReportFields.Add(summ);
        }
        public void AddSummery()
        {
            _ReportFields.RemoveAll(d => d.Id == -1);//Removes all previously constructed summeries

            if (_ReportFields.Any())
            {
                ReportDepartmentViewModel summ = new ReportDepartmentViewModel()
                {
                    Id = -1,
                    Name = "GESAMT:",
                    NrOContracts = (from d in _ReportFields select d.NrOContracts).Sum(),
                    NrOSupervisingContracts = (from d in _ReportFields select d.NrOSupervisingContracts).Sum(),
                    NrAdaptable = (from d in _ReportFields select d.NrAdaptable).Sum(),
                    NrSoonEnding = (from d in _ReportFields select d.NrSoonEnding).Sum(),
                    ContractsSum = (from d in _ReportFields select d.ContractsSum).Sum(),
                    NrVarpayable = (from d in _ReportFields select d.NrVarpayable).Sum(),
                };
                _ReportFields.Add(summ);
            }
        }
Пример #3
0
 /// <summary>
 /// Generates a Report for a Department
 /// </summary>
 /// <param name="DepartmentId"></param>
 /// <returns></returns>
 public static ReportDepartmentViewModel ReportDataDept(int DepartmentId)
 {
     var departmentContracts = from c in db.Contracts
                               where DepartmentId == c.DepartmentId || DepartmentId == c.SupervisorDepartmentId
                               select c;
     ReportDepartmentViewModel result = new ReportDepartmentViewModel();
     result.Id = DepartmentId;
     result.Name = db.Departments.Find(DepartmentId).DepartmentName;
     result.NrOContracts = (from c in db.Contracts
                            where DepartmentId == c.DepartmentId
                            select c).Count();
     result.NrOSupervisingContracts = (from c in db.Contracts
                                       where DepartmentId == c.SupervisorDepartmentId
                                       select c).Count();
     result.NrAdaptable = (from c in departmentContracts
                           where c.Adaptable.HasValue && c.Adaptable.Value
                           select c).Count();
     result.ContractsSum = departmentSum(DepartmentId);
     result.NrSoonEnding = departmentContracts.Where(c => DbFunctions.DiffDays(c.ContractEnd ,DateTime.Now) <= AdvanceDays).Count();
         result.NrVarpayable = (from c in departmentContracts
                                where c.VarPayable.HasValue && c.VarPayable.Value
                                select c).Count();
     return result;
 }