예제 #1
0
        public async Task <List <RepairReportViewModel> > GetReport(RepairReportDto dto)
        {
            //var parameters = new List<SqlParameter>()
            //{
            //    //new SqlParameter(){ParameterName="RETURN_VALUE", Value = dto.RETURN_VALUE, SqlDbType = System.Data.SqlDbType.Int},
            //    new SqlParameter(){ParameterName="Date1", Value = dto.Date1, SqlDbType = SqlDbType.Date},
            //    new SqlParameter(){ParameterName="Date2", Value = dto.Date2, SqlDbType = SqlDbType.Date},
            //    new SqlParameter(){ParameterName="Production", Value = dto.Production, SqlDbType = SqlDbType.VarChar,Size=10},
            //    new SqlParameter(){ParameterName="RepLocationList", Value = dto.RepLocationList, SqlDbType = SqlDbType.VarChar,Size=-1},
            //    new SqlParameter(){ParameterName="Location", Value = dto.Location, SqlDbType = SqlDbType.VarChar,Size=-1},
            //    new SqlParameter(){ParameterName="Currency", Value = dto.Currency, SqlDbType = SqlDbType.VarChar,Size=10},
            //    new SqlParameter(){ParameterName="UserId", Value = dto.UserId, SqlDbType = SqlDbType.VarChar,Size=10},
            //    new SqlParameter(){ParameterName="EquipList", Value = dto.EquipList, SqlDbType = SqlDbType.VarChar,Size=-1},
            //    new SqlParameter(){ParameterName="Language", Value = dto.Language, SqlDbType = SqlDbType.VarChar,Size=10},
            //    new SqlParameter(){ParameterName="OwnerList", Value = dto.OwnerList, SqlDbType = SqlDbType.VarChar,Size=-1},
            //    new SqlParameter(){ParameterName="IncludeBilled", Value = dto.IncludeBilled, SqlDbType = SqlDbType.Bit},
            //    new SqlParameter(){ParameterName="CurrentlyInRepair", Value = dto.CurrentlyInRepair, SqlDbType = SqlDbType.Bit},
            //};
            //return await _context.ExecuteStoreProcedureAsync<RepairReportViewModel>("rpRepair", parameters);

            return(new List <RepairReportViewModel>()
            {
                new RepairReportViewModel()
                {
                    Barcode = new Random().Next().ToString(),
                    Category = Guid.NewGuid().ToString(),
                    Cost = 10,
                    Customer = "aa",
                    DateIn = DateTime.Now,
                    DateOut = DateTime.Now,
                    Department = "pol",
                    Description = Guid.NewGuid().ToString(),
                    Equipment = new Random().Next().ToString()
                },
                new RepairReportViewModel()
                {
                    Barcode = new Random().Next().ToString(),
                    Category = Guid.NewGuid().ToString(),
                    Cost = 10,
                    Customer = "aa1",
                    DateIn = DateTime.Now,
                    DateOut = DateTime.Now,
                    Department = "pol2",
                    Description = Guid.NewGuid().ToString(),
                    Equipment = new Random().Next().ToString()
                }
            });
        }
예제 #2
0
        public async Task <string> MakeReport([FromBody] RepairReportDto model)
        {
            _dataTools.SetNullStringsEmpty(model);

            var report = await _reportBuilder.GetReport(model);

            //report.CalculationMode = StiCalculationMode.Interpretation;
            report.Save("C:\\Csharp-Projects\\stimulTest\\stimulTest\\rep.mrt");
            report.Render(false);
            report.ExportDocument(StiExportFormat.Pdf, "C:\\Csharp-Projects\\stimulTest\\stimulTest\\rep.pdf");

            var result = report.SaveDocumentJsonToString();



            //var viewmodel = await _repository.GetReport(model);

            //var result = new ReportStyle<List<RepairReportViewModel>>
            //{
            //    ReportTemplate = report.SaveToString(),
            //    Data = new Pagination<List<RepairReportViewModel>>()
            //    {
            //        Count = 30,
            //        Page = viewmodel.Count / 30,
            //        Total = viewmodel.Count,
            //        DataSets = new List<DataSet<List<RepairReportViewModel>>>
            //        {
            //            new DataSet<List<RepairReportViewModel>>()
            //            {
            //                DataSetName = "dataset",
            //                Resource = viewmodel
            //            }
            //        }
            //    }
            //};
            return(result);
        }