Exemplo n.º 1
0
        IObservable <HubRequest> LoadRequestImpl(Guid id, Guid dataMartId)
        {
            var dm = Network.DataMartList.FirstOrDefault(d => d.DataMartId == dataMartId);

            return(from r in DnsServiceManager.GetRequests(Network, new[] { id }, dataMartId).SkipWhile(r => r.ID != id).Take(1)

                   let rt = r.Routings.EmptyIfNull().FirstOrDefault(x => x.DataMartID == dataMartId)
                            where rt != null

                            select new HubRequest
            {
                Source = r,
                DataMartId = dataMartId,
                NetworkId = Network.NetworkId,
                NetworkName = Network.NetworkName,
                DataMartName = dm == null ? null : dm.DataMartName,
                DataMartOrgId = dm == null ? null : dm.OrganizationId,
                DataMartOrgName = dm == null ? null : dm.OrganizationName,
                ProjectName = r != null && r.Project != null ? r.Project.Name : null,

                Properties = rt.Properties.EmptyIfNull().GroupBy(p => p.Name).ToDictionary(pp => pp.Key, pp => pp.First().Value),
                Rights = r.Routings.Where(rn => rn.DataMartID == dataMartId).Select(rn => (HubRequestRights)rn.Rights).FirstOrDefault(),
                RoutingStatus = rt.Status,
                SubmittedDataMarts = string.Join(", ", from rtng in r.Routings
                                                 join dmt in Network.DataMartList on rtng.DataMartID equals dmt.DataMartId
                                                 select dmt.DataMartName),
                Documents = r.Documents.EmptyIfNull().ToArray()
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the DataMart owned by the current user
        /// </summary>
        public List <DataMartDescription> GetDataMartsByUser()
        {
            try
            {
                // Call the method to return the DataMarts owned by the current user
                HubDataMart[] _dataMart = DnsServiceManager.GetDataMarts(this);

                if (_dataMart == null || _dataMart.Length == 0)
                {
                    NetworkMessage = "You are not listed as the Administrator for any DataMarts.  Please contact your system administrator.";
                    return(null);
                }

                var TempDatamartList = new List <DataMartDescription>();

                foreach (HubDataMart dm in _dataMart)
                {
                    if (null != dm)
                    {
                        DataMartDescription dd = new DataMartDescription();
                        dd.DataMartId               = dm.DataMartId;
                        dd.DataMartName             = dm.DataMartName;
                        dd.OrganizationId           = dm.OrganizationId;
                        dd.OrganizationName         = dm.OrganizationName;
                        dd.PollingInterval          = 60;
                        dd.AllowUnattendedOperation = false;
                        TempDatamartList.Add(dd);
                    }
                }

                if (_DataMartList != null)
                {
                    foreach (DataMartDescription dd in TempDatamartList)
                    {
                        foreach (DataMartDescription ddExisting in _DataMartList)
                        {
                            if (ddExisting.DataMartId == dd.DataMartId)
                            {
                                dd.DataSourceName                       = ddExisting.DataSourceName;
                                dd.AllowUnattendedOperation             = ddExisting.AllowUnattendedOperation;
                                dd.PollingInterval                      = ddExisting.PollingInterval;
                                dd.ProcessQueriesAndNotUpload           = ddExisting.ProcessQueriesAndNotUpload;
                                dd.ProcessQueriesAndUploadAutomatically = ddExisting.ProcessQueriesAndUploadAutomatically;
                                dd.ThreshHoldCellCount                  = ddExisting.ThreshHoldCellCount;
                                dd.NotifyOfNewQueries                   = ddExisting.NotifyOfNewQueries;
                                dd.ModelList = (from model in DnsServiceManager.GetModels(dd.DataMartId, this).EmptyIfNull()
                                                join e in ddExisting.ModelList on model.Id equals e.ModelId into exts
                                                from ex in exts.DefaultIfEmpty()
                                                let e = ex ?? new ModelDescription {
                                    ModelId = model.Id
                                }
                                                let _1 = e.ProcessorId = model.ModelProcessorId
                                                                         let _2 = e.ModelName = model.Name
                                                                                                select e
                                                ).ToList();
                            }
                        }
                    }
                }

                _DataMartList = TempDatamartList;
                return(_DataMartList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }