public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, [Inject] IMergeManager mergeManager, [Inject] ILogger <IMergeManager> logger) { logger.LogInformation("Azure Function ExecuteMerge processed a request."); try { dynamic data = await req.Content.ReadAsAsync <object>(); string datastring = data.ToString(); //this data had better be serializable to TranformResultsContainer TransformResultsContainer trc = JsonConvert.DeserializeObject <TransformResultsContainer>(datastring); MergeResultsContainer mrc = mergeManager.MergeAll(trc); var response = req.CreateResponse(HttpStatusCode.OK, mrc); return(response); } catch (System.Exception ex) { logger.LogError(ex, $"Error in Azure Function ExecuteMerge : {ex.Message}"); var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); return(response); } }
public FolderMonitor(IFileManager fileManager, IMergeManager mergeManager) { string inputFilesFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "files"); _filesDirectory = Directory.CreateDirectory(inputFilesFolder); _fileManager = fileManager; _mergeManager = mergeManager; }
public WaterContext( double[,] heightmap, IPropagateManager propagator, IMergeManager mergeManager, IAbsorptionManager absorptionManager) { _heightmap = heightmap; _propagator = propagator; _mergeManager = mergeManager; _absorptionManager = absorptionManager; }
public void Run() { try { Stopwatch stopwatchFull = Stopwatch.StartNew(); _logger.LogInformation($"{nameof(Application)}.{nameof(Run)} execution invoked"); _importValidator = _serviceProvider.GetService <IImportValidator>(); _typeListValidator = _serviceProvider.GetService <ITypeListValidator>(); _importManager = _serviceProvider.GetService <IImportManager>(); _importStorageProvider = _serviceProvider.GetService <IImportStorageProvider>(); _transformManager = _serviceProvider.GetService <ITransformManager>(); _transformStorageProvider = _serviceProvider.GetService <ITransformStorageProvider>(); _mergeManager = _serviceProvider.GetService <IMergeManager>(); _mergeStorageProvider = _serviceProvider.GetService <IMergeStorageProvider>(); //uncomment below to actually run import and transform stages - file based string formattedDateString = DateTime.UtcNow.ToString(DateFormatSpecifier); //Import Stopwatch stopwatchImport = Stopwatch.StartNew(); string failureInfo; //Before we take the overhead of downloading all the import data, check that the data has the right overall structure bool isDataSourceValid = _importValidator.TryValidateDataSource(out failureInfo); if (!isDataSourceValid) { _logger.LogWarning("Enlir Import Data not in Expected Format: \n" + failureInfo); throw new ValidationException("Enlir Import Data not in Expected Format: \n" + failureInfo); } ImportResultsContainer importResultsContainer = _importManager.ImportAll(); string importStoragePath = _importStorageProvider.StoreImportResults(importResultsContainer, formattedDateString); stopwatchImport.Stop(); //cheat data setup for testing - comment out when doing full run for real //string importStoragePath = @"D:\Temp\FFRKApi\ImportResults-2018-12-21_09-48-46.json"; //string transformStoragePath = @"D:\Docs\Personal\FFRKLinqQuery\TransformResults-Latest.json"; //string formattedDateString = "2018-12-21_09-48-46"; //string importContents = File.ReadAllText(importStoragePath); //ImportResultsContainer importResultsContainer = JsonConvert.DeserializeObject<ImportResultsContainer>(importContents); ////Now that we have the import data, we need to check whether our TypeLists (used to convert staring data into ids) ////is still accurate. If the source data has changed their list of values for each type, we need to stop and correct the TypeLists IEnumerable <TypeListDifferences> typeListDifferences = _typeListValidator.TryValidateTypeLists(importResultsContainer); if (typeListDifferences.Any(t => t.IsIdListDifferentFromSource)) { _logger.LogWarning("Enlir TypeList Data differs from coded TypeLists."); //write validation failure data to log for easy perusal string typeListDifferencesLogPath = $"{AppContext.BaseDirectory}\\TypeListDifferencesLog.json"; string typeListDifferencesLogContents = JsonConvert.SerializeObject(typeListDifferences); File.WriteAllText(typeListDifferencesLogPath, typeListDifferencesLogContents); _logger.LogWarning("Enlir TypeList differences written to file: " + typeListDifferencesLogPath); throw new ValidationException("Enlir Type List Data differs from coded TypeLists"); } //Transform Stopwatch stopwatchTransform = Stopwatch.StartNew(); TransformResultsContainer transformResultsContainer = _transformManager.TransformAll(importStoragePath); string transformStoragePath = _transformStorageProvider.StoreTransformResults(transformResultsContainer, formattedDateString); stopwatchTransform.Stop(); //Merge Stopwatch stopwatchMerge = Stopwatch.StartNew(); MergeResultsContainer mergeResultsContainer = _mergeManager.MergeAll(transformStoragePath); string mergeStoragePath = _mergeStorageProvider.StoreMergeResults(mergeResultsContainer, formattedDateString); stopwatchMerge.Stop(); //test merge storage MergeResultsContainer testMergeResultsContainer = _mergeStorageProvider.RetrieveMergeResults(mergeStoragePath); stopwatchFull.Stop(); _logger.LogInformation("Import Completed in {ImportTime} seconds", stopwatchImport.Elapsed.Seconds); _logger.LogInformation("Transform Completed in {TransformTime} seconds", stopwatchTransform.Elapsed.Seconds); _logger.LogInformation("Merge Completed in {MergeTime} seconds", stopwatchMerge.Elapsed.Seconds); _logger.LogInformation("Full Run Completed in {FullRunTime} seconds", stopwatchFull.Elapsed.Seconds); int aggregateTime = stopwatchImport.Elapsed.Seconds + stopwatchMerge.Elapsed.Seconds + stopwatchFull.Elapsed.Seconds; _logger.LogInformation("Full Run Aggregate Time in {AggregateTime} seconds", aggregateTime); } catch (Exception ex) { _logger.LogError(ex, ex.Message); _logger.LogInformation("Error in Top Level Application execution. Validate, Import, Transform, and Merge operations were NOT successfully completed. Previously existing data is unchanged"); throw; } }
/// <summary> /// Initializes a new instance of a <see cref="T:C1.WPF.FlexGrid.C1FlexGrid" />. /// </summary> public C1FlexGrid() { DefaultStyleKey = typeof (C1FlexGrid); _mouseHandler = new MouseHandler(this); SelectionHandler = new SelectionHandler(this); _editHandler = new EditHandler(this); _mergeManager = new MergeManager(); _addNewHandler = new AddNewHandler(this); _kbdHandler = new KeyboardHandler(this); Cells = new GridPanel(this, CellType.Cell, ROWHEIGHT, COLWIDTH); ColumnHeaders = new GridPanel(this, CellType.ColumnHeader, ROWHEIGHT, COLWIDTH); ColumnHeaders.Columns = Cells.Columns; RowHeaders = new GridPanel(this, CellType.RowHeader, ROWHEIGHT, COLWIDTH); RowHeaders.Rows = Cells.Rows; TopLeftCells = new GridPanel(this, CellType.TopLeft, ROWHEIGHT, COLWIDTH); TopLeftCells.Rows = ColumnHeaders.Rows; TopLeftCells.Columns = RowHeaders.Columns; ColumnFooters = new GridPanel(this, CellType.ColumnFooter, ROWHEIGHT, COLWIDTH); ColumnFooters.Columns = Cells.Columns; BottomLeftCells = new GridPanel(this, CellType.BottomLeft, ROWHEIGHT, COLWIDTH); BottomLeftCells.Rows = ColumnFooters.Rows; BottomLeftCells.Columns = RowHeaders.Columns; _gridPanelArray = new[] {ColumnHeaders, RowHeaders, Cells, TopLeftCells, ColumnFooters, BottomLeftCells}; ICellFactory cellFactory = GetCellFactory(); _botRight = cellFactory.CreateCell(this, CellType.BottomRight, CellRange.Empty); ColumnHeaders.Rows.Add(new Row()); RowHeaders.Columns.Add(new Column()); _canvas = new Canvas(); _canvas.Clip = new RectangleGeometry(); Marquee = new Rectangle(); Marquee.IsHitTestVisible = false; Marquee.StrokeThickness = 2; Marquee.Stroke = Brushes.Black; Marquee.Visibility = Visibility.Collapsed; _canvas.Children.Add(Marquee); _lnFX = new Line(); _lnFX.Visibility = Visibility.Collapsed; _lnFX.StrokeThickness = FROZEN_LINE_WIDTH; _canvas.Children.Add(_lnFX); _lnFY = new Line(); _lnFY.Visibility = Visibility.Collapsed; _lnFY.StrokeThickness = FROZEN_LINE_WIDTH; _canvas.Children.Add(_lnFY); ErrorStyle = new CellStyle(); ErrorStyle.BorderBrush = _errorBorderBrush; ErrorStyle.BorderThickness = new Thickness(1); ErrorStyle.CornerRadius = new CornerRadius(2); Rows.CollectionChanged += (s, e) => { if (ItemsSource == null) { UpdateAggregates(null, false); } }; LayoutUpdated += (s, e) => { if (!ReferenceEquals(Foreground, _lastForeground)) { _lastForeground = Foreground; Invalidate(); return; } if (ViewRange.IsValid && Rows.Count > 0 && Columns.Count > 0 && Cells.IsEmpty() && Rows.GetTotalSize() > 0 && Columns.GetTotalSize() > 0) { InvalidateMeasure(); } }; FocusVisualStyle = null; // bool checkLicense = true; // try // { // string fullName = Assembly.GetCallingAssembly().FullName; // if (fullName.ToLower().StartsWith("c1.wpf.olap") && fullName.EndsWith("PublicKeyToken=2aa4ec5576d6c3ce")) // { // checkLicense = false; // _skipLicenseCheck = true; // } // else if (_skipLicenseCheck) // { // checkLicense = false; // } // } // catch // { // } // if (checkLicense) // { // lock (typeof (C1FlexGrid)) // { // ProviderInfoWPF.Validate(typeof (C1FlexGrid), this, true); // } // } }