public ActionResult Delete([DataSourceRequest] DataSourceRequest dataSourceRequest, Guid id)
 {
     if (!inspektionsRouteGISService.GetById(id).IsLocked)
     {
         inspektionsRouteGISService.DeleteEntity(id);
     }
     return(PartialView(GetGridModel(dataSourceRequest)));
 }
Exemple #2
0
        private void AddPackageDescriptor(ZipFile zipFile, IList <CheckOutsGISModel> cogModelList, CheckOutGISStreams checkoutGis)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ServerPackageDescriptor));

            Stream packageDescriptorStream = new MemoryStream();
            var    packageDescriptor       = new ServerPackageDescriptor
            {
                Version        = PackageVersioner.GetServerPackageVersion(),
                CurrentCulture = Thread.CurrentThread.CurrentUICulture.Name
            };

            foreach (var cog in cogModelList)
            {
                var id = cog.InspektionsRouteGIS;
                packageDescriptor.Inspektionsrouten.Add(new XMLKeyValuePair <Guid, string>(id, inspektionsRouteGISService.GetById(id).Bezeichnung));
                packageDescriptor.CheckOutsGISInspektionsroutenList.Add(new XMLKeyValuePair <Guid, Guid>(cog.Id, id));
            }
            var filepaths = zipFile.EntryFileNames.ToList();

            IList <string> fileextensions = new List <string>();

            filepaths.Where(fp => Path.GetExtension(fp) != string.Empty).ToList().ForEach(fp => fileextensions.Add(Path.GetExtension(fp)));
            foreach (var file in fileextensions.Distinct())
            {
                packageDescriptor.FileCount.Add(new XMLKeyValuePair <string, int>(file, fileextensions.Count(fe => fe == file)));
            }

            packageDescriptor.LayerConfig.AddRange(checkoutGis.Tiles);

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

            zipFile.AddEntry(FileNameConstants.ServerPackageDescriptorFileName, packageDescriptorStream);
        }