private static void DoIt() { var queryStopwatch = new Stopwatch(); queryStopwatch.Start(); var result = DataReader.GetQueryResults(); queryStopwatch.Stop(); Logger.Info($"Query results : {queryStopwatch.Elapsed.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)} milliseconds."); var expandingStopwatch = new Stopwatch(); expandingStopwatch.Start(); var expandedResults = ExecutionResultExpander.ComputeBuildInColumns(result); expandingStopwatch.Stop(); Logger.Info($"Columns expanding : {expandingStopwatch.Elapsed.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)} milliseconds."); var dataMerger = DataMergerFactory.GetDataMerger(DataMergerType.Conservative); var mergeStopwatch = new Stopwatch(); mergeStopwatch.Start(); var mergedResults = dataMerger.MergeResults(expandedResults); mergeStopwatch.Stop(); Logger.Info($"Merged results with {dataMerger.Name} : {mergeStopwatch.Elapsed.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)} milliseconds."); var exporter = ExporterFactory.GetExporter(Parameters.Instance.Exporter); var excelGenerationStopwatch = new Stopwatch(); excelGenerationStopwatch.Start(); exporter.Generate(mergedResults); excelGenerationStopwatch.Stop(); Logger.Info($"{exporter.Name} generation : {excelGenerationStopwatch.Elapsed.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)} milliseconds."); }
private void cmdExport_Click(object sender, System.EventArgs e) { CFile export; ExportRow.ExportRowList rows = new ExportRow.ExportRowList(); int courseID = GetCourseID(); Users userda = new Users(Globals.CurrentIdentity); User.UserList users = GetUserSet(GetSectionID(), GetCourseID()); //Add rows rows.Add(userda.GetCourseExportHeading(courseID)); foreach (User user in users) { rows.Add(userda.GetCourseExport(user.UserName, courseID)); } //Do export try { IExporter exporter = (IExporter)ExporterFactory.GetInstance().CreateItem(ddlExportFormat.SelectedItem.Value); export = exporter.Export(new FileSystem(Globals.CurrentIdentity), rows); } catch (CustomException er) { PageExportError(er.Message); return; } //Setup d/l link lnkExport.Attributes.Clear(); lnkExport.Attributes.Add("onClick", @"window.open('Controls/Filesys/dlfile.aspx?FileID=" + export.ID + @"', '" + export.ID + @"', 'width=770, height=580')"); lnkExport.Visible = true; }
private void btnCsv_Click(object sender, EventArgs e) { ExporterFactory exporterFactory = new ExporterFactory(); Exporter exporterCsv = exporterFactory.getExporter("CSV"); exporterCsv.export(); }
public IExporter GetExporter() { TreeIter iter; exportFormatComboBox.GetActiveIter(out iter); return(ExporterFactory.GetExporter((string)m_formats.GetValue(iter, 0))); }
private void button7_Click(object sender, EventArgs e) { ExporterFactory exporterFactory = new ExporterFactory(); Exporter exporterJSON = exporterFactory.getExporter("JSON"); exporterJSON.export(); MessageBox.Show("Export cu succes"); }
private static int Process(string fileName, bool verbose) { using (var exporter = ExporterFactory.Create(LoggingService, GetConfiguration(fileName, verbose), verbose)) { exporter.Export(); } return(0); }
private void BindExporters() { string[] exporters = ExporterFactory.GetInstance().ListKeys(); ddlExportFormat.Items.Clear(); foreach (string exporter in exporters) { ddlExportFormat.Items.Add(new ListItem(exporter, exporter)); } }
public ActionResult Export(String exporterType) { ExporterFactory exporterFactory = new ExporterFactory(); Exporter exporter = exporterFactory.getExporter(exporterType); exporter.export(); // MessageBox.Show("Export cu succes"); // return View(); return(View()); }
public MainController( IEmployeeStorage employeeStorage, IEmployeeManager employeeManager, IEmployeeSearcher searcher, ExporterFactory exporterFactory) { this.employeeStorage = employeeStorage; this.employeeManager = employeeManager; this.searcher = searcher; this.exporterFactory = exporterFactory; }
public void AwakeFromNib() { while (exportTypePopUpButton.ItemArray.Count > 0) { exportTypePopUpButton.RemoveItemAtIndex(0); } foreach (string name in ExporterFactory.GetExporterNames()) { exportTypePopUpButton.AddItemWithTitle(name); } }
private static Task SaveModpacksAsync() { var factory = new ExporterFactory(); int id = 0; var modMappings = new Dictionary <Mod, int>(); foreach (var modManager in Manager.ModManagers) { foreach (var mod in modManager) { // Assign an ID to every mod (note we do actually want reference equality here) modMappings.Add(mod, id); var modDef = new ModDefinition(id, mod.Name, ExportMode.SpecificVersion, mod.Version); factory.ModDefinitions.Add(modDef); id++; } } var modpackMappings = _modpacks.Swap(); // Safe here since both directions are unique foreach (var modpack in Modpacks) { var modIds = new List <int>(); var modpackIds = new List <int>(); foreach (var child in modpack) { if (child is Mod mod) { int modId = modMappings[mod]; modIds.Add(modId); } else if (child is Modpack subPack) { int packId = modpackMappings[subPack]; modpackIds.Add(packId); } } var packDef = new ModpackDefinition(modpackMappings[modpack], modpack.DisplayName, modIds, modpackIds); factory.ModpackDefinitions.Add(packDef); } var exporter = factory.CreateExporter(); string path = Path.Combine(ApplicationDataDirectory.FullName, "modpacks.json"); return(exporter.ExportAsync(path)); }
/// <summary> /// Loads the Traffic Viewer extensions /// </summary> public void LoadExtensions() { SdkSettings.Instance.ExtensionInfoList = TrafficViewerOptions.Instance.GetExtensionInfo(); //load modules TrafficParserFactory parserFactory = new TrafficParserFactory(); _trafficParsers = parserFactory.GetExtensions(); ExporterFactory exporterFactory = new ExporterFactory(); _trafficExporters = exporterFactory.GetExtensions(); AnalysisModulesFactory analysisModulesFactory = new AnalysisModulesFactory(); _analysisModules = analysisModulesFactory.GetExtensions(); ExploiterFactory exploitersFactory = new ExploiterFactory(); _exploiters = exploitersFactory.GetExtensions(); SenderFactory senderFactory = new SenderFactory(); _senders = senderFactory.GetExtensions(); HttpClientExtensionFactory clientFactoryLoader = new HttpClientExtensionFactory(); _httpClientFactoryList = clientFactoryLoader.GetExtensions(); _httpClientFactoryList.Add(new WebRequestClientFactory()); _httpClientFactory = null; //find in the list of client factories the one with the name specified in options foreach (IHttpClientFactory clientFactory in _httpClientFactoryList) { if (String.Compare(clientFactory.ClientType, TrafficViewerOptions.Instance.HttpClientName) == 0) { _httpClientFactory = clientFactory; break; } } if (_httpClientFactory == null) { //if the factory was not found use the default _httpClientFactory = new TrafficViewerHttpClientFactory(); //log a warning SdkSettings.Instance.Logger.Log(TraceLevel.Warning, "Could not find HTTP client factory for {0}", TrafficViewerOptions.Instance.HttpClientName); TrafficViewerOptions.Instance.HttpClientName = _httpClientFactory.ClientType; } HttpProxyFactory proxyFactory = new HttpProxyFactory(); _httpProxyFactoryList = proxyFactory.GetExtensions(); }
private void SaveMeasurement(object sender, RoutedEventArgs e) { if (measurement != null) { MeasurementExporterDialog dialog = new MeasurementExporterDialog(); dialog.ExporterFilter = ExporterFactory <Measurement> .GetAllExporters(); dialog.Dialog.ShowDialog(); Exporter <Measurement> exporter = dialog.GetExporter(); if (exporter != null) { exporter.Export(measurement); } } }
public void TestHeader() { IExporter <TestClass> exporter = ExporterFactory.CreateExporter <TestClass>(); string header = exporter.GetHeader(); Assert.IsNotNull(header, "No header found"); string[] headerEntries = header.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); Assert.IsNotNull(headerEntries, "No headerentries found"); var orderedProperties = typeof(TestClass).GetProperties().Select(x => x.Name).OrderBy(x => x).ToArray(); Assert.IsTrue(headerEntries.Length == orderedProperties.Length, "Wrong number of properties"); for (int i = 0; i < headerEntries.Length; i++) { Assert.IsTrue(headerEntries[i] == orderedProperties[i], $"Wrong order! Value: {headerEntries[i]} Expected: {orderedProperties[i]}"); } Console.WriteLine(header); }
private void Recompute() { UpdateAndCheckFoldings(); try { Stream stream = new MemoryStream(); Exporter exporter = ExporterFactory.GetExporterByName(cbFileFormat.SelectedItem.ToString()); exporter.PositionCoordinateMode = cbCoordinates.SelectedIndex == 1 ? Exporter.CoordinateMode.CM_COG : Exporter.CoordinateMode.CM_CORNER; exporter.Export(Analysis, ref stream); using (StreamReader reader = new StreamReader(stream)) textEditorControl.Text = reader.ReadToEnd(); } catch (Exception ex) { _log.Error(ex.Message); } }
public ExportDialog() { this.Build(); m_formats = new ListStore(typeof(string)); foreach (string name in ExporterFactory.GetExporterNames()) { m_formats.AppendValues(name); } exportFormatComboBox.Model = m_formats; TreeIter iter; exportFormatComboBox.Model.GetIterFirst(out iter); exportFormatComboBox.SetActiveIter(iter); }
private void Export_Click(object sender, EventArgs e) { string variantaExport = view.getExportType(); string numeSpectacol = view.getSpectacolByTitlu(); List <Bilet> listaBilete = view.getListaBilete(); if (variantaExport != "" && numeSpectacol != "") { //view.showMessage(variantaExport); ExporterFactory exportFactory = new ExporterFactory(); Exporter exporter = exportFactory.getExporter(variantaExport); exporter.export(numeSpectacol, listaBilete); view.showMessage("Fisier exportat cu succes!"); } else { view.showMessage("Spectacol/Varianta export neselectata!"); } }
public void TestHeaderWithExportIgnoreAndOrder() { IExporter <TestClass3> exporter = ExporterFactory.CreateExporter <TestClass3>(); string header = exporter.GetHeader(); Assert.IsNotNull(header, "No header found"); string[] headerEntries = header.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); Assert.IsNotNull(headerEntries, "No headerentries found"); var orderedProperties = typeof(TestClass3).GetProperties().Select(x => x.Name) .Where(x => !new string[] { nameof(TestClass3.TString), nameof(TestClass3.TGuid), nameof(TestClass3.TNInt), nameof(TestClass3.TObject) }.Contains(x)).OrderBy(x => x).ToArray(); orderedProperties = new string[] { nameof(TestClass3.TObject), nameof(TestClass3.TNInt) }.Concat(orderedProperties).ToArray(); Assert.IsTrue(headerEntries.Length == orderedProperties.Length, "Wrong number of properties"); for (int i = 0; i < headerEntries.Length; i++) { Assert.IsTrue(headerEntries[i] == orderedProperties[i], $"Wrong order! Value: {headerEntries[i]} Expected: {orderedProperties[i]}"); } Console.WriteLine(header); }
//Export JSON for a specific user public ActionResult ExportJSON(string userName) { List <LoggerModel> lst = new List <LoggerModel>(); foreach (LoggerModel log in db.Loggers) { if (log.userNameLog.Equals(userName)) { lst.Add(log); } } ExporterFactory eF = new ExporterFactory(); IExporter iE = eF.Export(ExporterFactory.ExportTypes.JSON, lst); var bytes = System.Text.Encoding.UTF8.GetBytes(iE.ReturnFile().ToString()); return(File(bytes, "text/json", "Log.json")); }
public static void Export( Vector3D caseDim, double caseWeight, int palletIndex, double palletWeight, int noLayers, List <BoxPositionIndexed> listBoxPositionIndexed, bool mirrorLength, bool mirrorWidth, List <bool> interlayers, ref byte[] fileBytes, System.Drawing.Imaging.ImageFormat imageFormat, ref byte[] imageFileBytes) { SolutionLayered.SetSolver(new LayerSolver()); // case var boxProperties = new BoxProperties(null, caseDim.X, caseDim.Y, caseDim.Z) { TapeColor = Color.LightGray, TapeWidth = new OptDouble(true, 50.0) }; boxProperties.SetWeight(caseWeight); boxProperties.SetAllColors(Enumerable.Repeat(Color.Beige, 6).ToArray()); // pallet Vector3D palletDim = PalletIndexToDim3D(palletIndex); var palletProperties = new PalletProperties(null, PalletIndexToPalletType(palletIndex), palletDim.X, palletDim.Y, palletDim.Z) { Weight = palletWeight, Color = Color.Yellow }; // constraint set var constraintSet = new ConstraintSetCasePallet(); constraintSet.SetAllowedOrientations(new bool[] { false, false, true }); constraintSet.OptMaxLayerNumber = noLayers; // layer var layer2D = new Layer2DBrickExpIndexed(caseDim, new Vector2D(palletDim.X, palletDim.Y), "", HalfAxis.HAxis.AXIS_Z_P); layer2D.SetPositions(listBoxPositionIndexed); // analysis var analysis = new AnalysisCasePallet(boxProperties, palletProperties, constraintSet); analysis.AddInterlayer(new InterlayerProperties(null, "interlayer", "", palletDim.X, palletDim.Y, 1.0, 0.0, Color.LightYellow)); analysis.AddSolution(layer2D, mirrorLength, mirrorWidth); SolutionLayered sol = analysis.SolutionLay; var solutionItems = sol.SolutionItems; int iCount = solutionItems.Count; for (int i = 0; i < iCount; ++i) { solutionItems[i].InterlayerIndex = ((i < interlayers.Count) && interlayers[i]) ? 0 : -1; } if (iCount < interlayers.Count && interlayers[iCount]) { analysis.PalletCapProperties = new PalletCapProperties( null, "palletCap", "", palletDim.X, palletDim.Y, 1, palletDim.X, palletDim.Y, 0.0, 0.0, Color.LightYellow); } // export var exporter = ExporterFactory.GetExporterByName("csv (TechnologyBSA)"); exporter.PositionCoordinateMode = Exporter.CoordinateMode.CM_COG; Stream stream = new MemoryStream(); exporter.ExportIndexed(analysis, ref stream); // save stream to file using (var br = new BinaryReader(stream)) fileBytes = br.ReadBytes((int)stream.Length); // image var graphics = new Graphics3DImage(ConfigSettings.ExportImageSize) { CameraPosition = Graphics3D.Corner_0, ShowDimensions = ConfigSettings.ExportShowDimensions }; using (ViewerSolution sv = new ViewerSolution(analysis.SolutionLay)) sv.Draw(graphics, Transform3D.Identity); graphics.Flush(); imageFileBytes = ImageToByteArray(graphics.Bitmap, imageFormat); }
public ElementInfo(Type type, Func <ProjectElement, bool> checker, ExporterFactory factory) { this.CanonicalType = type; this.Checker = checker; this.ExportFactory = factory; }
public string ExportJSON() { Exporter c = ExporterFactory.create(ExporterFactory.ExporterTypes.Json); return(c.export(db.Products)); }
public static void Export( Vector3D caseDim, double caseWeight, Vector3D palletDim, double palletWeight, double maxPalletHeight, List <BoxPosition> boxPositions, bool mirrorLength, bool mirrorWidth, List <bool> interlayers, ref byte[] fileBytes) { SolutionLayered.SetSolver(new LayerSolver()); // case var boxProperties = new BoxProperties(null, caseDim.X, caseDim.Y, caseDim.Z) { TapeColor = Color.LightGray, TapeWidth = new OptDouble(true, 50.0) }; boxProperties.SetWeight(caseWeight); boxProperties.SetAllColors(Enumerable.Repeat(Color.Beige, 6).ToArray()); // pallet var palletProperties = new PalletProperties(null, "EUR2", palletDim.X, palletDim.Y, palletDim.Z) { Weight = palletWeight, Color = Color.Yellow }; // constraint set var constraintSet = new ConstraintSetCasePallet(); constraintSet.SetAllowedOrientations(new bool[] { false, false, true }); constraintSet.SetMaxHeight(new OptDouble(true, maxPalletHeight)); // layer var layer2D = new Layer2DBrickExp(caseDim, new Vector2D(palletDim.X, palletDim.Y), "", HalfAxis.HAxis.AXIS_Z_P); layer2D.SetPositions(boxPositions); // analysis var analysis = new AnalysisCasePallet(boxProperties, palletProperties, constraintSet); analysis.AddInterlayer(new InterlayerProperties(null, "interlayer", "", palletDim.X, palletDim.Y, 1.0, 0.0, Color.LightYellow)); analysis.AddSolution(layer2D, mirrorLength, mirrorWidth); SolutionLayered sol = analysis.SolutionLay; var solutionItems = sol.SolutionItems; int iCount = solutionItems.Count; for (int i = 0; i < iCount; ++i) { solutionItems[i].InterlayerIndex = ((i < interlayers.Count) && interlayers[i]) ? 0 : -1; } if (iCount < interlayers.Count && interlayers[iCount]) { analysis.PalletCapProperties = new PalletCapProperties( null, "palletCap", "", palletDim.X, palletDim.Y, 1, palletDim.X, palletDim.Y, 0.0, 0.0, Color.LightYellow); } // export var exporter = ExporterFactory.GetExporterByName("csv (TechnologyBSA)"); exporter.PositionCoordinateMode = Exporter.CoordinateMode.CM_COG; Stream stream = new MemoryStream(); exporter.Export(analysis, ref stream); // save stream to file using (var br = new BinaryReader(stream)) fileBytes = br.ReadBytes((int)stream.Length); }
public string ExportCSV() { Exporter c = ExporterFactory.create(ExporterFactory.ExporterTypes.Csv); return(c.export(db.Products)); }
public ShowService() { _showRepository = new ShowRepository(); _ticketRepository = new TicketRepository(); _exporterFactory = new ExporterFactory(); }
public ElementInfo(Func <ProjectElement, bool> checker, ExporterFactory factory) { this.Checker = checker; this.ExportFactory = factory; }
/// <summary> /// Fetch TCMB Today's Currency Rates with GetRateRequest Object. /// </summary> /// <param name="rateRequest">GetRateRequest</param> /// <returns>GetRateResponse</returns> public GetRateResponse ExportTodaysCurrencyRates(GetRateRequest rateRequest) { var getRateResponse = new GetRateResponse(); const string tcmbTodayUrl = "https://www.tcmb.gov.tr/kurlar/today.xml"; var tcmbXmlDoc = new XmlDocument(); try { // Get Rates from TCMB and Load as XmlDocument. tcmbXmlDoc.Load(tcmbTodayUrl); using var stringReader = new StringReader(tcmbXmlDoc.InnerXml); var serializer = new XmlSerializer(typeof(Tarih_Date)); // Deserialize Xml response to TCMB proxy class. var ratesDeserialized = (Tarih_Date)serializer.Deserialize(stringReader); // Generate IQueryable Rates From Deserialized Response. var rates = TCMBServiceHelpers.GenerateRatesFromDeserializedResponse(ratesDeserialized); // Aggregated list for filters & orders. var filteredAndOrderedRates = new List <Rate>(); // Check filter options. if (rateRequest.FilterByOptions != null) { foreach (FilterByOption filterByOption in rateRequest.FilterByOptions) { filteredAndOrderedRates.AddRange(TCMBServiceHelpers.ApplyFilterBy(rates, filterByOption.Field, filterByOption.Value).ToList()); } } // Check order options if (rateRequest.OrderByOptions != null) { foreach (OrderByOption orderByOption in rateRequest.OrderByOptions) { filteredAndOrderedRates = orderByOption.OrderType switch { OrderType.Ascending => TCMBServiceHelpers.ApplyOrderByAscending(filteredAndOrderedRates.AsQueryable(), orderByOption.Field).ToList(), OrderType.Descending => TCMBServiceHelpers.ApplyOrderByDescending(filteredAndOrderedRates.AsQueryable(), orderByOption.Field).ToList(), _ => TCMBServiceHelpers.ApplyOrderByAscending(filteredAndOrderedRates.AsQueryable(), orderByOption.Field).ToList() }; } } // For the sake of simlicity it exports to current application's running directory. // Can be converted to parameter like path which can be taken at RateRequest object. var exportPath = Directory.GetCurrentDirectory() + $"\\Rates_of_{DateTime.Today:dd_MM_yyyy}"; // Check export type and create Exporter. IExportable exporter = ExporterFactory.CreatExporter(rateRequest.ExportType); // Do export. exporter.Export(filteredAndOrderedRates, exportPath + $".{rateRequest.ExportType.ToString().ToLowerInvariant()}"); // Add exported path to GetRateResponse. getRateResponse.ExportedPath = exportPath; } catch (Exception e) { // Handle Exception getRateResponse.HasError = true; getRateResponse.ErrorMessage = e.Message; } return(getRateResponse); }
public void TestNotNull() { IExporter <TestClass> exporter = ExporterFactory.CreateExporter <TestClass>(); Assert.IsNotNull(exporter); }