public async Task <ActionResult> StatusUpdate(
            Guid reportId,
            ReportStatusUpdateDto status,
            [FromServices] ReportStatusUpdate updater)
        {
            await updater.StatusUpdate(status.UserId, reportId, status.ReportStatusId, status.Description);

            return(Ok());
        }
        public async Task <ActionResult> ReportStartProgress(
            ReportStartProgressDto progress,
            [FromServices] ReportStatusUpdate updater)
        {
            Guid statusInProgress = Guid.Parse("c37d9588-1875-44dd-8cf1-6781de7533c3");
            await updater.StatusUpdate(progress.UserId, progress.ReportId, statusInProgress, progress.Description);

            return(Ok(progress));
        }
        public async Task <ActionResult> Post(
            ReportInsertDto report,
            [FromServices] ReportStatusUpdate statusUpdater
            )
        {
            Report newReport = _mapper.Map <Report>(report);

            newReport.CreationDate = DateTime.Now;

            var city = await _geolocation.GetCityInfoFromLocation(
                report.Latitude,
                report.Longitude
                );

            IEnumerable <City> cities = new List <City>();

            if (city != null)
            {
                cities = await _cityRepository.Find(
                    c => c.Name.ToLower().Contains(city.Name.ToLower())
                    );
            }

            var cityFromRepo = cities.FirstOrDefault();

            if (cityFromRepo == null)
            {
                NotifyError("As coordenadas informadas não estão cadastradas.");
                return(CustomResponse());
            }

            newReport.CityId       = cityFromRepo.Id;
            newReport.Street       = city.Street;
            newReport.Neighborhood = city.Neighborhood;
            await _service.Add(newReport);

            if (ValidOperation())
            {
                var created = await _repository.GetById(newReport.Id);

                await statusUpdater.StatusUpdate(
                    newReport.UserId,
                    newReport.Id,
                    newReport.ReportStatusId,
                    "Denúncia criada"
                    );

                return(CreatedAtAction(nameof(GetById), new { Id = newReport.Id, Version = "1.0" }, created));
            }

            return(CustomResponse());
        }
Exemplo n.º 4
0
        public void Render(ReportProgressUpdate updateFunc, ReportStatusUpdate doneFunc)
        {
            ArrayList rows   = cacheObj.GetChildArray("ROWS");
            int       rowCnt = rows.Count;

            int r = 0;

            foreach (CTable row in rows)
            {
                r++;
                String    rowType = row.GetFieldValue("ROW_TYPE");
                ArrayList columns = row.GetChildArray("COLUMNS");

                updateFunc(r, rowCnt);

                foreach (CTable column in columns)
                {
                    int     fromCell = CUtil.StringToInt(column.GetFieldValue("FROM_CELL"));
                    int     toCell   = CUtil.StringToInt(column.GetFieldValue("TO_CELL"));
                    Boolean isMerged = column.GetFieldValue("IS_MERGED").Equals("True");

                    Range r1       = xlWorkSheet.Cells[r, fromCell];
                    Range rowRange = null;

                    if (isMerged)
                    {
                        Range r2       = xlWorkSheet.Cells[r, toCell];
                        Range newRange = xlWorkSheet.Range[r1, r2];
                        newRange.Merge();

                        rowRange = newRange;
                        applyCellStyle(column, newRange);
                    }
                    else
                    {
                        rowRange = r1;
                        applyCellStyle(column, r1);
                    }

                    if (rowType.Contains("HEADER"))
                    {
                        rowRange.Interior.Color = ColorTranslator.ToOle(Color.Orange);
                    }
                    else if (rowType.Contains("FOOTER"))
                    {
                        rowRange.Interior.Color = ColorTranslator.ToOle(Color.Tan);
                    }
                }
            }

            doneFunc(true, false);
        }
        public async Task <ActionResult> ReportStartProgress(
            ReportEndProgressDto progress,
            [FromServices] ReportStatusUpdate updater)
        {
            Guid statusInProgress = Guid.Parse("ee6dda1a-51e2-4041-9d21-7f5c8f2e94b0");
            await updater.StatusUpdate(progress.UserId, progress.ReportId, statusInProgress, progress.Description);

            var inProgress = await _reportInProgressService.GetByReportId(progress.ReportId);

            inProgress.DoneDate    = progress.EndDate;
            inProgress.OwnerUserId = progress.UserId;
            await _reportInProgressService.Update(inProgress);

            return(Ok(progress));
        }
Exemplo n.º 6
0
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            if (Parameter.GetFieldValue("COSTING_TYPE").Equals("MOVE"))
            {
                Parameter.SetFieldValue("DOCUMENT_TYPE", "3");
            }
            ArrayList arr = OnixWebServiceAPI.GetInventoryTransactionList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            #region First Header Case : Row is 0
            if (arr.Count == 0)
            {
                arr.Add(Parameter); //add for show header and first row empty
            }
            #endregion
            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
Exemplo n.º 7
0
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            ArrayList arr = OnixWebServiceAPI.GetCashAccountList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
Exemplo n.º 8
0
 public void SetProgressDoneFunc(ReportStatusUpdate func)
 {
     updateDoneFunc = func;
 }
Exemplo n.º 9
0
        public virtual FixedDocument CreateReportFixedDocument()
        {
            excel = new CExcelRenderer(rptCfg.ReportName);
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            ArrayList arr = getRecordSet();

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            excel.CalculateMergeCellRange(baseTemplateName);

            int i = 0;
            int r = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((r == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    area = initNewArea(areaSize);
                    fp.Children.Add(area);

                    if (isInRange(CurrentPage))
                    {
                        fd.Pages.Add(pageContent);
                        pages.Add(area);
                    }
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                    r--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
                r++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            ArrayList arr = OnixWebServiceAPI.GetInventoryBalanceSummaryList(Parameter);

            //string orderArr = string.Empty;
            //foreach (CTable o in arr)
            //{
            //    orderArr += o.GetFieldValue("ITEM_NAME_THAI");
            //    orderArr += "," + o.GetFieldValue("ITEM_ID");
            //    orderArr += "," + o.GetFieldValue("DESCRIPTION");
            //    orderArr += "," + o.GetFieldValue("LOCATION_ID");
            //    orderArr += "," + o.GetFieldValue("BALANCE_DATE");
            //    orderArr += "\n";
            //}
            //MessageBox.Show(orderArr);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                    if (property.TempNotRowDetails > 0)
                    {
                        ConstructUIRows(area, property);
                    }
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }
                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }