Esempio n. 1
0
        public void SyncFromPowerBI(PBIAPIClient powerBiAPI = null)
        {
            if (powerBiAPI == null)
            {
                if (ParentPowerBIAPI == null)
                {
                    throw new Exception("No PowerBI API Object was supplied!");
                }
                else
                {
                    powerBiAPI = ParentPowerBIAPI;
                }
            }

            PBIDataset temp;

            try
            {
                if (string.IsNullOrEmpty(this.Id))
                {
                    if (ParentGroup == null)
                    {
                        temp = powerBiAPI.GetDatasetByName(this.Name);
                    }
                    else
                    {
                        temp = ParentGroup.GetDatasetByName(this.Name);
                    }
                }
                else
                if (ParentGroup == null)
                {
                    temp = powerBiAPI.GetDatasetByID(this.Id);
                }
                else
                {
                    temp = ParentGroup.GetDatasetByID(this.Id);
                }

                if (temp != null)
                {
                    this.Id = temp.Id;
                    this.AddRowsAPIEnabled  = temp.AddRowsAPIEnabled;
                    this.ConfiguredBy       = temp.ConfiguredBy;
                    this.DefaultMode        = temp.DefaultMode;
                    this.Relationships      = temp.Relationships;
                    this.Datasources        = temp.Datasources;
                    this.GatewayDatasources = temp.GatewayDatasources;

                    this.LoadTablesFromPowerBI();
                    this.LoadDatasourcesFromPowerBI();
                }
            }
            catch (Exception e)
            {
            }
        }
        public void SyncFromPowerBI(PBIAPIClient powerBiAPI = null)
        {
            if (powerBiAPI == null)
            {
                if (ParentPowerBIAPI == null)
                {
                    throw new Exception("No PowerBI API Object was supplied!");
                }
                else
                {
                    powerBiAPI = ParentPowerBIAPI;
                }
            }

            PBIDataset temp;

            try
            {
                if (string.IsNullOrEmpty(this.Id))
                {
                    if (ParentGroup == null)
                    {
                        temp = powerBiAPI.GetDatasetByName(this.Name);
                    }
                    else
                    {
                        temp = ParentGroup.GetDatasetByName(this.Name);
                    }
                }
                else
                if (ParentGroup == null)
                {
                    temp = powerBiAPI.GetDatasetByID(this.Id);
                }
                else
                {
                    temp = ParentGroup.GetDatasetByID(this.Id);
                }

                if (temp != null)
                {
                    this.Id = temp.Id;
                    this.AddRowsAPIEnabled = temp.AddRowsAPIEnabled;

                    foreach (PBITable table in temp.Tables)
                    {
                        this.AddOrUpdateTable(table);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }