Ejemplo n.º 1
0
        private void LoadReport(bool isAutumn, YearViewModel yearModel)
        {
            _reportViewer.Reset();

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
            SemesterDataset dataset = new SemesterDataset();

            dataset.BeginInit();
            reportDataSource1.Name  = "DataSet1"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = dataset.DataTable1;
            _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
            _reportViewer.LocalReport.DisplayName = "Отчёт за " + (isAutumn?"осенний":"весенний") + " семестр " + " (" + yearModel.Name.Replace('/', '-') + ")";
            _reportViewer.LocalReport.ReportPath  = @"./Reports/Controls/Semester.rdlc";
            dataset.EndInit();

            //fill data into adventureWorksDataSet
            var context = DbContextSingleton.GetContext();
            //var workflows = WorkflowStaticWorker.GetAllWorkflows(context);
            var year      = context.AcademicYears.FirstOrDefault(y => y.Id == yearModel.Id);
            var workflows = WorkflowStaticWorker.GetAllWorkflowBySemesterAndYear(context, isAutumn, year.Id);
            var statics   = context.StaticWorkflows.Include(s => s.Employee).Include(s => s.Employee2).Include(s => s.Employee3).Include(s => s.Employee4).Include(s => s.Employee5)
                            .Include(s => s.Agreement).Include(s => s.Semester)
                            .Where(s => s.IsEnabled && s.Semester.IsAutumn == isAutumn).ToList();

            DatatableDataImporter.FillSemesterDataset(dataset.DataTable1, workflows, statics.Select(s => new ExtendedStaticWorkflow(s, year)).ToList());

            _reportViewer.RefreshReport();
        }
        private void LoadReport(YearViewModel yearModel, Employee employee)
        {
            _reportViewer.Reset();

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

            IndPlan dataset = new IndPlan();

            dataset.BeginInit();
            reportDataSource1.Name  = "DataSet1"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = dataset.DataTable5;
            _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
            _reportViewer.LocalReport.ReportPath  = @"./Reports/Controls/PersonalPlan.rdlc";
            _reportViewer.LocalReport.DisplayName = "Индивидуальный план " + employee.FullName + " (" + yearModel.Name.Replace('/', '-') + ")";
            dataset.EndInit();

            var context = DbContextSingleton.GetContext();

            var year      = context.AcademicYears.FirstOrDefault(y => y.Id == yearModel.Id);
            var workflows = WorkflowStaticWorker.GetAllWorkflowByYear(context, yearModel.Id)
                            .Where(w => w.EmployeeId == employee.Id).ToList();
            var statics = context.StaticWorkflows
                          .Include(s => s.Employee).Include(s => s.Employee2).Include(s => s.Employee3).Include(s => s.Employee4).Include(s => s.Employee5)
                          .Include(s => s.Agreement).Include(s => s.Semester)
                          .Where(s => s.IsEnabled).ToList();

            statics = statics.Where(s => s.ContainsEmployeeById(employee.Id)).ToList();
            //var ext = statics.Select(s=>new ExtendedStaticWorkflow(s,year)).ToList();

            DatatableDataImporter.FillIndPlanDataset(dataset.DataTable5, workflows, statics.Select(s => new ExtendedStaticWorkflow(s, year)).ToList(), employee);

            _reportViewer.RefreshReport();
        }
Ejemplo n.º 3
0
        private void LoadReport(YearViewModel yearModel)
        {
            _reportViewer.Reset();

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource();

            WorkloadDataset         dataset  = new WorkloadDataset();
            WorkloadDatasetEmployee dataset2 = new WorkloadDatasetEmployee();

            dataset.BeginInit();
            reportDataSource1.Name  = "DataSet1"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = dataset.DataTable2;
            reportDataSource2.Name  = "DataSet2";
            reportDataSource2.Value = dataset2.DataTable3;
            _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
            _reportViewer.LocalReport.DataSources.Add(reportDataSource2);
            _reportViewer.LocalReport.DisplayName = "Нагрузка " + " (" + yearModel.Name.Replace('/', '-') + ")";
            _reportViewer.LocalReport.ReportPath  = @"./Reports/Controls/Workload.rdlc";
            dataset.EndInit();

            var context = DbContextSingleton.GetContext();

            var year      = context.AcademicYears.FirstOrDefault(y => y.Id == yearModel.Id);
            var workflows = WorkflowStaticWorker.GetAllWorkflowByYear(context, yearModel.Id).Where(w => w.Semester.SemesterNumber <= 8);
            var statics   = context.StaticWorkflows.Include(s => s.Employee).Include(s => s.Employee2).Include(s => s.Employee3).Include(s => s.Employee4).Include(s => s.Employee5)
                            .Include(s => s.Agreement).Include(s => s.Semester)
                            .Where(s => s.IsEnabled && s.Semester.SemesterNumber <= 8).ToList();

            //var ext = statics.Select(s=>new ExtendedStaticWorkflow(s,year)).ToList();

            DatatableDataImporter.FillWorkloadDataset(dataset.DataTable2, workflows.ToList(), statics.Select(s => new ExtendedStaticWorkflow(s, year)).ToList());
            DatatableDataImporter.FillWorkloadEmployee(dataset2.DataTable3, workflows.ToList(), statics.Select(s => new ExtendedStaticWorkflow(s, year)).ToList());


            _reportViewer.RefreshReport();
        }