Beispiel #1
0
        public LoaderOutput GetLoaderOutput(BaseConfig config)
        {
            LoaderOutput lo = new LoaderOutput();

            switch (config.SourceType)
            {
            case SourceType.XML:
            {
                Picker = new XMLPicker();
                break;
            }

            case SourceType.Server:
            {
                Picker = new ServerPicker();
                break;
            }

            default:
            {
                throw new Exception("Niepoprawny typ danych w pliku konfiguracyjnym (SourceType)");
            }
            }

            lo = Picker.Load(config as BaseConfig);
            lo.CalculationScript = CleanScript(lo.CalculationScript);

            return(lo);
        }
Beispiel #2
0
        public void LoadCubeObjects()
        {
            LoaderOutput lo = scriptLoader.GetLoaderOutput(Config);

            dbc.AddScript(lo.CalculationScript);
            dbc.AddObjActionToDB(lo.ActionList);
            dbc.AddObjKpiToDB(lo.KpiList);
            dbc.AddObjMeasureToDB(lo.MeasureList);
        }
Beispiel #3
0
        public LoaderOutput Load(BaseConfig config)
        {
            LoaderOutput lo = new LoaderOutput();

            XMLConfig           cg = new XMLConfig(config.Params);
            XDocument           dc = XDocument.Load(cg.Path());
            XmlNamespaceManager nm = new XmlNamespaceManager(new NameTable());

            nm.AddNamespace("x", @"http://schemas.microsoft.com/analysisservices/2003/engine");
            string xPath = @"/x:Cube/x:MdxScripts/x:MdxScript/x:Commands/x:Command/x:Text";

            XElement e = dc.XPathSelectElements(xPath, nm).Single();

            lo.CalculationScript = e.Value;

            return(lo);
        }
Beispiel #4
0
        public LoaderOutput Load(BaseConfig config)
        {
            ServerConfig cg  = new ServerConfig(config.Params);
            Server       srv = new Server();

            srv.Connect(cg.SsasConnString());

            Database db = srv.Databases.FindByName(cg.SsasDatabaseName());
            Cube     cb = db.Cubes.FindByName(cg.SsasCubeName());
            Command  cm = cb.MdxScripts[0].Commands[0];

            //  Populate LoaderOutput
            //  ------------------------------------------------------------------------
            LoaderOutput lo = new LoaderOutput
            {
                CalculationScript = cm.Text
            };

            foreach (MeasureGroup mg in cb.MeasureGroups)
            {
                foreach (Measure m in mg.Measures)
                {
                    lo.MeasureList.Add(new ObjMeasure()
                    {
                        Name            = m.Name,
                        MeasureGroup    = mg.Name,
                        DisplayFolder   = m.DisplayFolder,
                        FormatString    = m.FormatString,
                        Source          = m.Source.ToString(),
                        SourceCollation = m.Source.Collation,
                        SourceDataType  = m.Source.DataType.ToString(),
                        SourceDataSize  = m.Source.DataSize,
                        DateCreated     = DateTime.Now,
                        DateModified    = DateTime.Now
                    });
                }
            }

            foreach (Microsoft.AnalysisServices.Action a in cb.Actions)
            {
                lo.ActionList.Add(new ObjAction
                {
                    Name         = a.Name,
                    Caption      = a.Caption,
                    CaptionIsMdx = a.CaptionIsMdx,
                    Condition    = a.Condition,
                    Description  = a.Description,
                    Target       = a.Target,
                    TargetType   = a.TargetType.ToString(),
                    Type         = a.Type.ToString(),
                    DateCreated  = DateTime.Now,
                    DateModified = DateTime.Now
                }
                                  );
            }

            foreach (Kpi k in cb.Kpis)
            {
                lo.KpiList.Add(new ObjKpi
                {
                    Name                   = k.Name,
                    Weight                 = k.Weight,
                    StatusGraphic          = k.StatusGraphic,
                    TrendGraphic           = k.TrendGraphic,
                    AssociatedMeasureGroup = k.AssociatedMeasureGroup.Name,
                    DisplayFolder          = k.DisplayFolder,
                    Value                  = k.Value,
                    Trend                  = k.Trend,
                    Goal                   = k.Goal,
                    DateCreated            = DateTime.Now,
                    DateModified           = DateTime.Now
                }
                               );
            }

            srv.Disconnect();
            return(lo);
        }