/// <summary> /// todoComment /// </summary> /// <returns></returns> protected Boolean Calculate() { this.Results.Clear(); if (Parameters.Exists("calculateFromMethod")) { if (!CalculateFromMethod(Parameters.Get("calculateFromMethod").ToString())) { TLogging.Log("ERROR: could not calculate from method (or report was cancelled)."); return(false); } } else { TRptDataCalcHeaderFooter calcHeaderFooter = new TRptDataCalcHeaderFooter(this, -1, -1, 0, 0); calcHeaderFooter.Calculate(CurrentReport.pagefield, CurrentReport.pageswitch); InitColumnCaptions(); TRptDataCalcLevel calclevel = new TRptDataCalcLevel(this, 0, -1, 0, 0); if ((calclevel.Calculate(CurrentReport.GetLevel("main"), 0) == -1) || (Parameters.Get("CancelReportCalculation").ToBool() == true)) { TLogging.Log("ERROR: could not calculate main level (or report was cancelled)."); return(false); } InitColumnLayout(); } // call after calculating, because new parameters will be added InitDetailReports(); return(true); }
public async Task <IActionResult> GetSingleCurrentReport(int spotId) { // create a new instance of the buoy finder class BuoyFinder buoyFinder = new BuoyFinder(); // find the beach requested Beach beach = _context.Beach.Single(b => b.BeachId == spotId); // find buoys closest to the beach List <Buoy> matchingBuoys = buoyFinder.MatchBuoys(beach.Latitude, beach.Longtitude); // create an empty list to hold beach reports List <CurrentBeachReport> currentBeachReports = new List <CurrentBeachReport>(); // itterate through the matching buoys. // this loop will populate our currentBeachReports list foreach (Buoy b in matchingBuoys) { // generate report for current buoy CurrentReport currentReport = await MakeCurrentReport.GetAsync(b); // create beach report with buoy report data and beach data CurrentBeachReport currentBeachReport = new CurrentBeachReport(beach, currentReport); // add beach report to the list currentBeachReports.Add(currentBeachReport); } // return the report data return(Ok(currentBeachReports)); }
public static async Task <CurrentReport> GetAsync(Buoy buoy) { CurrentReport currentReport = new CurrentReport(buoy.Name, buoy.NbdcId); SpecData specData = new SpecData(); string buoyStandardId = (buoy.NbdcId).ToUpper() + ".txt"; string buoySpecId = (buoy.NbdcId).ToUpper() + ".spec"; string standardReportText = await GetBuoyData.FetchAsync(buoyStandardId); string spectralReportText = await GetBuoyData.FetchAsync(buoySpecId); string firstCharSpec = (spectralReportText[0]).ToString(); string firstCharStandard = (standardReportText[0].ToString()); StandardData standardReport = ParseCurrentStandard.Get(standardReportText, buoy.NbdcId); if (firstCharSpec != "<" && firstCharStandard != "<") { specData = ParseCurrentSpec.Get(spectralReportText, buoy.NbdcId); currentReport = new CurrentReport(buoy.Name, buoy.NbdcId, standardReport, specData); } else if (firstCharStandard != "<") { currentReport = new CurrentReport(buoy.Name, buoy.NbdcId, standardReport); } return(currentReport); }
public async Task <IActionResult> GetClosestCurrentReport(string lat, string lon) { // create new instances of bouyFinder and spotFinder classes BuoyFinder buoyFinder = new BuoyFinder(); SpotFinder spotFinder = new SpotFinder(); // get the closest beach by using the lat/long passed in by the user Beach closestSpot = spotFinder.FindSpot(lat, lon); // get a list of buoys that are close to the beach List <Buoy> matchingBuoys = buoyFinder.MatchBuoys(closestSpot.Latitude, closestSpot.Longtitude); // create empty list for hold current beach reports List <CurrentBeachReport> currentBeachReports = new List <CurrentBeachReport>(); // itterate through the list of buoys foreach (Buoy b in matchingBuoys) { // get report from current buoy CurrentReport currentReport = await MakeCurrentReport.GetAsync(b); // compile data from closestSpot object and currentReport object into // currentBeachReport object with contructor function CurrentBeachReport currentBeachReport = new CurrentBeachReport(closestSpot, currentReport); // add beach report object to list currentBeachReports.Add(currentBeachReport); } // return reports return(Ok(currentBeachReports)); }
/// <summary> /// 将报表转换成图片 /// </summary> /// <returns></returns> public Image ConvertReportToImage() { Stream imageStream = new MemoryStream(); _currentReport.DataSource = _ds; CurrentReport.ExportToImage(imageStream, ImageFormat.Png); return(Image.FromStream(imageStream)); }
private void Next() { if (_valuePane.CurrentFailure == null) { return; } int skipped = 0; int updated = 0; try { while (CurrentReport.Next()) { var next = CurrentReport.Current; //prefer rules that say we should update the database with redacted over rules that say we should ignore the problem if (!Updater.OnLoad(null, next, out _)) { updated++; } else if (!Ignorer.OnLoad(next, out _)) { skipped++; } else { SetupToShow(next); break; } } } catch (Exception e) { ShowException("Error moving to next record", e); } if (CurrentReport.Exhausted) { ShowMessage("End", "End of Failures"); } StringBuilder info = new StringBuilder(); info.Append(CurrentReport.DescribeProgress()); if (skipped > 0) { info.Append(" Skipped " + skipped); } if (updated > 0) { info.Append(" Auto Updated " + updated); } _info.Text = info.ToString(); }
public async Task <IActionResult> GetCurrentBuoyData(string nbdcId) { // retreive buoy information from database Buoy buoy = _context.Buoy.Single(b => b.NbdcId == nbdcId); // use buoy data to retreive current report data CurrentReport currentReport = await MakeCurrentReport.GetAsync(buoy); // return current report return(Ok(currentReport)); }
private void GoTo(int page) { if (CurrentReport == null) { return; } try { CurrentReport.GoTo(page); _info.Text = CurrentReport.DescribeProgress(); SetupToShow(CurrentReport.Current); } catch (Exception e) { ShowException("Failed to GoTo", e); } }
public override void update() { CswNbtMetaDataNodeType ReportsNodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Report" ); if( null != ReportsNodeType ) { foreach( CswNbtObjClassReport CurrentReport in ReportsNodeType.getNodes( false, true ) ) { if( "Deficient Inspections" == CurrentReport.NodeName ) { CurrentReport.ReportName.Text = "Deficient Inspections (Demo)"; CurrentReport.IsDemo = true; CurrentReport.postChanges( true ); break; } } } } // update()
public async Task <IActionResult> GetClosestCurrentReports(string lat, string lon, int spotCount) { // create new instances of spot finder and buoy finder classes SpotFinder spotFinder = new SpotFinder(); BuoyFinder buoyFinder = new BuoyFinder(); // create empty lists to hold matched buoys, currentBeachReports // and matchedBuoyReports List <Buoy> matchedBuoys = new List <Buoy>(); List <CurrentReport> matchedBuoyReports = new List <CurrentReport>(); List <CurrentBeachReport> currentBeachReport = new List <CurrentBeachReport>(); // get the list of spots corresponding to user location and spotCount int List <SpotDistanceFromUser> spotsWithUserDistance = spotFinder.FindSpots(lat, lon, spotCount); // itterate through objects containing // beach info and distance from users location. // This loop will populate the matchedBuoys list // with buoys near the users location foreach (SpotDistanceFromUser obj in spotsWithUserDistance) { // get lat and long for current beach string beachLat = obj.Beach.Latitude; string beachLon = obj.Beach.Longtitude; // get a list of buoys that are within range of the current beach List <Buoy> matchingBuoys = buoyFinder.MatchBuoys(beachLat, beachLon); // itterate through the matching buoys foreach (Buoy b in matchingBuoys) { // add current buoy to list of matched buoys matchedBuoys.Add(b); } } // using linq statements, eliminate duplicate buoys. // this groups the buoys their id, then selects only // one buoy if there are multiple buoys with the same id. matchedBuoys = matchedBuoys.GroupBy(mb => mb.BuoyId).Select(mb => mb.First()).ToList(); // itterate through the list of buoys close to the user. // this loop populates the list of matched buoy reports foreach (Buoy b in matchedBuoys) { // get the report for the current buoy CurrentReport currentReport = await MakeCurrentReport.GetAsync(b); // add report to list matchedBuoyReports.Add(currentReport); } // itterate again through the list of beaches close to the user. // This loop will populate our currentBeachReport list. This logic is // executed independently of the first itteration of this list to avoid // making duplicate http calls for buoys foreach (SpotDistanceFromUser obj in spotsWithUserDistance) { // get lat and long of current beach string beachLat = obj.Beach.Latitude; string beachLon = obj.Beach.Longtitude; // get buoys in proximity of beach List <Buoy> matchingBuoys = buoyFinder.MatchBuoys(beachLat, beachLon); // itterate through the list of buoy reports foreach (CurrentReport r in matchedBuoyReports) { // itterate through the list of matching buoys foreach (Buoy b in matchingBuoys) { // if a buoy report matches one of the buoys in user proximity... if (r.NbdcId == b.NbdcId) { // create a new currentBeachReport Object and return it CurrentBeachReport report = new CurrentBeachReport(obj.Beach, r); currentBeachReport.Add(report); } } } } return(Ok(currentBeachReport)); }
private void ReportLoad() { rptViewer.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = rptViewer.ServerReport; serverReport.ReportServerUrl = new Uri(SystemConfigurations.Settings_ReportingServiceConfigurations.ReportServerURL); serverReport.ReportServerCredentials = new ReportingServiceCredentials(); serverReport.ReportPath = SystemConfigurations.Settings_ReportingServiceConfigurations.ReportFolderPath + CurrentReport.ToString(); List <ReportParameter> parameters = SetReportPramter(); // Set the report parameters for the report rptViewer.ServerReport.SetParameters(parameters); dvReport.Visible = true; rptViewer.DataBind(); rptViewer.ServerReport.Refresh(); }
internal static void LoadCurrentReport() { Damocles2Entities de = new Damocles2Entities(); //TODO: Maybe this should be a Static? CurrentReport ce = de.CurrentReports.Where(cr => cr.ReportProcessed == false).FirstOrDefault(); if (ce == null) // Generate New Report { return; } if (!string.IsNullOrEmpty(ce.ImagePath)) { Reporting.CurrentInternalReport.ImagePath = ce.ImagePath; } if (!string.IsNullOrEmpty(ce.LinkUrl)) { Reporting.CurrentInternalReport.LinkUrl = ce.LinkUrl; } Reporting.CurrentInternalReport.LinkUrlARCXRating = (Reporting.CurrentInternalReport.ARCXRating)ce.LinkUrlARCXRating; if (!string.IsNullOrEmpty(ce.LinkUrlFilename)) { Reporting.CurrentInternalReport.LinkUrlFilename = ce.LinkUrlFilename; } if (!string.IsNullOrEmpty(ce.LinkUrl)) { Reporting.CurrentInternalReport.LinkUrl = ce.LinkUrl; } Reporting.CurrentInternalReport.LinkUrlARCXRating = (Reporting.CurrentInternalReport.ARCXRating)ce.LinkUrlARCXRating; if (!string.IsNullOrEmpty(ce.LinkUrlFilename)) { Reporting.CurrentInternalReport.LinkUrlFilename = ce.LinkUrlFilename; } if (!string.IsNullOrEmpty(ce.LinkUrlHash)) { Reporting.CurrentInternalReport.LinkUrlHash = ce.LinkUrlHash; } if (!string.IsNullOrEmpty(ce.PageUrl)) { Reporting.CurrentInternalReport.PageUrl = ce.PageUrl; } if (!string.IsNullOrEmpty(ce.PageUrlFilename)) { Reporting.CurrentInternalReport.PageUrlFilename = ce.PageUrlFilename; } if (!string.IsNullOrEmpty(ce.PageUrlHash)) { Reporting.CurrentInternalReport.PageUrlHash = ce.PageUrlHash; } Reporting.CurrentUser.UserId = ce.ProcessingBy; Reporting.CurrentInternalReport.ReportedBy = ce.ReportedBy; Reporting.CurrentInternalReport.ReportedOn = ce.ReportedOn; Reporting.CurrentInternalReport.ReportNumber = ce.ReportNumber; Reporting.CurrentInternalReport.ReportSessionTime = ce.ReportSessionTime; if (!string.IsNullOrEmpty(ce.SrcUrl)) { Reporting.CurrentInternalReport.SrcUrl = ce.SrcUrl; } Reporting.CurrentInternalReport.SrcUrlARCXRating = (Reporting.CurrentInternalReport.ARCXRating)ce.SrcUrlARCXRating; if (!string.IsNullOrEmpty(ce.SrcUrlFilename)) { Reporting.CurrentInternalReport.SrcUrlFilename = ce.SrcUrlFilename; } if (!string.IsNullOrEmpty(ce.SrcUrlHash)) { Reporting.CurrentInternalReport.SrcUrlHash = ce.SrcUrlHash; } if (!string.IsNullOrEmpty(ce.TrueLinkUrl)) { Reporting.CurrentInternalReport.TrueLinkUrl = ce.TrueLinkUrl; } if (!string.IsNullOrEmpty(ce.TrueLinkUrlFilename)) { Reporting.CurrentInternalReport.TrueLinkUrlFilename = ce.TrueLinkUrlFilename; } if (!string.IsNullOrEmpty(ce.TrueLinkUrlHash)) { Reporting.CurrentInternalReport.TrueLinkUrlHash = ce.TrueLinkUrlHash; } }
internal static void SaveCurrentReport() { bool update = false; Damocles2Entities de = new Damocles2Entities(); //TODO: Maybe this should be a Static? CurrentReport ce = de.CurrentReports.Where(cr => cr.ReportNumber == Reporting.CurrentInternalReport.ReportNumber).FirstOrDefault(); if (ce == null) // Generate New Report { ce = new CurrentReport(); ce.ReportStartedOn = DateTime.UtcNow; } else { update = true; ce.UpdatedOn = DateTime.UtcNow; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.ImagePath)) { ce.ImagePath = Reporting.CurrentInternalReport.ImagePath; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.LinkUrl)) { ce.LinkUrl = Reporting.CurrentInternalReport.LinkUrl; } ce.LinkUrlARCXRating = (int)Reporting.CurrentInternalReport.LinkUrlARCXRating; if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.LinkUrlFilename)) { ce.LinkUrlFilename = Reporting.CurrentInternalReport.LinkUrlFilename; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.LinkUrl)) { ce.LinkUrl = Reporting.CurrentInternalReport.LinkUrl; } ce.LinkUrlARCXRating = (int)Reporting.CurrentInternalReport.LinkUrlARCXRating; if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.LinkUrlFilename)) { ce.LinkUrlFilename = Reporting.CurrentInternalReport.LinkUrlFilename; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.LinkUrlHash)) { ce.LinkUrlHash = Reporting.CurrentInternalReport.LinkUrlHash; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.PageUrl)) { ce.PageUrl = Reporting.CurrentInternalReport.PageUrl; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.PageUrlFilename)) { ce.PageUrlFilename = Reporting.CurrentInternalReport.PageUrlFilename; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.PageUrlHash)) { ce.PageUrlHash = Reporting.CurrentInternalReport.PageUrlHash; } ce.ProcessingBy = Reporting.CurrentUser.UserId; ce.ReportedBy = Reporting.CurrentInternalReport.ReportedBy; ce.ReportedOn = Reporting.CurrentInternalReport.ReportedOn; if (Reporting.CurrentInternalReport.Completed) { ce.ReportEndedOn = DateTime.UtcNow; } ce.ReportNumber = Reporting.CurrentInternalReport.ReportNumber; ce.ReportProcessed = Reporting.CurrentInternalReport.Completed; ce.ReportSessionTime = Reporting.CurrentInternalReport.ReportSessionTime; if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.SrcUrl)) { ce.SrcUrl = Reporting.CurrentInternalReport.SrcUrl; } ce.SrcUrlARCXRating = (int)Reporting.CurrentInternalReport.SrcUrlARCXRating; if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.SrcUrlFilename)) { ce.SrcUrlFilename = Reporting.CurrentInternalReport.SrcUrlFilename; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.SrcUrlHash)) { ce.SrcUrlHash = Reporting.CurrentInternalReport.SrcUrlHash; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.TrueLinkUrl)) { ce.TrueLinkUrl = Reporting.CurrentInternalReport.TrueLinkUrl; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.TrueLinkUrlFilename)) { ce.TrueLinkUrlFilename = Reporting.CurrentInternalReport.TrueLinkUrlFilename; } if (!string.IsNullOrEmpty(Reporting.CurrentInternalReport.TrueLinkUrlHash)) { ce.TrueLinkUrlHash = Reporting.CurrentInternalReport.TrueLinkUrlHash; } if (!update) { de.CurrentReports.Add(ce); } de.SaveChanges(); //TODO: Probably should be using Asynchronous calls for all these }