Esempio n. 1
0
        public DTOContainer Export(string tempExportDirectory, bool exportAll)
        {
            IEnumerable <Guid> zustandsAbschnittIDs = null;
            IEnumerable <ZustandsabschnittGISDTO> zustandsAbschnitte = null;

            if (exportAll)
            {
                zustandsAbschnitte   = dtoService.GetAll <ZustandsabschnittGISDTO>();
                zustandsAbschnittIDs = zustandsAbschnitte.Select(z => z.Id);
            }
            else
            {
                var strassenabschnitte = dtoService.GetAll <StrassenabschnittGISDTO>().Where(s => s.InspektionsRouteId == formService.GetActiveInspektionsRoute()).Select(s => s.Id);

                zustandsAbschnitte   = dtoService.GetAll <ZustandsabschnittGISDTO>().Where(z => strassenabschnitte.Contains(z.StrassenabschnittGIS));
                zustandsAbschnittIDs = zustandsAbschnitte.Select(z => z.Id);
            }


            DTOContainer dtocontainer = new DTOContainer();

            dtocontainer.DataTransferObjects = dtocontainer.DataTransferObjects.Concat(zustandsAbschnitte).ToList();

            foreach (var schadendetail in dtoService.GetAll <SchadendetailDTO>().Where(sd => zustandsAbschnittIDs.Contains(sd.ZustandsabschnittId)))
            {
                dtocontainer.DataTransferObjects.Add(schadendetail);
            }
            foreach (var schadengrouppe in dtoService.GetAll <SchadengruppeDTO>().Where(sg => zustandsAbschnittIDs.Contains(sg.ZustandsabschnittId)))
            {
                dtocontainer.DataTransferObjects.Add(schadengrouppe);
            }
            dtoService.saveFile(dtocontainer, Path.Combine(tempExportDirectory, FileNameConstants.DTOContainerFileName));

            return(dtocontainer);
        }
Esempio n. 2
0
        public void LoadFile()
        {
            Stream     fs        = new FileStream(getFilePath(), FileMode.Open);
            IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            dtoContainer = (DTOContainer)formatter.Deserialize(fs);
            fs.Close();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DTOContainer dTOContainer = db.DTOContainers.Find(id);

            db.DTOContainers.Remove(dTOContainer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,link")] DTOContainer dTOContainer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dTOContainer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dTOContainer));
 }
        public ActionResult Create([Bind(Include = "ID,link")] DTOContainer dTOContainer)
        {
            if (ModelState.IsValid)
            {
                db.DTOContainers.Add(dTOContainer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dTOContainer));
        }
Esempio n. 6
0
        public void saveFile(DTOContainer container, string path)
        {
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            Stream     fs        = new FileStream(path, FileMode.CreateNew);
            IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            formatter.Serialize(fs, container);
            fs.Seek(0, 0);
            fs.Flush();
            fs.Close();
        }
        // GET: DTOContainers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DTOContainer dTOContainer = db.DTOContainers.Find(id);

            if (dTOContainer == null)
            {
                return(HttpNotFound());
            }
            return(View(dTOContainer));
        }
Esempio n. 8
0
        public ActionResult Search(DTOContainer dataContainer)
        {
            Uri          url          = new Uri(dataContainer.link);
            DTOContainer dTOContainer = db.DTOContainers.Where(it => it.link.Equals(url.AbsolutePath)).FirstOrDefault();

            if (dTOContainer == null)
            {
                dataContainer = testcRentHub(dataContainer);
                db.DTOContainers.Add(dataContainer);
                db.SaveChanges();
            }
            else
            {
                dataContainer = dTOContainer;
            }

            return(View("Search", dataContainer));
        }
Esempio n. 9
0
        public ImportResult CheckInData(ImportResult importResult)
        {
            try
            {
                DTOContainer dtoContainer                 = importResult.dtocontainer;
                var          zustandsAbschnitte           = dtoContainer.DataTransferObjects.Where(dto => dto.GetType() == typeof(ZustandsabschnittGISDTO)).Select(sd => sd as ZustandsabschnittGISDTO);
                var          schadendetailList            = dtoContainer.DataTransferObjects.Where(dto => dto.GetType() == typeof(SchadendetailDTO)).Select(sd => sd as SchadendetailDTO);
                var          schadengruppeList            = dtoContainer.DataTransferObjects.Where(dto => dto.GetType() == typeof(SchadengruppeDTO)).Select(sd => sd as SchadengruppeDTO);
                var          deletedZustandsabschnittList = zustandsAbschnitte.Where(z => z.IsDeleted && (!z.IsAdded)).Select(z => z.Id);


                IList <ZustandsabschnittGISDTO> zustandsabschnitteToValidate = new List <ZustandsabschnittGISDTO>();
                zustandsabschnitteToValidate = zustandsabschnitteToValidate.Concat(zustandsAbschnitte.Where(z => !z.IsDeleted && (z.IsEdited || z.IsAdded))).ToList();

                foreach (var za in zustandsabschnitteToValidate)
                {
                    var result = zustandsabschnittGISDTOService.Validate(za, deletedZustandsabschnittList.ToList(), zustandsabschnitteToValidate);
                    foreach (string error in result)
                    {
                        importResult.Errors.Add(error);
                    }
                }

                if (importResult.Errors.Count == 0)
                {
                    foreach (Guid id in deletedZustandsabschnittList)
                    {
                        try
                        {
                            zustandsabschnittGISDTOService.DeleteEntity(id);
                        }
                        catch { }
                    }

                    foreach (var za in zustandsabschnitteToValidate)
                    {
                        if (za.Shape.SRID == 0)
                        {
                            za.Shape.SRID = GisConstants.SRID;
                        }
                        zustandsabschnittGISDTOService.CreateOrUpdateEntityFromDTO(za);
                        FahrBahnZustandDTO zustand = new FahrBahnZustandDTO()
                        {
                            Erfassungsmodus   = za.Erfassungsmodus,
                            Schadendetails    = za.Erfassungsmodus == ZustandsErfassungsmodus.Detail ? schadendetailList.Where(sd => sd.ZustandsabschnittId == za.Id && !sd.IsDeleted).ToList() : new List <SchadendetailDTO>(),
                            Schadengruppen    = za.Erfassungsmodus == ZustandsErfassungsmodus.Grob ? schadengruppeList.Where(sg => sg.ZustandsabschnittId == za.Id && !sg.IsDeleted).ToList() : new List <SchadengruppeDTO>(),
                            ZustandsAbschnitt = za.Id,
                            Zustandsindex     = za.Zustandsindex
                        };
                        fahrbahnZustandDTOService.UpdateFahrbahnZustand(zustand);
                    }
                }
                if (importResult.Errors.Count == 0)
                {
                    foreach (var kvp in importResult.descriptor.CheckOutsGISInspektionsroutenList)
                    {
                        var cogModel = checkOutsGISService.GetById(kvp.Key);
                        cogModel.CheckInDatum = timeService.Now;
                        checkOutsGISService.UpdateEntity(cogModel);
                        inspektionsRouteGISService.UnLockInspektionsRouten(importResult.InspektionsRouten);
                        foreach (var ir in importResult.InspektionsRouten)
                        {
                            inspektionsRouteStatusverlaufService.HistorizeRouteImportiert(inspektionsRouteGISService.GetInspektionsRouteById(ir));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Loggers.ApplicationLogger.Error(e.Message, e);
                importResult.Errors.Add("Error When Importing");
            }
            var inspektionsrouten = inspektionsRouteGISService.GetCurrentEntities().Where(ir => importResult.InspektionsRouten.Contains(ir.Id));

            ereignisLogService.LogEreignis(EreignisTyp.InspektionsRoutenImport, new Dictionary <string, object>()
            {
                { "Inspektionsrouten", string.Join(", ", inspektionsrouten.Select(ir => ir.Bezeichnung)) }, { "Fehleranzahl", importResult.Errors.Count }
            });
            return(importResult);
        }
Esempio n. 10
0
        public CheckOutGISStreams CheckOutData(IList <Guid> ids, bool exportBackground)
        {
            CheckOutGISStreams checkoutGISStreams = new CheckOutGISStreams();


            DTOContainer dtosToExport = new DTOContainer();
            Mandant      mandant      = null;
            IGeometry    bbox         = null;

            foreach (Guid id in ids)
            {
                InspektionsRouteGIS inspektionsroute = inspektionsRouteGISService.GetInspektionsRouteById(id);
                mandant = inspektionsroute.Mandant;
                if (bbox != null)
                {
                    bbox = bbox.Union(inspektionsroute.Shape.Envelope).Envelope;
                }
                else
                {
                    bbox = inspektionsroute.Shape.Envelope;
                }
                IList <InspektionsRtStrAbschnitte> inspektionsroutenAbschnitte = inspektionsRtStrAbschnitteService.GetCurrentEntities().Where(ira => ira.InspektionsRouteGIS.Id == inspektionsroute.Id).ToList();

                inspektionsroutenAbschnitte.OrderBy(ira => ira.Reihenfolge);

                //Strassenabschnitte
                foreach (InspektionsRtStrAbschnitte inspektionsroutenAbschnitt in inspektionsroutenAbschnitte)
                {
                    StrassenabschnittGISDTO strassenabschnittGISDTO = strassenabschnittGISDTOService.GetDTOByID(inspektionsroutenAbschnitt.StrassenabschnittGIS.Id);
                    dtosToExport.DataTransferObjects.Add(strassenabschnittGISDTO);

                    //Zustandsabschnitte
                    foreach (ZustandsabschnittGIS zustandsabschnitt in inspektionsroutenAbschnitt.StrassenabschnittGIS.Zustandsabschnitten)
                    {
                        ZustandsabschnittGISDTO zustandsabschnittGISDTO = zustandsabschnittGISDTOService.GetDTOByID(zustandsabschnitt.Id);
                        dtosToExport.DataTransferObjects.Add(zustandsabschnittGISDTO);


                        foreach (Schadendetail schaden in zustandsabschnitt.Schadendetails)
                        {
                            SchadendetailDTO schadendto = schadendetailDTOService.GetDTOByID(schaden.Id);
                            schadendto.ZustandsabschnittId = zustandsabschnitt.Id;
                            dtosToExport.DataTransferObjects.Add(schadendto);
                        }
                        foreach (Schadengruppe schadengruppe in zustandsabschnitt.Schadengruppen)
                        {
                            SchadengruppeDTO schadengruppedto = schadengruppeDTOService.GetDTOByID(schadengruppe.Id);
                            schadengruppedto.ZustandsabschnittId = zustandsabschnitt.Id;
                            dtosToExport.DataTransferObjects.Add(schadengruppedto);
                        }
                    }
                }
            }
            IGeometry backgroundBbox = null;

            //Achsensegmente
            foreach (AchsenSegment achsensegment in achsenSegmentService.GetCurrentBySpatialFilter(bbox).Where(a => a.Mandant == mandant))
            {
                dtosToExport.DataTransferObjects.Add(achsenSegmentDTOService.GetDTOByID(achsensegment.Id));
                if (backgroundBbox != null)
                {
                    backgroundBbox = backgroundBbox.Envelope.Union(achsensegment.Shape.Envelope);
                }
                else
                {
                    backgroundBbox = achsensegment.Shape.Envelope;
                }
            }

            List <Belastungskategorie> belastungskategorien = belastungskategorieService.AlleBelastungskategorie;

            foreach (Belastungskategorie bk in belastungskategorien)
            {
                dtosToExport.DataTransferObjects.Add(belastungskategorieDTOService.GetDTOByID(bk.Id));
            }
            List <MassnahmenvorschlagKatalog> mvklist = massnahmenvorschlagKatalogService.GetCurrentEntities().Where(mvk => mvk.Mandant.Id == mandant.Id && mvk.ErfassungsPeriod.IsClosed == false).ToList();

            foreach (MassnahmenvorschlagKatalog mvk in mvklist)
            {
                dtosToExport.DataTransferObjects.Add(massnahmenvorschlagKatalogDTOService.GetDTOByID(mvk.Id));
            }

            IFormatter   formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            MemoryStream serializedModelsStream = new MemoryStream();

            formatter.Serialize(serializedModelsStream, dtosToExport);
            serializedModelsStream.Seek(0, 0);


            checkoutGISStreams.Bezeichnung = "export";

            LayerCollection exportLayer = serverConfigurationProvider.ExportLayer;
            int             count       = exportLayer.Count;
            string          filepath    = serverConfigurationProvider.WMSCacheFolderPath;

            for (int i = 0; i < count; i++)
            {
                ITileSourceFactory fact = null;
                var layer = exportLayer[i];
                switch (layer.ServiceType)
                {
                case ServiceType.WMS:
                    fact = new WmsTileSourceFactory(layer);
                    break;

                case ServiceType.WMTS:
                    fact = new WmtsTileSourceFactory(layer);
                    break;

                default:
                    break;
                }
                TileLoader loader = new TileLoader(fact.GetTileSource());

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                checkoutGISStreams.Tiles.Add(loader.GetTiles(layer, bbox, filepath, serverConfigurationProvider.UseWMSCaching, fact.Format, serverConfigurationProvider.ExportBackgroundMapBuffer, serverConfigurationProvider.ExportTileLimit, download: exportBackground));
                stopwatch.Stop();
                Loggers.PeformanceLogger.DebugFormat("Layer {0} downloaded in {1}", layer.Name, stopwatch.Elapsed);
            }
            checkoutGISStreams.ModelsToExport = serializedModelsStream;

            checkoutGISStreams.LegendStreams.Add(FileNameConstants.AchsenSegmentLayerLegendFilename, legendService.GetLegendStream("AchsenSegmentLayer"));
            checkoutGISStreams.LegendStreams.Add(FileNameConstants.StrassenabschnittLayerLegendFilename, legendService.GetLegendStream("StrassenabschnittLayer"));
            checkoutGISStreams.LegendStreams.Add(FileNameConstants.ZustandsabschnittLayerLegendFilename, legendService.GetLegendStream("ZustandsabschnittLayer"));
            checkoutGISStreams.LegendStreams.Add(FileNameConstants.ZustandsabschnittLayerTrottoirLegendFilename, legendService.GetLegendStream("ZustandsabschnittLayer_Trottoir"));
            return(checkoutGISStreams);
        }
Esempio n. 11
0
        private DTOContainer testcRentHub(DTOContainer dataContainer)
        {
            Uri    url      = new Uri(dataContainer.link);
            string filePath = dataContainer.link;
            //string filePath = "http://www.renthub.in.th/อพาร์ทเม้นท์-ห้องพัก-หอพัก/ซอยแบริ่ง-สุขุมวิท-107/";
            string data = getHTMLdata(filePath);

            HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
            htmlDoc.OptionFixNestedTags = true;
            htmlDoc.LoadHtml(data);
            if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
            {
                Console.WriteLine("something error");
            }
            else
            {
                if (htmlDoc.DocumentNode != null)
                {
                    HtmlAgilityPack.HtmlNodeCollection bodyNode = htmlDoc.DocumentNode.SelectNodes("//div[@class='show_content']//ul//li");

                    if (bodyNode != null)
                    {
                        string domain = "http://www.renthub.in.th/";
                        var    count  = 10; //bodyNode.Count;
                        for (int i = 0; i < count; i += 2)
                        {
                            var listnode = bodyNode[i];
                            var li       = listnode.Attributes["id"].Value;
                            var image    = listnode.SelectSingleNode(".//img");
                            var addr     = listnode.SelectSingleNode(".//span[@class='addr']");
                            var src      = image != null ? image.Attributes["src"].Value : string.Empty;
                            var sublink  = listnode.SelectSingleNode(".//span[@class='name']//a").Attributes["href"].Value;
                            var name     = listnode.SelectSingleNode(".//span[@class='name']//a").InnerText;
                            var address  = addr.InnerText;
                            Console.WriteLine("Scr Image : " + li + " addr : " + address + " image : " + src);

                            Apartment apartment = new Apartment();
                            apartment.image         = src;
                            apartment.sublink       = domain + sublink;
                            apartment.apartmentName = name;
                            apartment.address       = address;

                            // process sub link
                            string filePath_sub = domain + sublink;
                            string data_sub     = getHTMLdata(filePath_sub);
                            HtmlAgilityPack.HtmlDocument htmlDoc_sub = new HtmlAgilityPack.HtmlDocument();
                            htmlDoc_sub.OptionFixNestedTags = true;
                            htmlDoc_sub.LoadHtml(data_sub);
                            string searchText     = "var loc = ";
                            string endText_conndo = "var condo_project_id ="; // var apartment_id
                            string endText_apart  = "var apartment_id =";     // var apartment_id
                            int    start          = data_sub.IndexOf(searchText) + searchText.Length;
                            int    end            = data_sub.IndexOf(endText_apart);
                            if (end < 0)
                            {
                                end = data_sub.IndexOf(endText_conndo);
                            }
                            var location_hash = data_sub.Substring(start + 1, end - start).Split(';')[0].Replace("\"", "");
                            if (htmlDoc_sub.DocumentNode != null)
                            {
                                var head_info   = htmlDoc_sub.DocumentNode.SelectSingleNode("//div[@id='main_info']").InnerHtml;
                                var main_box    = htmlDoc_sub.DocumentNode.SelectSingleNode("//div[@id='main_box']");
                                var image_box   = main_box.InnerHtml;
                                var main_infos  = main_box.NextSibling.NextSibling.InnerHtml;
                                var price_infos = main_box.NextSibling.NextSibling.NextSibling.NextSibling.InnerHtml;
                                apartment.loc_hash        = location_hash;
                                apartment.innerHTML_room  = head_info;
                                apartment.innerHTML_image = image_box;
                                apartment.innerHTML_info  = main_infos;
                                apartment.innerHTML_price = price_infos;
                            }
                            //add data
                            dataContainer.AbsolutePath = url.AbsolutePath;
                            dataContainer.linkName     = url.AbsolutePath;
                            dataContainer.appartment.Add(apartment);
                        }
                    }
                }
            }
            return(dataContainer);
        }
Esempio n. 12
0
        public void Export(string file, bool exportAll)
        {
            FileHelper.TryDeleteFiles(new DirectoryInfo(clientConfigurationProvider.ExportPackageFolderPath));


            ClientPackageDescriptor mdescriptor = new ClientPackageDescriptor();
            ServerPackageDescriptor sdescriptor = GetWorkingSeverpackageDescriptor();


            if (exportAll)
            {
                mdescriptor.CheckOutsGISInspektionsroutenList = sdescriptor.CheckOutsGISInspektionsroutenList;
                mdescriptor.Inspektionsrouten = sdescriptor.Inspektionsrouten;
            }
            else
            {
                //mdescriptor.CheckOutsGISInspektionsroutenList = sdescriptor.CheckOutsGISInspektionsroutenList.Where(kvp => kvp.Value == layerService.getActiveInspektionsroute()).ToList();
                //mdescriptor.Inspektionsrouten = sdescriptor.Inspektionsrouten.Where(kvp => kvp.Key == layerService.getActiveInspektionsroute()).ToList();
                mdescriptor.CheckOutsGISInspektionsroutenList = sdescriptor.CheckOutsGISInspektionsroutenList.Where(kvp => kvp.Value == formService.GetActiveInspektionsRoute()).ToList();
                mdescriptor.Inspektionsrouten = sdescriptor.Inspektionsrouten.Where(kvp => kvp.Key == formService.GetActiveInspektionsRoute()).ToList();
            }

            mdescriptor.CurrentCulture = sdescriptor.CurrentCulture;


            mdescriptor.Version = PackageVersioner.GetClientPackageVersion();

            string tempExportDirectory = Path.Combine(clientConfigurationProvider.ExportPackageFolderPath, Guid.NewGuid().ToString());

            EnsurePackageFolder(tempExportDirectory);
            DTOContainer dtoContainer = exportService.Export(tempExportDirectory, exportAll);

            string[] allfilePaths = Directory.GetFiles(tempExportDirectory, "*",
                                                       SearchOption.AllDirectories);



            var dtofileNames = allfilePaths.Where(p => Path.GetExtension(p) == ".model");

            mdescriptor.FileCount.Add(new XMLKeyValuePair <string, int>(".model", dtofileNames.Count()));

            var fileNames = dtofileNames;

            XmlSerializer xmlSerializer           = new XmlSerializer(typeof(ClientPackageDescriptor));
            Stream        packageDescriptorStream = new MemoryStream();

            xmlSerializer.Serialize(packageDescriptorStream, mdescriptor);
            packageDescriptorStream.Seek(0, 0);


            try
            {
                if (File.Exists(file))
                {
                    File.Delete(file);
                }

                using (var zipFile = new ZipFile(file))
                {
                    zipFile.AddFiles(fileNames, false, string.Empty);
                    zipFile.AddEntry(FileNameConstants.ClientPackageDescriptorFileName, packageDescriptorStream);
                    zipFile.Save(file);
                }

                if (exportAll)
                {
                    //Delete the Inspektionsrouten entries in the Packagedescriptor lying in the Working Dir (CurrentTemporaryFolder),
                    //OnApplicationExiting there is a Save (copy WorkingDir to PackageDir =>If there are no Inspektionsrouten, then the PackageDir will be deleted)

                    var descriptor = GetSeverpackageDescriptor(Directory.GetFiles(clientConfigurationProvider.CurrentTemporaryFolder, FileNameConstants.ServerPackageDescriptorFileName,
                                                                                  SearchOption.AllDirectories).SingleOrDefault());
                    descriptor.Inspektionsrouten.Clear();
                    xmlSerializer           = new XmlSerializer(typeof(ServerPackageDescriptor));
                    packageDescriptorStream = new System.IO.FileStream(Path.Combine(clientConfigurationProvider.CurrentTemporaryFolder, FileNameConstants.ServerPackageDescriptorFileName), FileMode.Create, FileAccess.ReadWrite);
                    xmlSerializer.Serialize(packageDescriptorStream, descriptor);
                    packageDescriptorStream.Close();

                    loadService.ClearAll(true);
                }
                else
                {
                    foreach (var dto in dtoContainer.DataTransferObjects)
                    {
                        dtoService.DeleteDTO(dto.Id);
                    }


                    //Delete the to be exported Inspektionsroute in the Shape Files

                    //Delete the Inspektionsrouten entries in the Packagedescriptor lying in the Working Dir (CurrentTemporaryFolder)
                    var descriptor = GetSeverpackageDescriptor(Directory.GetFiles(clientConfigurationProvider.CurrentTemporaryFolder, FileNameConstants.ServerPackageDescriptorFileName,
                                                                                  SearchOption.AllDirectories).SingleOrDefault());



                    descriptor.Inspektionsrouten.Remove(descriptor.Inspektionsrouten.Where(ir => ir.Key == formService.GetActiveInspektionsRoute()).SingleOrDefault());
                    descriptor.CheckOutsGISInspektionsroutenList.Remove(descriptor.CheckOutsGISInspektionsroutenList.Where(ir => ir.Value == formService.GetActiveInspektionsRoute()).SingleOrDefault());


                    xmlSerializer           = new XmlSerializer(typeof(ServerPackageDescriptor));
                    packageDescriptorStream = new System.IO.FileStream(Path.Combine(clientConfigurationProvider.CurrentTemporaryFolder, FileNameConstants.ServerPackageDescriptorFileName), FileMode.Create, FileAccess.ReadWrite);
                    xmlSerializer.Serialize(packageDescriptorStream, descriptor);
                    packageDescriptorStream.Close();



                    //Delete the Inspektionsroute from the Dictionary for displaying
                    //all changes to an Observable Collection must be done by the same Thread it was created by, becaus of Thread Affinity
                    Action action = new Action(() => { loadService.InspektionsroutenDictionary.Remove(loadService.InspektionsroutenDictionary.Where(ir => ir.Key == formService.GetActiveInspektionsRoute()).SingleOrDefault()); });
                    Application.Current.Dispatcher.Invoke(action);
                    if (descriptor.Inspektionsrouten.IsEmpty())
                    {
                        loadService.ClearAll(true);
                    }



                    //Let Map know about the export
                    IEnumerable <AchsenSegmentDTO>        achsenSegmente = dtoService.Get <AchsenSegmentDTO>();
                    IEnumerable <StrassenabschnittGISDTO> strabs         = dtoService.Get <StrassenabschnittGISDTO>();
                    IEnumerable <ZustandsabschnittGISDTO> zabs           = dtoService.Get <ZustandsabschnittGISDTO>();

                    string achsString  = geoJsonService.GenerateGeoJsonStringFromEntities(achsenSegmente);
                    string strabString = geoJsonService.GenerateGeoJsonStringFromEntities(strabs);
                    string zabString   = geoJsonService.GenerateGeoJsonStringFromEntities(zabs);

                    DataChangedEventArgs args = new DataChangedEventArgs();
                    args.AchsenGeoJson = achsString;
                    args.StrabsGeoJson = strabString;
                    args.ZabsGeoJson   = zabString;
                    sdescriptor.LayerConfig.ForEach(c => c.BasePath = clientConfigurationProvider.TileFolder);
                    args.LayerInfo = sdescriptor.LayerConfig;
                    args.ActiveInspectionRouteId = formService.GetActiveInspektionsRoute();
                    MobileLocalization localization = LocalizationLocator.MobileLocalization;
                    foreach (var propertyInfo in typeof(MobileLocalization).GetProperties())
                    {
                        if (propertyInfo.CanRead)
                        {
                            args.MobileLocalization.Add(propertyInfo.Name, propertyInfo.GetValue(localization, null).ToString());
                        }
                    }
                    string[] sldPaths;
                    if (clientConfigurationProvider.UseLocalFiles)
                    {
                        sldPaths = Directory.GetFiles(".\\Mobile\\style\\sld", "*.sld", SearchOption.TopDirectoryOnly);
                    }
                    else
                    {
                        sldPaths = Directory.GetFiles(Path.Combine(clientConfigurationProvider.MobilePackageFolder, "style\\sld"), "*.sld", SearchOption.TopDirectoryOnly);
                    }

                    string[] sldcontent = new string[sldPaths.Length];
                    int      i          = 0;
                    foreach (string sldpath in sldPaths)
                    {
                        StringBuilder sb = new StringBuilder();
                        using (StreamReader sr = new StreamReader(sldpath))
                        {
                            String line;
                            while ((line = sr.ReadLine()) != null)
                            {
                                sb.AppendLine(line);
                            }
                        }
                        sldcontent[i] = sb.ToString();
                    }
                    args.Slds = sldcontent;
                    formService.OnDataChanged(args);
                }

                messageBoxService.Information(LocalizationLocator.MobileLocalization.SuccessfullExport);
            }
            catch (EmsgException ex)
            {
                Loggers.TechLogger.ErrorException(ex.Message, ex);
                messageBoxService.Information(ex.Message);
            }
            catch (Exception ex)
            {
                Loggers.TechLogger.ErrorException(ex.Message, ex);
                messageBoxService.Information(LocalizationLocator.MobileLocalization.ExportError);
            }
        }