Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List <string> GetExtentionList(DataStructureType type, Tenant tenant = null)
        {
            if (type.Equals(DataStructureType.Structured))
            {
                return(new List <string>()
                {
                    ".xlsm",
                    ".xlsx",
                    ".txt",
                    ".csv",
                    ".tsv"
                });
            }

            if (type.Equals(DataStructureType.Unstructured))
            {
                if (tenant != null)
                {
                    return(tenant.AllowedFileExtensions);
                }

                //Info
                // is not used anymore: list came from the this.Session.GetTenant().AllowedFileExtensions
                return(new List <string>()
                {
                    //".avi",
                    //".bmp",
                    //".csv",
                    //".dbf",
                    //".doc",
                    //".docx",
                    //".gif",
                    //".jpg",
                    //".jpeg",
                    //".mp3",
                    //".mp4",
                    //".pdf",
                    //".png",
                    //".shp",
                    //".shx",
                    //".tif",
                    //".txt",
                    //".xls",
                    //".xlsm",
                    //".xlsx",
                    //".xsd",
                    //".zip"
                });
            }

            return(new List <string>());
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="type"></param>
        /// <returns></returns>
        public static List<string> GetExtentionList(DataStructureType type)
        {
            if(type.Equals(DataStructureType.Structured))
                {
                    return new List<string>()
                    {
                        ".xlsm",
                        ".txt",
                        ".csv"
                    };
                }

                if (type.Equals(DataStructureType.Unstructured))
                {
                    return new List<string>()
                    {
                        ".avi",
                        ".bmp",
                        ".csv",
                        ".dbf",
                        ".doc",
                        ".docx",
                        ".gif",
                        ".jpg",
                        ".jpeg",
                        ".mp3",
                        ".mp4",
                        ".pdf",
                        ".png",
                        ".shp",
                        ".shx",
                        ".tif",
                        ".txt",
                        ".xls",
                        ".xlsm",
                        ".xlsx",
                        ".xsd",
                        ".zip"
                    };
                }

                return new List<string>();
        }
Пример #3
0
        public List <ListViewItem> LoadDatasetVersionViewList(DataStructureType dataStructureType)
        {
            EntityPermissionManager entityPermissionManager = new EntityPermissionManager();
            DataStructureManager    dataStructureManager    = new DataStructureManager();
            DatasetManager          dm = new DatasetManager();

            try
            {
                List <long> datasetIds = entityPermissionManager.GetKeys(GetUsernameOrDefault(), "Dataset", typeof(Dataset), RightType.Write).ToList();

                List <ListViewItem> tempStructured   = new List <ListViewItem>();
                List <ListViewItem> tempUnStructured = new List <ListViewItem>();

                var DatasetVersions = dm.GetDatasetLatestVersions(datasetIds, false);

                foreach (var dsv in DatasetVersions)
                {
                    if (dsv.Dataset.DataStructure.Self.GetType().Equals(typeof(StructuredDataStructure)))
                    {
                        tempStructured.Add(new ListViewItem(dsv.Dataset.Id, dsv.Title));
                    }
                    else
                    {
                        tempUnStructured.Add(new ListViewItem(dsv.Dataset.Id, dsv.Title));
                    }
                }

                if (dataStructureType.Equals(DataStructureType.Structured))
                {
                    return(tempStructured.OrderBy(p => p.Title).ToList());
                }
                else
                {
                    return(tempUnStructured.OrderBy(p => p.Title).ToList());
                }
            }
            finally
            {
                entityPermissionManager.Dispose();
                dataStructureManager.Dispose();
                dm.Dispose();
            }
        }
Пример #4
0
        public List<ListViewItem> LoadDatasetVersionViewList( DataStructureType dataStructureType)
        {
            PermissionManager permissionManager = new PermissionManager();
                SubjectManager subjectManager = new SubjectManager();

                // add security
                ICollection<long> datasetIDs = permissionManager.GetAllDataIds(subjectManager.GetUserByName(GetUsernameOrDefault()).Id, 1, RightType.Update).ToList();

                DataStructureManager dataStructureManager = new DataStructureManager();
                DatasetManager dm = new DatasetManager();

                Dictionary<long, XmlDocument> dmtemp = new Dictionary<long, XmlDocument>();
                dmtemp = dm.GetDatasetLatestMetadataVersions();

                List<ListViewItem> temp = new List<ListViewItem>();

                if (dataStructureType.Equals(DataStructureType.Structured))
                {
                    List<StructuredDataStructure> list = dataStructureManager.StructuredDataStructureRepo.Get().ToList();

                    foreach (StructuredDataStructure sds in list)
                    {
                        sds.Materialize();

                        foreach (Dataset d in sds.Datasets)
                        {
                            if (dm.IsDatasetCheckedIn(d.Id))
                            {
                                if (datasetIDs.Contains(d.Id))
                                {
                                    temp.Add(new ListViewItem(d.Id,
                                        XmlDatasetHelper.GetInformation(dm.GetDatasetLatestVersion(d),
                                            NameAttributeValues.title)));
                                }
                            }
                        }
                    }

                }
                else
                {
                    List<UnStructuredDataStructure> list = dataStructureManager.UnStructuredDataStructureRepo.Get().ToList();

                    foreach (UnStructuredDataStructure sds in list)
                    {
                        foreach (Dataset d in sds.Datasets)
                        {
                            if (datasetIDs.Contains(d.Id))
                            {
                                if (dm.IsDatasetCheckedIn(d.Id))
                                {
                                    DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(d);
                                    temp.Add(new ListViewItem(d.Id,
                                        XmlDatasetHelper.GetInformation(datasetVersion, NameAttributeValues.title)));
                                }
                            }
                        }
                    }
                }

               return temp.OrderBy(p => p.Title).ToList();
        }
Пример #5
0
        public List <ListViewItem> LoadDatasetVersionViewList(DataStructureType dataStructureType)
        {
            EntityPermissionManager entityPermissionManager = new EntityPermissionManager();
            DataStructureManager    dataStructureManager    = new DataStructureManager();
            DatasetManager          dm = new DatasetManager();


            try
            {
                ICollection <long> datasetIDs = new List <long>();
                datasetIDs = entityPermissionManager.GetKeys(GetUsernameOrDefault(), "Dataset", typeof(Dataset), RightType.Write).ToList();



                Dictionary <long, XmlDocument> dmtemp = new Dictionary <long, XmlDocument>();
                dmtemp = dm.GetDatasetLatestMetadataVersions();

                List <ListViewItem> temp = new List <ListViewItem>();

                if (dataStructureType.Equals(DataStructureType.Structured))
                {
                    List <StructuredDataStructure> list = dataStructureManager.StructuredDataStructureRepo.Get().ToList();

                    foreach (StructuredDataStructure sds in list)
                    {
                        sds.Materialize();

                        foreach (Dataset d in sds.Datasets)
                        {
                            if (dm.IsDatasetCheckedIn(d.Id))
                            {
                                if (datasetIDs.Contains(d.Id))
                                {
                                    temp.Add(new ListViewItem(d.Id,
                                                              xmlDatasetHelper.GetInformationFromVersion(dm.GetDatasetLatestVersion(d).Id,
                                                                                                         NameAttributeValues.title)));
                                }
                            }
                        }
                    }
                }
                else
                {
                    List <UnStructuredDataStructure> list = dataStructureManager.UnStructuredDataStructureRepo.Get().ToList();

                    foreach (UnStructuredDataStructure sds in list)
                    {
                        foreach (Dataset d in sds.Datasets)
                        {
                            if (datasetIDs.Contains(d.Id))
                            {
                                if (dm.IsDatasetCheckedIn(d.Id))
                                {
                                    DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(d);
                                    temp.Add(new ListViewItem(d.Id,
                                                              xmlDatasetHelper.GetInformationFromVersion(datasetVersion.Id, NameAttributeValues.title)));
                                }
                            }
                        }
                    }
                }

                return(temp.OrderBy(p => p.Title).ToList());
            }
            finally
            {
                entityPermissionManager.Dispose();
                dataStructureManager.Dispose();
                dm.Dispose();
            }
        }