public ActionResult Index(string container, string entitySetName, string downloadID)
        {
            // increment the download
            EntitySet entitySet = EntitySetRepository.GetEntitySet(container, entitySetName);

            viewDataModel.EntitySetWrapper = new EntitySetWrapper()
            {
                EntitySet = entitySet
            };

            viewDataModel.EntitySetWrapper.RegisterDownload(downloadID);


            // get the download information

            // the download link information is there but it's in a list and I'm not sure which one to grab. The id is not in the list to match
            // just retrieve the download id?  Can match any other way?

            var downloadLink = "";

            // loop through download link list
            foreach (OrderedDictionary download in entitySet.DownloadLinks)
            {
                if (download["ID"].ToString() == downloadID)
                {
                    downloadLink = download["Link"].ToString();
                    break;
                }
            }


            // send them off to the download
            return(Redirect(downloadLink));
        }
        public DatasetCommentsDataSource()
        {
            IEnumerable <EntitySet> entitySets = new List <EntitySet>();

            foreach (Container container in ContainerAliases)
            {
                var sets = EntitySetRepository.GetEntitySets(container.Alias, null) as List <EntitySet>;
                if (sets != null)
                {
                    entitySets = entitySets.Union(sets);
                }
            }

            var cds = new CommentsDataSource();
            IEnumerable <CommentEntry> comments = cds.SelectAll().Where(t => t.ParentType == ParentType.Dataset.ToString());

            _list = (from es in entitySets
                     join c in comments on es.EntitySetName equals c.DatasetId
                     select new DatasetComment(es.EntityId, es.Name, es.Description, es.CategoryValue, es.ContainerAlias, es.LastUpdateDate, es.EntitySetName, c.Subject, c.Username, c.Email, c.PostedOn));

            _list = _list.OrderBy(c => c.CommentDate)
                    .OrderBy(c => c.DatasetName)
                    .OrderBy(c => c.DatasetCategoryValue)
                    .OrderBy(c => c.DatasetContainerAlias);
        }
Exemplo n.º 3
0
        private void LoadControls(string container, string entitySetName)
        {
            model.ViewDataModel = new DataBrowserModel();
            model.ViewDataModel.EntitySetName = entitySetName;
            model.ViewDataModel.Container     = container;

            EntitySet entitySet = EntitySetRepository.GetEntitySet(container, entitySetName);

            var viewDs = new DatasetInfoDataSource();
            var views  = viewDs.GetAnalyticSummary(Helper.GenerateDatasetItemKey(entitySet.ContainerAlias, entitySet.EntitySetName));

            model.ViewDataModel.EntitySetWrapper = new EntitySetWrapper()
            {
                EntitySet     = entitySet,
                PositiveVotes = views.PositiveVotes,
                NegativeVotes = views.NegativeVotes,
                Views         = views.views_total
            };

            if (!entitySet.IsDownloadOnly && !entitySet.IsEmpty)
            {
                EntitySetDetails metaDataDetails = EntitySetDetailsRepository.GetMetaData(container, entitySetName);
                model.ViewDataModel.EntitySetDetails = metaDataDetails;
            }
        }
Exemplo n.º 4
0
        public DatasetsDataSource()
        {
            _entities = new List <EntitySet>(EntitySetRepository.GetEntitySets().AsEnumerable());

            RateDataSource rds = new RateDataSource();

            _rates = from r in rds.SelectAll() select r;
        }
        public ViewReportDataSource()
        {
            var entities = new List <EntitySet>(EntitySetRepository.GetEntitySets().AsEnumerable());

            var rqds         = new RequestDataSource();
            var requestsList = rqds.Select();


            _entities = entities.ToDictionary(
                e => Helper.GenerateDatasetItemKey(e.ContainerAlias, e.EntitySetName),
                e => e);

            _requestsList = requestsList.ToDictionary(
                e => Helper.GenerateRequestKey(e.RowKey),
                e => e);
        }
 private IEnumerable <EntitySet> GetEntitySets(IEnumerable <string> containers)
 {
     containers = containers ?? from container in AllContainers select container.Alias;
     foreach (var container in containers)
     {
         IEnumerable <EntitySet> sets;
         _entitySets.TryGetValue(container, out sets);
         if (sets == null)
         {
             sets = EntitySetRepository.GetEntitySets(container, null);
             _entitySets.Add(container, sets);
         }
         foreach (var set in sets)
         {
             yield return(set);
         }
     }
 }