Example #1
0
        void GetCubes_InvokeCommandCompleted(DataLoaderEventArgs e, CustomTreeNode parentNode)
        {
            OlapDataLoader.DataLoaded -= new EventHandler <DataLoaderEventArgs>(OlapDataLoader_DataLoaded);
            List <CubeDefInfo> cubes = XmlSerializationUtility.XmlStr2Obj <List <CubeDefInfo> >(e.Result.Content);

            InitCubesList(cubes);
        }
        void StorageManager_ActionCompleted(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

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

            StorageActionArgs args = e.UserState as StorageActionArgs;

            if (args != null)
            {
                if (args.ActionType == StorageActionTypes.Load)
                {
                    ValueCopySettingsWrapper wrapper = XmlSerializationUtility.XmlStr2Obj <ValueCopySettingsWrapper>(e.Result.Content);
                    m_CopyControl.Initialize(wrapper);
                }
            }
        }
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            CustomTreeNode parentNode = e.UserState as CustomTreeNode;

            if (parentNode != null)
            {
                parentNode.IsWaiting = false;
            }
            else
            {
                Tree.IsWaiting = false;
            }

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

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

            List <CubeDefInfo> cubes = XmlSerializationUtility.XmlStr2Obj <List <CubeDefInfo> >(e.Result.Content);

            if (cubes != null)
            {
                foreach (CubeDefInfo info in cubes)
                {
                    if (ShowAllCubes || info.Type == CubeInfoType.Cube)
                    {
                        CubeTreeNode node = new CubeTreeNode(info);
                        // Кубы будут конечными узлами. Двойной клик на них будет равнозначен выбору
                        node.Expanded  += new RoutedEventHandler(node_Expanded);
                        node.Collapsed += new RoutedEventHandler(node_Collapsed);

                        if (parentNode == null)
                        {
                            Tree.Items.Add(node);
                        }
                        else
                        {
                            parentNode.Items.Add(node);
                        }
                    }
                }
            }
        }
        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;
                }
            }
        }
Example #5
0
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            CustomTreeNode parentNode = null;

            // Метаданные
            UserSchemaWrapper <MetadataQuery, CustomTreeNode> metadata_wrapper = e.UserState as UserSchemaWrapper <MetadataQuery, CustomTreeNode>;

            if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
            {
                Cubes_ComboBox.Clear();
            }

            if (e.Error != null)
            {
                m_CubeBrowser.ShowErrorInTree(parentNode);
                if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
                {
                    Cubes_ComboBox.IsEnabled = false;
                    Cubes_ComboBox.Clear();
                }
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                if (metadata_wrapper != null && metadata_wrapper.Schema.QueryType == MetadataQueryType.GetCubes)
                {
                    Cubes_ComboBox.IsEnabled = false;
                    Cubes_ComboBox.Clear();
                }
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            if (metadata_wrapper != null)
            {
                switch (metadata_wrapper.Schema.QueryType)
                {
                case MetadataQueryType.GetCubes:
                    GetCubes_InvokeCommandCompleted(e, parentNode);
                    break;
                }
            }
        }
Example #6
0
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                this.viewer.Content     = e.Error.ToString();
                this.IsWaiting          = false;
                return;
            }

            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                this.viewer.Content     = e.Result.Content;
                this.IsWaiting          = false;
                return;
            }

            try
            {
                CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);
                OnDatesLoaded(cs_descr);
                UpdateGridCells();
                this.IsWaiting = false;
            }
            catch (Exception exc)
            {
                this.IsWaiting          = false;
                this.m_Clear.Visibility = System.Windows.Visibility.Collapsed;
                LogManager.LogError(this, exc.Message);
                throw new Exception(exc.Message);
                //this.viewer.Content = exc.Message;
                //throw exc;
            }
            //CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
        }
Example #7
0
        void Loader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            IsBusy = false;

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

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

            //CellSetData cs_descr = XmlSerializationUtility.XmlStr2Obj<CellSetData>(e.Result);
            CellSetData cs_descr = CellSetData.Deserialize(e.Result.Content);

            OnDatesLoaded(cs_descr);

            UpdateDates();
        }
Example #8
0
        void OlapDataLoader_DataLoaded(object sender, DataLoaderEventArgs e)
        {
            // Exception
            if (e.Error != null)
            {
                LogManager.LogError(this, e.Error.ToString());
                return;
            }

            // Exception or Message from Olap-Service
            if (e.Result.ContentType == InvokeContentType.Error)
            {
                LogManager.LogError(this, e.Result.Content);
                return;
            }

            if (e.Result != null)
            {
                String connectionId = String.Empty;
                if (e.Result.Headers.Contains(InvokeResultDescriptor.CONNECTION_ID))
                {
                    Header connection_header = e.Result.Headers[InvokeResultDescriptor.CONNECTION_ID];
                    if (connection_header != null)
                    {
                        connectionId = connection_header.Value;
                    }
                }

                if (connectionId == Connection)
                {
                    // Commit or Rollback Transaction
                    MdxQueryArgs query_args = e.UserState as MdxQueryArgs;
                    if (query_args != null)
                    {
                        if (query_args.Type == QueryTypes.CommitTransaction ||
                            query_args.Type == QueryTypes.RollbackTransaction)
                        {
                            if (e.Result.ContentType == InvokeContentType.UpdateResult)
                            {
                                List <String> results = XmlSerializationUtility.XmlStr2Obj <List <String> >(e.Result.Content);
                                if (results != null)
                                {
                                    var           errors = results.Where(res => !String.IsNullOrEmpty(res));
                                    StringBuilder sb     = new StringBuilder();
                                    //if (errors.Count() == 0)
                                    //    AnalysisTransactionManager.CloseTransaction(Connection);
                                    //else
                                    //{
                                    foreach (var error in errors)
                                    {
                                        sb.AppendLine(error);
                                    }
                                    if (!String.IsNullOrEmpty(sb.ToString()))
                                    {
                                        LogManager.LogError(this, sb.ToString());
                                    }
                                    //}

                                    // В случае ошибки считаем что транзакция закрыта. И кэш чистим.
                                    OlapTransactionManager.CloseTransaction(Connection);
                                }
                            }
                        }
                    }
                }
            }
        }