예제 #1
0
        /// <summary>
        /// Get configured DataMart description for a network datamart
        /// </summary>
        /// <param name="DataMartId">DataMart Id</param>
        /// <returns>DataMart Description object</returns>
        public DataMartDescription GetDataMartDescription(Guid dataMartId)
        {
            DataMartDescription returnDescription = null;

            try
            {
                if (null != DataMartList && DataMartList.Count > 0)
                {
                    foreach (DataMartDescription dd in DataMartList)
                    {
                        if (dd != null && dd.DataMartId == dataMartId)
                        {
                            returnDescription = dd;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnDescription);
        }
예제 #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;
            }
        }