예제 #1
0
        public async Task <ActionResult> Index(Guid id, ReportTypeEnum type = ReportTypeEnum.NOI, int page = 1,
                                               int size = 50)
        {
            var result = await ApiGateway.GetReport(id, type, page, size);

            return(View(result));
        }
예제 #2
0
        /// <summary>
        /// 获取消息类型名称
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetReportTypeName(this ReportTypeEnum type)
        {
            var name = string.Empty;

            switch (type)
            {
            case ReportTypeEnum.Start:
            {
                name = "加入列队";
                break;
            }

            case ReportTypeEnum.Wait:
            {
                name = "正在进行";
                break;
            }

            case ReportTypeEnum.Finished:
            {
                name = "已完成";
                break;
            }

            default:
            {
                name = "-";
                break;
            }
            }
            return(name);
        }
예제 #3
0
        public static string OutputFormat(ReportTypeEnum type)
        {
            var typeCadena = string.Empty;

            switch (type)
            {
            case ReportTypeEnum.Pdf:
                typeCadena = "PDF";
                break;

            case ReportTypeEnum.Excel:
                typeCadena = "Excel";
                break;

            case ReportTypeEnum.Word:
                typeCadena = "Word";
                break;

            case ReportTypeEnum.Imagen:
                typeCadena = "Image";
                break;

            case ReportTypeEnum.PNG:
                typeCadena = "PNG";
                break;
            }

            return(typeCadena);
        }
예제 #4
0
        public async ValueTask <List <Goods> > GetGoodsWithCategoryReport(ReportTypeEnum reportType)
        {
            string proc = "";

            switch (reportType)
            {
            case ReportTypeEnum.GetProductsNoOneWants:
                proc = SpName.ProductNoOneWants;
                break;

            case ReportTypeEnum.GetProductOutOfStock:
                proc = SpName.ProductOutOfStock;
                break;

            case ReportTypeEnum.GetProductIsInStorageNoInSPBMoscow:
                proc = SpName.ProductIsInStorageNoInSPBMoscow;
                break;
            }

            var result = await connection.QueryAsync <Category, Goods, Goods>(
                proc,
                (c, g) =>
            {
                Goods goods    = g;
                goods.Category = c;
                return(goods);
            },
                param : null,
                commandType : CommandType.StoredProcedure);

            return(result.ToList());
        }
예제 #5
0
        public static string OutputFormat(ReportTypeEnum rerportType)
        {
            string typeString = string.Empty;

            switch (rerportType)
            {
            case ReportTypeEnum.Pdf:
                typeString = "PDF";
                break;

            case ReportTypeEnum.Excel:
                typeString = "Excel";
                break;

            case ReportTypeEnum.Word:
                typeString = "Word";
                break;

            case ReportTypeEnum.Imagen:
                typeString = "Image";
                break;

            case ReportTypeEnum.PNG:
                typeString = "PNG";
                break;
            }

            return(typeString);
        }
예제 #6
0
        /// <summary>
        /// Encapsula a chamada ao gerador de relatórios, decide qual classe de relatório utilizar
        /// </summary>
        private void BuildReport(String reportFilename, ReportTypeEnum reportType, ReportFrequencyEnum reportFrequency)
        {
            FileInfo  reportFile = new FileInfo(reportFilename);
            DateRange dateRange  = ReportContext.GetDateRange(reportFrequency);

            // Usa a classe base dos relatórios para obter o nome completo da classe incluindo dll/assembly
            String qualifiedName = typeof(AbstractReport).AssemblyQualifiedName;

            qualifiedName = qualifiedName.Replace("AbstractReport", reportType.ToString());
            Type reportClass = Type.GetType(qualifiedName);

            // Monta os parâmetros do relatório e cria uma instância da classe de relatório
            ArgumentBuilder argumentBuilder = new ArgumentBuilder();

            argumentBuilder.Add("tenantId", currentTenant.ToString());
            argumentBuilder.Add("startDate", dateRange.GetFirstDay().ToString());
            argumentBuilder.Add("endDate", dateRange.GetLastDay().ToString());
            AbstractReport report = (AbstractReport)Activator.CreateInstance(reportClass, argumentBuilder.GetArguments(reportClass));

            // Caso não seja nenhum dos relatórios implementados aborta
            if ((reportClass == null) || (report == null))
            {
                return;
            }

            // Gera o relatório
            report.InitializeComponents(reportFile, currentReportBuilder, dataAccess.GetConnection());
            report.BuildReport();
        }
        public async ValueTask <List <Product> > GetProduct(ReportTypeEnum typeEnam)
        {
            string procName = SpName.EndedProducts;

            switch (typeEnam)
            {
            case ReportTypeEnum.WereSaledButEndedInStore:
                procName = SpName.EndedProducts;
                break;

            case ReportTypeEnum.InWarehouseNotInCities:
                procName = SpName.InWarehouseNotInCities;
                break;

            case ReportTypeEnum.NobodyOrdered:
                procName = SpName.NobodyOrdered;
                break;
            }
            try
            {
                var result = await connection.QueryAsync <Product>(
                    procName,
                    param : null,
                    commandType : CommandType.StoredProcedure);

                return(result.ToList());
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public static string ReportType(ReportTypeEnum type)
        {
            var typeString = string.Empty;

            switch (type)
            {
            case ReportTypeEnum.Pdf:
                typeString = "PDF";
                break;

            case ReportTypeEnum.Excel:
                typeString = "Excel";
                break;

            case ReportTypeEnum.Word:
                typeString = "Word";
                break;

            case ReportTypeEnum.Imagen:
                typeString = "Image";
                break;

            case ReportTypeEnum.PNG:
                typeString = "Image";
                break;
            }

            return(typeString);
        }
예제 #9
0
        public async Task <IEnumerable <EM> > GetReport(Guid id, ReportTypeEnum type, int page, int size)
        {
            var query = PRContext
                        .EM
                        .Where(em => em.UIDAtto == id && em.IDStato >= (int)StatiEnum.Depositato);

            switch (type)
            {
            case ReportTypeEnum.NOI:
            case ReportTypeEnum.PCR:
                query = query
                        .OrderBy(em => em.ARTICOLI.Articolo)
                        .ThenBy(em => em.COMMI.Comma)
                        .ThenBy(em => em.NLettera)
                        .ThenBy(em => em.LETTERE.Lettera);
                break;

            case ReportTypeEnum.PROG:
                query = query
                        .OrderBy(em => em.OrdinePresentazione);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(await query
                   .Skip((page - 1) *size)
                   .Take(size)
                   .ToListAsync());
        }
        public override RouteValueDictionary GetRouteValues(ReportTypeEnum reportType = ReportTypeEnum.Pdf)
        {
            var routeValues = base.GetRouteValues(reportType);

            routeValues.Add("Sex", Sex);
            routeValues.Add("TownId", this.TownId);
            return(routeValues);
        }
예제 #11
0
        public async Task <IActionResult> SearchAsync(
            [FromQuery] ReportTypeEnum reportType,
            [FromQuery] ReportGroupTypeEnum groupType,
            [FromQuery] string project,
            [FromQuery] string user,
            [FromQuery] DateTime?startDate,
            [FromQuery] DateTime?endDate)
        {
            var paramDto = new ReportParamDto
            {
                ReportType = reportType,
                GroupBy    = groupType,
                Project    = project,
                User       = user,
                StartDate  = startDate,
                EndDate    = endDate
            };

            var validation = CheckValidation(paramDto);

            if (!validation.IsValid)
            {
                throw new BadRequestException(validation.Errors);
            }

            IReportDto result = new ReportDto();

            switch (reportType)
            {
            default:
            {
                break;
            }

            case ReportTypeEnum.Daily:
            {
                result = await _reportService.DailyReportAsync(User.Identity.Name, paramDto);

                break;
            }

            case ReportTypeEnum.Weekly:
            {
                result = await _reportService.WeeklyReportAsync(User.Identity.Name, paramDto);

                break;
            }

            case ReportTypeEnum.Monthly:
            {
                result = await _reportService.MonthlyReportAsync(User.Identity.Name, paramDto);

                break;
            }
            }

            return(ResultOk(result));
        }
예제 #12
0
        public static byte[] RenderReport(ReportTypeEnum type, string dataSourceName, object dataSource, string reportePathCompleto,
                                          string[] columnasMostrar, IDictionary <string, string> parametros, out string mimeType)
        {
            var dataSources = new Dictionary <string, object>();

            dataSources.Add(dataSourceName, dataSource);

            return(RenderReport(type, dataSources, reportePathCompleto, columnasMostrar, parametros, null, out mimeType));
        }
예제 #13
0
        private void ProcessMailing(MailingDAO mailingDAO, Mailing mailing)
        {
            SmtpServerDAO       smtpServerDAO   = new SmtpServerDAO(dataAccess.GetConnection());
            SmtpServer          smtpServer      = smtpServerDAO.GetSmtpServer(currentTenant, mailing.smtpServer);
            ReportFrequencyEnum reportFrequency = (ReportFrequencyEnum)mailing.frequency;
            ReportTypeEnum      reportType      = (ReportTypeEnum)mailing.reportType;
            String   recipients = mailing.recipients;
            DateTime lastSend   = mailing.lastSend;

            // Verifica se está na data de envio, aborta caso não esteja
            if (!ReportContext.IsScheduledTime(reportFrequency, currentPeriodEndDate))
            {
                return;
            }

            // Verifica se o log foi importado
            PrintLogPersistence logPersistence = new PrintLogPersistence(currentTenant, dataAccess.GetConnection(), null, false);
            Boolean             logImported    = logPersistence.FileImported(ReportContext.GetDateRange(reportFrequency));

            // Verifica se o relatório já foi enviado hoje
            Boolean alreadySent = lastSend.Date == DateTime.Now.Date;

            // Caso o log tenha sido importado e se ainda não enviou, gera o relatório e envia
            if ((logImported) && (!alreadySent))
            {
                // Inicia o append no arquivo de log (acrescentando o "startingDelimiter")
                fileLogger.LogInfo("Envio de relatório - Iniciando execução...", true);
                // Informa dados do mailing
                fileLogger.LogInfo("Frequência de envio - reportFrequency = " + reportFrequency.ToString());
                fileLogger.LogInfo("Relatório - reportType = " + reportType.ToString());
                fileLogger.LogInfo("Destinatários - recipients = " + recipients);
                notifications.Clear();

                String reportStamp    = DateTime.Now.Ticks.ToString();
                String reportFilename = FileResource.MapDesktopResource("Report" + reportStamp + currentFormatExtension);
                BuildReport(reportFilename, reportType, reportFrequency);

                String        mailSubject     = "Relatório " + ReportContext.GetFrequencyCaption(reportFrequency);
                List <String> attachmentFiles = new List <String>();
                attachmentFiles.Add(reportFilename);
                MailSender mailSender = new MailSender(smtpServer.CreateSysObject(), this);
                mailSender.SetContents("Email gerado automaticamente, não responder.", attachmentFiles);
                Boolean success = mailSender.SendMail(mailSubject, currentSysSender, recipients);

                ProcessNotifications();
                if (success) // Grava a data de envio de envio no banco
                {
                    mailing.lastSend = DateTime.Now.Date;
                    mailingDAO.SetMailing(mailing);
                    fileLogger.LogInfo("Execução concluída.");
                }
            }

            // Tenta remover arquivos temporários, ignora caso os arquivos estejam em uso
            // tentará novamente nas próximas execuções
            ReportContext.TryRemoveTempFiles();
        }
예제 #14
0
        public static byte[] RenderReport(ReportTypeEnum type, string dataSetName, object dataSet, string fullPath,
                                          string[] columnsToShow, IDictionary <string, string> parameters, out string mimeType)
        {
            var dataSources = new Dictionary <string, object>();

            dataSources.Add(dataSetName, dataSet);

            return(RenderReport(type, dataSources, fullPath, columnsToShow, parameters, null, out mimeType));
        }
예제 #15
0
        private static LocalReport ProccessLocalReport(ReportTypeEnum reportTypeEnum, string reportPath, IEnumerable <ReportDataSource> reportDataSources,
                                                       List <ReportParameter> reportParameters, out string reportType, out string deviceInfo)
        {
            LocalReport lr = new LocalReport();

            if (!File.Exists(reportPath))
            {
                throw new Exception("Report não encontrado!");
            }

            lr.ReportPath = reportPath;

            foreach (var reportDataSource in reportDataSources)
            {
                lr.DataSources.Add(reportDataSource);
            }

            if (reportParameters.Any())
            {
                lr.SetParameters(reportParameters);
            }

            switch (reportTypeEnum)
            {
            case ReportTypeEnum.Pdf:
                reportType = "PDF";
                break;

            case ReportTypeEnum.Excel:
                reportType = "Excel";
                break;

            case ReportTypeEnum.Word:
                reportType = "Word";
                break;

            case ReportTypeEnum.Image:
                reportType = "Image";
                break;

            default:
                throw new ArgumentOutOfRangeException("reportTypeEnum");
            }

            deviceInfo = "<DeviceInfo>" +
                         "  <OutputFormat>" + reportType + "</OutputFormat>" +
                         "  <PageWidth>8.5in</PageWidth>" +
                         "  <PageHeight>11in</PageHeight>" +
                         "  <MarginTop>0.5in</MarginTop>" +
                         "  <MarginLeft>1in</MarginLeft>" +
                         "  <MarginRight>1in</MarginRight>" +
                         "  <MarginBottom>0.5in</MarginBottom>" +
                         "</DeviceInfo>";

            return(lr);
        }
예제 #16
0
        public virtual RouteValueDictionary GetRouteValues(ReportTypeEnum rerportType = ReportTypeEnum.Pdf)
        {
            var routeValues = new RouteValueDictionary();

            routeValues.Add("ReportType", rerportType);
            routeValues.Add("From", this.From.HasValue ? this.From.Value.ToShortDateString() : null);
            routeValues.Add("To", this.To.HasValue ? this.To.Value.ToShortDateString() : null);
            routeValues.Add("ShopId", this.ShopId);
            return(routeValues);
        }
예제 #17
0
        /// <summary>
        /// Gera um relatório com base nos parâmetros informados.
        /// </summary>
        /// <param name="reportTypeEnum">Tipo report que deve ser gerado. (PDF, Excel, Word e Imagem)</param>
        /// <param name="reportPath">Path completo do arquivo .rdlc do relatório.</param>
        /// <param name="reportDataSources">Lista de DataSource do relatório.</param>
        /// <param name="reportParameters">Lista de Parâmetros do relatório.</param>
        /// <param name="mimeType">[out] O tipo MIME do relatório gerado.</param>
        /// <returns>Array de bytes do relatório gerado.</returns>
        public static byte[] GenerateReport(ReportTypeEnum reportTypeEnum, string reportPath, List<ReportDataSource> reportDataSources, List<ReportParameter> reportParameters, out string mimeType)
        {
            string reportType;
            string deviceInfo;

            LocalReport lr = ProccessLocalReport(reportTypeEnum, reportPath, reportDataSources, reportParameters, out reportType,
                out deviceInfo);

            return RenderReport(lr, reportType, deviceInfo, out mimeType);
        }
예제 #18
0
        /// <summary>
        /// Gera um relatório com base nos parâmetros informados.
        /// </summary>
        /// <param name="reportTypeEnum">Tipo report que deve ser gerado. (PDF, Excel, Word e Imagem)</param>
        /// <param name="reportPath">Path completo do arquivo .rdlc do relatório.</param>
        /// <param name="reportDataSources">Lista de DataSource do relatório.</param>
        /// <param name="reportParameters">Lista de Parâmetros do relatório.</param>
        /// <param name="mimeType">[out] O tipo MIME do relatório gerado.</param>
        /// <returns>Array de bytes do relatório gerado.</returns>
        public static byte[] GenerateReport(ReportTypeEnum reportTypeEnum, string reportPath, List <ReportDataSource> reportDataSources, List <ReportParameter> reportParameters, out string mimeType)
        {
            string reportType;
            string deviceInfo;

            LocalReport lr = ProccessLocalReport(reportTypeEnum, reportPath, reportDataSources, reportParameters, out reportType,
                                                 out deviceInfo);

            return(RenderReport(lr, reportType, deviceInfo, out mimeType));
        }
예제 #19
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name       = binaryReader.ReadString256();
     this.ReportType = ((ReportTypeEnum)(binaryReader.ReadInt16()));
     this.GlobalErrorReportCategoriesFlags = ((Flags)(binaryReader.ReadInt16()));
     this.fieldpad  = binaryReader.ReadBytes(2);
     this.fieldpad0 = binaryReader.ReadBytes(2);
     this.fieldpad1 = binaryReader.ReadBytes(404);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(608));
     return(pointerQueue);
 }
예제 #20
0
        public bool Report(int postId, string description, ReportTypeEnum reportName = ReportTypeEnum.Other)
        {
            Report report = new Report();

            report.Description  = description;
            report.PostId       = postId;
            report.ReportedDate = DateTime.Now;
            report.ReporterId   = User.Identity.GetUserId <int>();
            report.Type         = reportName;

            return(cService.CreateReport(report));
        }
예제 #21
0
 /// <summary>
 /// Report Constructor given type id, message, latitude, longitude, dateReported, and user
 /// </summary>
 public Report(ReportTypeEnum reportTypeId, String message, 
     String latitude, String longitude, String location,
     DateTime dateReported, IUser user)
 {
     this.ReportTypeId = reportTypeId;
     this.Message = message;
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.Location = location;
     this.DateReported = dateReported;
     this.User = user;
 }
        public override RouteValueDictionary GetRouteValues(ReportTypeEnum rerportType = ReportTypeEnum.Pdf)
        {
            var routeValues = new RouteValueDictionary();

            routeValues.Add("ReportType", rerportType);
            routeValues.Add("From", this.From.HasValue ? this.From.Value.ToShortDateString() : null);
            routeValues.Add("To", this.To.HasValue ? this.To.Value.ToShortDateString() : null);
            routeValues.Add("EducationalInstitutionId", this.EducationalInstitutionId);
            routeValues.Add("ShopId", this.ShopId);
            routeValues.Add("BeneficiaryId", this.BeneficiaryId);
            return(routeValues);
        }
예제 #23
0
        public void TestReports(ReportTypeEnum type, decimal factor)
        {
            var result = _translator.ToViewModel((int)type, _expectedEmployees, _expectedBenefits, _expectedDiscounts);

            Assert.NotNull(result);

            Assert.AreEqual(_expectedEmployees.Count, result.Costs.Count);

            var employeeDeduction =
                _expectedBenefits.SingleOrDefault(x => x.BenefitType == BenefitTypeEnum.EmployeeBenefit);
            var dependentDeduction =
                _expectedBenefits.SingleOrDefault(x => x.BenefitType == BenefitTypeEnum.DependentBenefit);
            var compensation =
                _expectedBenefits.SingleOrDefault(x => x.BenefitType == BenefitTypeEnum.EmployeeCompensation);

            var totalCost            = 0.0m;
            var expectedCompensation = (compensation.Amount * 26) / factor;

            for (var i = 0; i < _expectedEmployees.Count; i++)
            {
                var expectedEmp = _expectedEmployees[i];
                var actualEmp   = result.Costs[i];

                var totalDeduction = 0.0m;

                var expectedName = $"{expectedEmp.FirstName} {expectedEmp.LastName}";
                Assert.AreEqual(expectedName, actualEmp.Name);
                Assert.AreEqual(expectedEmp.Dependents.Count(), actualEmp.Dependents.Count);

                Assert.AreEqual(Math.Round(employeeDeduction.Amount / factor, 2), Math.Round(actualEmp.DeductionAmount, 2));

                totalDeduction += actualEmp.DeductionAmount;

                for (var j = 0; j < expectedEmp.Dependents.Count(); j++)
                {
                    var expectedDep     = expectedEmp.Dependents.ToList()[j];
                    var actualDep       = actualEmp.Dependents[j];
                    var expectedDepName = $"{expectedDep.FirstName} {expectedDep.LastName}";

                    Assert.AreEqual(expectedDepName, actualDep.Name);
                    Assert.AreEqual(dependentDeduction.Amount / factor, actualDep.DeductionAmount);

                    totalDeduction += actualDep.DeductionAmount;
                }

                var expectedTotalCost = expectedCompensation - totalDeduction;
                totalCost += expectedTotalCost;
                Assert.AreEqual(expectedTotalCost, actualEmp.TotalCost);
            }

            Assert.AreEqual(expectedCompensation, result.EmployeeCompensation);
            Assert.AreEqual(Math.Round(totalCost, 2), Math.Round(result.TotalCost, 2));
        }
예제 #24
0
 /// <summary>
 /// Report Constructor given type id, message, latitude, longitude, dateReported, and user
 /// </summary>
 public Report(ReportTypeEnum reportTypeId, String message,
               String latitude, String longitude, String location,
               DateTime dateReported, IUser user)
 {
     this.ReportTypeId = reportTypeId;
     this.Message      = message;
     this.Latitude     = latitude;
     this.Longitude    = longitude;
     this.Location     = location;
     this.DateReported = dateReported;
     this.User         = user;
 }
예제 #25
0
 public TableData(
     int reportIid, string reportFile, ReportTypeEnum reportType,
     PrintStatusEnum printStatus,
     int printPathIid, int numCopy, bool sendMessage, bool graph,
     SortDirectionEnum groupDirection1, SortDirectionEnum groupDirection2, SortDirectionEnum groupDirection3,
     string groupHeader1, string groupHeader2, string groupHeader3,
     string groupTable1, string groupTable2, string groupTable3,
     SortDirectionEnum sortDirection1, SortDirectionEnum sortDirection2, SortDirectionEnum sortDirection3,
     string sortHeader1, string sortHeader2, string sortHeader3,
     string sortTable1, string sortTable2, string sortTable3,
     int bulletinNumber, string batchName, int batchUser,
     int batchPathId, int emailId, OutputEnum outputType,
     int dirPathId, string CompletedReportFile, CopyStatusEnum copyStatus, EmailStatusEnum emailStatus, RunStatusEnum runStatus, int eMailType)
 {
     ReportIid                = reportIid;
     ReportFile               = reportFile;
     ReportType               = reportType;
     PrintStatus              = printStatus;
     PrintPathIid             = printPathIid;
     NumCopy                  = numCopy;
     SendMessage              = sendMessage;
     Graph                    = graph;
     GroupDirection1          = groupDirection1;
     GroupDirection2          = groupDirection2;
     GroupDirection3          = groupDirection3;
     GroupHeader1             = groupHeader1;
     GroupHeader2             = groupHeader2;
     GroupHeader3             = groupHeader3;
     GroupTable1              = groupTable1;
     GroupTable2              = groupTable2;
     GroupTable3              = groupTable3;
     SortDirection1           = sortDirection1;
     SortDirection2           = sortDirection2;
     SortDirection3           = sortDirection3;
     SortHeader1              = sortHeader1;
     SortHeader2              = sortHeader2;
     SortHeader3              = sortHeader3;
     SortTable1               = sortTable1;
     SortTable2               = sortTable2;
     SortTable3               = sortTable3;
     BulletinNumber           = bulletinNumber;
     BatchName                = batchName;
     BatchUser                = batchUser;
     BatchPathId              = batchPathId;
     EmailId                  = emailId;
     OutputType               = outputType;
     DirPathId                = dirPathId;
     this.CompletedReportFile = CompletedReportFile;
     CopyStatus               = copyStatus;
     EmailStatus              = emailStatus;
     RunStatus                = runStatus;
     EmailType                = eMailType;
 }
        public ReportHeaderFooters(ReportTypeEnum reportType)
        {
            this.InitializeComponent();

            this.DataContext = this;

            this.selectedReportType = reportType;

            this.uxChangeCategory.Visibility = this.selectedReportType == ReportTypeEnum.ReportContent ? Visibility.Visible : Visibility.Collapsed;

            this.Loaded += this.ReportHeaderFooters_Loaded;

            this.uxButtonAdd.ToolTip = $"Add new {this.selectedReportType.GetDescriptionAttribute()}";
        }
예제 #27
0
        public async ValueTask <ActionResult <List <ProductWithCategoryOutputModel> > > GetProductOver()
        {
            ReportTypeEnum reportType = ReportTypeEnum.GetProductOver;
            var            result     = await _productRepository.GetProductWithCategoryReport(reportType);

            if (result.IsOk)
            {
                if (result.RequestData == null)
                {
                    return(NotFound("Products that is over not found"));
                }
                return(Ok(_mapper.Map <List <ProductWithCategoryOutputModel> >(result.RequestData)));
            }
            return(Problem($"Getting products failed {result.ExMessage}", statusCode: 520));;
        }
예제 #28
0
        public async ValueTask <ActionResult <List <ProductOutputModel> > > GetProductsInStockNotInCities()
        {
            ReportTypeEnum type   = ReportTypeEnum.ProductsInStockButNotInCities;
            var            result = await _reportRepository.GetFilteredProducts(type);

            if (result.IsOkay)
            {
                if (result.RequestData == null)
                {
                    return(NotFound("Products not found"));
                }
                return(Ok(_mapper.Map <List <ProductOutputModel> >(result.RequestData)));
            }
            return(Problem($"Transaction failed {result.ExMessage}", statusCode: 520));
        }
예제 #29
0
        public async ValueTask <ActionResult <List <ProductOutputModel> > > FindNoOrderProduct()
        {
            ReportTypeEnum reportType = ReportTypeEnum.NobodyOrdered;
            var            result     = await _reportRepository.Report(reportType);

            if (result.IsOkay)
            {
                if (result.RequestData == null)
                {
                    return(NotFound("Product not found"));
                }
                return(Ok(_mapper.Map <List <ProductOutputModel> >(result.RequestData)));
            }
            return(Problem($"Transaction failed {result.ExMessage}", statusCode: 520));
        }
예제 #30
0
        public async ValueTask <ActionResult <List <ProductStorageOutputModel> > > GetProductsInWarehouseAndNotInSpbAndMsc()
        {
            ReportTypeEnum reportType = ReportTypeEnum.InWarehouseNotInCities;
            var            result     = await _reportRepository.Report(reportType);

            if (result.IsOkay)
            {
                if (result.RequestData == null)
                {
                    return(NotFound("No such products"));
                }
                return(Ok(_mapper.Map <List <ProductStorageOutputModel> >(result.RequestData)));
            }
            return(Problem($"Transaction failed {result.ExMessage}", statusCode: 520));
        }
예제 #31
0
        public async ValueTask <ActionResult <List <ProductWithCategoryOutputModel> > > GetСategoriesMoreFiveProducts()
        {
            ReportTypeEnum reportType = ReportTypeEnum.CategoriesMoreFiveProducts;
            var            result     = await _productRepository.GetProductWithCategoryReport(reportType);

            if (result.IsOk)
            {
                if (result.RequestData == null)
                {
                    return(NotFound("Categories with less than five products not found"));
                }
                return(Ok(_mapper.Map <List <CountProductsOutputModel> >(result.RequestData)));
            }
            return(Problem($"Getting categories failed {result.ExMessage}", statusCode: 520));;
        }
예제 #32
0
 public ReportAnswer GetFullReport(List<string> selectedData, DateTime dateStart, DateTime dateEnd, ReportTypeEnum ReportType)
 {
     try {
         Logger.Info(String.Format("Получение отчета {0} - {1} [{2}]",dateStart,dateEnd,ReportType));
         FullReport report=new FullReport(dateStart, dateEnd, Report.GetInterval(ReportType));
         report.InitNeedData(selectedData);
         report.ReadData();
         report.CreateAnswerData();
         report.CreateChart();
         Logger.Info("Отчет сформирован: "+report.Answer.Data.Count());
         return report.Answer;
     } catch (Exception e) {
         Logger.Error("Ошибка при получении отчета " + e.ToString());
         return null;
     }
 }
예제 #33
0
        public async ValueTask <RequestResult <List <Product> > > Report(ReportTypeEnum reportTypeEnum)
        {
            var result = new RequestResult <List <Product> >();

            try
            {
                result.RequestData = await _commonStorage.GetProduct(reportTypeEnum);

                result.IsOkay = true;
            }
            catch (Exception ex)
            {
                result.ExMessage = ex.Message;
            }
            return(result);
        }
예제 #34
0
        /// <summary>
        /// Gera um relatório com sub relatório base nos parâmetros informados.
        /// </summary>
        /// <param name="reportTypeEnum">Tipo report que deve ser gerado. (PDF, Excel, Word e Imagem)</param>
        /// <param name="reportPath">Path completo do arquivo .rdlc do relatório.</param>
        /// <param name="reportDataSources">Lista de DataSource do relatório.</param>
        /// <param name="reportParameters">Lista de Parâmetros do relatório.</param>
        /// <param name="subReportDataSources">Lista de DataSource do sub relatório.</param>
        /// <param name="mimeType">[out] O tipo MIME do relatório gerado.</param>
        /// <returns>Array de bytes do relatório gerado.</returns>
        public static byte[] GenerateReportWithSubReport(ReportTypeEnum reportTypeEnum, string reportPath, List<ReportDataSource> reportDataSources, List<ReportParameter> reportParameters, List<ReportDataSource> subReportDataSources, out string mimeType)
        {
            try
            {
                string reportType;
                string deviceInfo;

                LocalReport lr = ProccessLocalReport(reportTypeEnum, reportPath, reportDataSources, reportParameters, out reportType,
                    out deviceInfo);

                _subReportDataSources = subReportDataSources;

                lr.SubreportProcessing += SubreportProcessing;

                byte[] report = RenderReport(lr, reportType, deviceInfo, out mimeType);

                return report;
            }
            finally
            {
                _subReportDataSources = null;
            }
        }
예제 #35
0
        public static string OutputFormat(ReportTypeEnum type)
        {
            string typeCadena = string.Empty;
            switch (type)
            {
                case ReportTypeEnum.Pdf:
                    typeCadena = "PDF";
                    break;
                case ReportTypeEnum.Excel:
                    typeCadena = "Excel";
                    break;
                case ReportTypeEnum.Word:
                    typeCadena = "Word";
                    break;
                case ReportTypeEnum.Imagen:
                    typeCadena = "Image";
                    break;
                case ReportTypeEnum.PNG:
                    typeCadena = "PNG";
                    break;
            }

            return typeCadena;
        }
예제 #36
0
        /// <summary>
        /// Creates Report given the 
        /// ReportTypeEnum reportTypeId : Report Type
        /// String message : Report Message 
        /// String latitude : Latitude coordinate of crime reported
        /// String longitude : Longitude coordinate of crime reported
        /// String location :  Location of crime reported
        /// DateTime dateReported : Time crime reported
        /// String userName : Username of account that submitted reported
        /// List<String> resourceUrlList :  URL location list of media    
        /// </summary>
        public static void CreateReport(ReportTypeEnum reportTypeId, String message, 
            String latitude, String longitude, String location, DateTime dateReported,
            String userName, List<String> resourceUrlList) 
        { 
            using (SqlConnection connection = ConnectionManager.GetConnection()) 
            {
                SqlCommand command = new SqlCommand("CreateReport", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@ReportTypeId", reportTypeId);
                command.Parameters.AddWithValue("@Message", message);
                command.Parameters.AddWithValue("@Latitude", latitude);
                command.Parameters.AddWithValue("@Longitude", longitude);
                command.Parameters.AddWithValue("@Location", location);
                command.Parameters.AddWithValue("@DateReported", dateReported);
                command.Parameters.AddWithValue("@UserName", userName);
                
                for (int i = 1; i <= resourceUrlList.Count; i++)
                {
                    command.Parameters.AddWithValue("@Media" + i, resourceUrlList[i - 1]);
                }
 
                command.ExecuteNonQuery();
            }
        }
예제 #37
0
        public byte[] Renderizar(ReportTypeEnum tipo)
        {
            string mimeTypeOut = string.Empty;
            byte[] archivo = ReporteHelper.RenderReport(
                tipo,
                this.DataSources,
                this.PathCompleto.ToString(),
                this.ColumnasMostrar.ToArray(),
                this.Parametros,
                this.Imagenes, this.PageWidth, this.PageHeight, this.MarginTop, this.MarginLeft, this.MarginRight,
                this.MarginBottom,
                out mimeTypeOut);

            this.MimeType = mimeTypeOut;
            return archivo;
        }
예제 #38
0
        private static LocalReport ProccessLocalReport(ReportTypeEnum reportTypeEnum, string reportPath, IEnumerable<ReportDataSource> reportDataSources,
                                                         List<ReportParameter> reportParameters, out string reportType, out string deviceInfo)
        {
            LocalReport lr = new LocalReport();

            if (!File.Exists(reportPath))
                throw new Exception("Report não encontrado!");

            lr.ReportPath = reportPath;

            foreach (var reportDataSource in reportDataSources)
                lr.DataSources.Add(reportDataSource);

            if (reportParameters.Any())
                lr.SetParameters(reportParameters);

            switch (reportTypeEnum)
            {
                case ReportTypeEnum.Pdf:
                    reportType = "PDF";
                    break;
                case ReportTypeEnum.Excel:
                    reportType = "Excel";
                    break;
                case ReportTypeEnum.Word:
                    reportType = "Word";
                    break;
                case ReportTypeEnum.Image:
                    reportType = "Image";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("reportTypeEnum");
            }

            deviceInfo = "<DeviceInfo>" +
                         "  <OutputFormat>" + reportType + "</OutputFormat>" +
                         "  <PageWidth>8.5in</PageWidth>" +
                         "  <PageHeight>11in</PageHeight>" +
                         "  <MarginTop>0.5in</MarginTop>" +
                         "  <MarginLeft>1in</MarginLeft>" +
                         "  <MarginRight>1in</MarginRight>" +
                         "  <MarginBottom>0.5in</MarginBottom>" +
                         "</DeviceInfo>";

            return lr;
        }
예제 #39
0
 protected Descriptor(
     DescriptorType descriptorType,
     Type type,
     string header,
     GetGolumnsDelegate getColumns,
     CreateEditorDelegate createEditor,
     DocumentTypeEnum? documentType = null,
     RefBookTypeEnum? refBookType = null,
     ReportTypeEnum? reportType = null)
 {
     this.descriptorType = descriptorType;
     this.type = type;
     this.header = header;
     this.getColumns = getColumns;
     this.createEditor = createEditor;
     if (documentType.HasValue)
     {
         this.documentType = documentType.Value;
     }
     if (refBookType.HasValue)
     {
         this.refBookType = refBookType.Value;
     }
     if (reportType.HasValue)
     {
         this.reportType = reportType.Value;
     }
 }
예제 #40
0
 /// <summary>
 /// Асинхронно вызывает метод "GetFullReport" службы DomainService.
 /// </summary>
 /// <param name="selectedData">Значение параметра "selectedData" для данного действия.</param>
 /// <param name="dateStart">Значение параметра "dateStart" для данного действия.</param>
 /// <param name="dateEnd">Значение параметра "dateEnd" для данного действия.</param>
 /// <param name="ReportType">Значение параметра "ReportType" для данного действия.</param>
 /// <returns>Экземпляр операции, который может быть использован для управления асинхронным запросом.</returns>
 public InvokeOperation<ReportAnswer> GetFullReport(IEnumerable<string> selectedData, DateTime dateStart, DateTime dateEnd, ReportTypeEnum ReportType)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("selectedData", selectedData);
     parameters.Add("dateStart", dateStart);
     parameters.Add("dateEnd", dateEnd);
     parameters.Add("ReportType", ReportType);
     this.ValidateMethod("GetFullReport", parameters);
     return ((InvokeOperation<ReportAnswer>)(this.InvokeOperation("GetFullReport", typeof(ReportAnswer), parameters, true, null, null)));
 }
예제 #41
0
파일: Report.cs 프로젝트: rj128x/VotGES
 public static IntervalReportEnum GetInterval(ReportTypeEnum ReportType)
 {
     switch (ReportType) {
         case ReportTypeEnum.dayByMinutes:
             return IntervalReportEnum.minute;
         case ReportTypeEnum.dayByHalfHours:
             return IntervalReportEnum.halfHour;
         case ReportTypeEnum.dayByHours:
             return IntervalReportEnum.hour;
         case ReportTypeEnum.monthByDays:
             return IntervalReportEnum.day;
         case ReportTypeEnum.monthByHalfHours:
             return IntervalReportEnum.halfHour;
         case ReportTypeEnum.monthByHours:
             return IntervalReportEnum.hour;
         case ReportTypeEnum.quarterByDays:
             return IntervalReportEnum.day;
         case ReportTypeEnum.yearByDays:
             return IntervalReportEnum.day;
         case ReportTypeEnum.yearByMonths:
             return IntervalReportEnum.month;
         case ReportTypeEnum.yearByQarters:
             return IntervalReportEnum.quarter;
     }
     return IntervalReportEnum.halfHour;
 }
예제 #42
0
 /// <summary>
 /// Renderizar un reporte a un type especifico
 /// </summary>
 /// <param name="dataSourceName"></param>
 /// <param name="dataSource"></param>
 /// <param name="reportePathCompleto">Path completo para cargar el reporte desde el servidor</param>
 /// <param name="mimeType"></param>
 /// <returns></returns>
 public static byte[] RenderReport(ReportTypeEnum type, string dataSourceName, object dataSource, string reportePathCompleto, out string mimeType)
 {
     return RenderReport(type, dataSourceName, dataSource, reportePathCompleto, new string[0], new Dictionary<string, string>(), out mimeType);
 }
예제 #43
0
        public static byte[] RenderReport(ReportTypeEnum type, string dataSourceName, object dataSource, string reportePathCompleto,
            string[] columnasMostrar, IDictionary<string, string> parametros, out string mimeType)
        {
            var dataSources = new Dictionary<string, object>();
            dataSources.Add(dataSourceName, dataSource);

            return RenderReport(type, dataSources, reportePathCompleto, columnasMostrar, parametros, null, out mimeType);
        }
예제 #44
0
 /// <summary>
 /// Renderizar un reporte a un type especifico
 /// </summary>
 /// <param name="dataSourceName"></param>
 /// <param name="dataSource"></param>
 /// <param name="reportePathCompleto">Path completo para cargar el reporte desde el servidor</param>
 /// <param name="mimeType"></param>
 /// <returns></returns>
 public static byte[] RenderReport(ReportTypeEnum type, Dictionary<string, object> dataSources, string reportePathCompleto, string[] columnasMostrar,
                                             IDictionary<string, string> parametros, IDictionary<string, string> imagenes, out string mimeType)
 {
     return RenderReport(type, dataSources, reportePathCompleto, columnasMostrar, parametros, imagenes, null, null, null, null, null, null, out mimeType);
 }
예제 #45
0
        public static byte[] RenderReport(ReportTypeEnum type, Dictionary<string, object> dataSources, string reportePathCompleto, string[] columnasMostrar,
                                                 IDictionary<string, string> parametros, IDictionary<string, string> imagenes,
                                                 decimal? pageWidth, decimal? pageHeight, decimal? marginTop, decimal? marginLeft, decimal? marginRight, decimal? marginBottom, out string mimeType)
        {
            var localReport = new LocalReport();

            ReporteLoadReportDefinition(localReport, reportePathCompleto, imagenes);

            localReport.DataSources.Clear();

            foreach (var dataSourcesName in dataSources.Keys)
            {
                var reporteDataSource = new ReportDataSource(dataSourcesName, dataSources[dataSourcesName]);
                localReport.DataSources.Add(reporteDataSource);
            }

            //Imagenes externas
            localReport.EnableExternalImages = true;

            if (columnasMostrar.Any())
            {
                var sb = new StringBuilder();
                foreach (string columna in columnasMostrar)
                {
                    sb.AppendFormat("#{0}#", columna.Trim());
                }
                parametros.Add("Columnas", sb.ToString());
            }

            foreach (var clave in parametros.Keys)
            {
                var param = new ReportParameter();
                param.Name = clave;
                param.Values.Add(parametros[clave]);
                localReport.SetParameters(param);
            }

            string outputFormat = OutputFormat(type);
            string reporteType = ReportType(type);
            string encoding;
            string fileNameExtension;

            StringBuilder deviceInfo = new StringBuilder();

            deviceInfo.AppendFormat("<DeviceInfo>");
            deviceInfo.AppendFormat("<OutputFormat>{0}</OutputFormat>", outputFormat);

            if (pageWidth.HasValue)
            {
                deviceInfo.AppendFormat("  <PageWidth>{0}cm</PageWidth>", pageWidth);
            }

            if (pageHeight.HasValue)
            {
                deviceInfo.AppendFormat("  <PageHeight>{0}cm</PageHeight>", pageHeight);
            }

            if (marginTop.HasValue)
            {
                deviceInfo.AppendFormat("  <MarginTop>{0}cm</MarginTop>", marginTop);
            }

            if (marginLeft.HasValue)
            {
                deviceInfo.AppendFormat("  <MarginLeft>{0}cm</MarginLeft>", marginLeft);
            }

            if (marginRight.HasValue)
            {
                deviceInfo.AppendFormat("  <MarginRight>{0}cm</MarginRight>", marginRight);
            }

            if (marginBottom.HasValue)
            {
                deviceInfo.AppendFormat("  <MarginBottom>{0}cm</MarginBottom>", marginBottom);
            }

            deviceInfo.AppendLine("<Encoding>UTF-8</Encoding>");
            deviceInfo.AppendFormat("</DeviceInfo>");

            Warning[] warnings;
            string[] streams;

            localReport.Refresh();

            //Render the report
            return localReport.Render(
                reporteType,
                deviceInfo.ToString(),
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
        }
예제 #46
0
 /// <summary>
 /// Асинхронно вызывает метод "GetFullReport" службы DomainService.
 /// </summary>
 /// <param name="selectedData">Значение параметра "selectedData" для данного действия.</param>
 /// <param name="Title">Значение параметра "Title" для данного действия.</param>
 /// <param name="dateStart">Значение параметра "dateStart" для данного действия.</param>
 /// <param name="dateEnd">Значение параметра "dateEnd" для данного действия.</param>
 /// <param name="ReportType">Значение параметра "ReportType" для данного действия.</param>
 /// <param name="mbType">Значение параметра "mbType" для данного действия.</param>
 /// <param name="isChart">Значение параметра "isChart" для данного действия.</param>
 /// <param name="isTable">Значение параметра "isTable" для данного действия.</param>
 /// <param name="isExcel">Значение параметра "isExcel" для данного действия.</param>
 /// <param name="reportID">Значение параметра "reportID" для данного действия.</param>
 /// <param name="TitleList">Значение параметра "TitleList" для данного действия.</param>
 /// <param name="DateStartList">Значение параметра "DateStartList" для данного действия.</param>
 /// <param name="DateEndList">Значение параметра "DateEndList" для данного действия.</param>
 /// <param name="MBTypeList">Значение параметра "MBTypeList" для данного действия.</param>
 /// <returns>Экземпляр операции, который может быть использован для управления асинхронным запросом.</returns>
 public InvokeOperation<ReportAnswer> GetFullReport(IEnumerable<string> selectedData, string Title, DateTime dateStart, DateTime dateEnd, ReportTypeEnum ReportType, FullReportMembersType mbType, bool isChart, bool isTable, bool isExcel, Guid reportID, IEnumerable<string> TitleList, IEnumerable<DateTime> DateStartList, IEnumerable<DateTime> DateEndList, IEnumerable<FullReportMembersType> MBTypeList)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("selectedData", selectedData);
     parameters.Add("Title", Title);
     parameters.Add("dateStart", dateStart);
     parameters.Add("dateEnd", dateEnd);
     parameters.Add("ReportType", ReportType);
     parameters.Add("mbType", mbType);
     parameters.Add("isChart", isChart);
     parameters.Add("isTable", isTable);
     parameters.Add("isExcel", isExcel);
     parameters.Add("reportID", reportID);
     parameters.Add("TitleList", TitleList);
     parameters.Add("DateStartList", DateStartList);
     parameters.Add("DateEndList", DateEndList);
     parameters.Add("MBTypeList", MBTypeList);
     this.ValidateMethod("GetFullReport", parameters);
     return ((InvokeOperation<ReportAnswer>)(this.InvokeOperation("GetFullReport", typeof(ReportAnswer), parameters, true, null, null)));
 }