Example #1
0
        void LoadDates()
        {
            if (String.IsNullOrEmpty(Connection))
            {
                // Сообщение в лог
                StringBuilder builder = new StringBuilder();
                if (String.IsNullOrEmpty(Connection))
                {
                    builder.Append(Localization.Connection_PropertyDesc);
                }
                LogManager.LogError(this, String.Format(Localization.ControlSettingsNotInitialized_Message, builder.ToString()));
                return;
            }

            if (!String.IsNullOrEmpty(DayLevelUniqueName))
            {
                String query = "Select {" + DayLevelUniqueName +
                               ".Members} on 0, {} on 1 from " + OlapHelper.ConvertToQueryStyle(CubeName);

                IsBusy = true;

                MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                OlapDataLoader.LoadData(args, null);
            }
        }
Example #2
0
        void LoadMembers()
        {
            this.IsWaiting = true;
            if (String.IsNullOrEmpty(Connection))
            {
                // Сообщение в лог
                StringBuilder builder = new StringBuilder();
                if (String.IsNullOrEmpty(Connection))
                {
                    builder.Append(Localization.Connection_PropertyDesc);
                }
                LogManager.LogError(this, String.Format(Localization.ControlSettingsNotInitialized_Message, builder.ToString()));
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                this.viewer.Content     = String.Format(Localization.ControlSettingsNotInitialized_Message,
                                                        builder.ToString());
                this.IsWaiting = false;
                return;
            }

            if (String.IsNullOrEmpty(this.Query))
            {
                if (!String.IsNullOrEmpty(LevelUniqueName))
                {
                    String query = "Select {" + LevelUniqueName +
                                   ".Members} on 0, {} on 1 from " + OlapHelper.ConvertToQueryStyle(CubeName);
                    MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                    OlapDataLoader.LoadData(args, null);
                }
            }
            else
            {
                MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, Query);
                OlapDataLoader.LoadData(args, null);
            }
        }
        void LoadDates()
        {
            if (!String.IsNullOrEmpty(DayLevelUniqueName))
            {
                String query = "Select {" + DayLevelUniqueName +
                               ".Members} on 0, {} on 1 from " + OlapHelper.ConvertToQueryStyle(CubeName);

                IsBusy = true;

                MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                OlapDataLoader.LoadData(args, null);
            }
        }
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            bool stopWaiting = true;

            try
            {
                if (e.Error != null)
                {
                    LogManager.LogError(this, e.Error.ToString());
                    return;
                }

                if (e.Result.ContentType == InvokeContentType.Error)
                {
                    LogManager.LogError(this, e.Result.Content);
                    return;
                }

                MdxQueryArgs mdx_args = e.UserState as MdxQueryArgs;
                if (mdx_args != null)
                {
                    CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
                    InitializeTuple(cs_descr);

                    // Зачитываем метаданные куба в целом
                    stopWaiting = false;
                    LogManager.LogInformation(this, this.Name + " - Loading cube metadata.");
                    MetadataQuery args = CommandHelper.CreateGetCubeMetadataArgs(Connection, CubeName, MetadataQueryType.GetCubeMetadata_AllMembers);
                    OlapDataLoader.LoadData(args, args);
                }

                MetadataQuery metadata_args = e.UserState as MetadataQuery;
                if (metadata_args != null)
                {
                    CubeDefInfo cs_descr = XmlSerializationUtility.XmlStr2Obj <CubeDefInfo>(e.Result.Content);
                    m_CopyControl.InitializeMetadata(cs_descr);
                }
            }
            finally
            {
                if (stopWaiting)
                {
                    IsWaiting = false;
                }
            }
        }
        public void Initialize()
        {
            m_CopyControl.CubeName           = CubeName;
            m_CopyControl.ConnectionID       = Connection;
            m_CopyControl.GetOlapDataLoader += new EventHandler <GetIDataLoaderArgs>(m_CopyControl_GetOlapDataLoader);

            IsWaiting = true;
            LogManager.LogInformation(this, this.Name + " - Calculating Tuple form cell.");
            // MDX запрос может служить источником Tuple. Если запрос задан, то пытаемся его выполнить и в качестве Tuple будем использовать координаты первой ячейки.
            if (!String.IsNullOrEmpty(Query))
            {
                MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, Query);
                OlapDataLoader.LoadData(args, args);
            }
            else
            {
                // Зачитываем метаданне куба в целом
                MetadataQuery args = CommandHelper.CreateGetCubeMetadataArgs(Connection, CubeName, MetadataQueryType.GetCubeMetadata_AllMembers);
                OlapDataLoader.LoadData(args, args);
            }
        }
        void ValueCopyDialog_OkButtonClick(object sender, DialogResultArgs e)
        {
            ModalDialog dlg = sender as ModalDialog;

            if (dlg != null)
            {
                ValueCopyControl copyControl = dlg.Content as ValueCopyControl;
                if (copyControl != null)
                {
                    String query = copyControl.BuildCopyScript();
                    if (!String.IsNullOrEmpty(query))
                    {
                        MdxQueryArgs args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                        args.Type = QueryTypes.Update;
                        OlapDataLoader.LoadData(args, sender);
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
            }
        }