예제 #1
0
        internal virtual bool RaiseCallback(string eventArgument)
        {
            CommonToolboxButton btn;

            if (eventArgument.StartsWith("connect|"))
            {
                var args   = eventArgument.Split('|');
                var server = OlapControl.Session.GetString(OlapControl.ClientID + "server") ??
                             fConnectButton.LoginWindowSettings.ServerName;
                var db = OlapControl.Session.GetString(OlapControl.ClientID + "$db") ??
                         fConnectButton.LoginWindowSettings.DatabaseName;
                var e = new ToolboxItemActionArgs(fConnectButton);
                if (OnToolboxItemAction(e))
                {
                    callbackResult = e.ResultValue;
                    if (e.Handled)
                    {
                        return(true);
                    }
                }

                MDCube.Activate(server, db, args[1], "");

                OlapControl.callbackData = CallbackData.Toolbox;
                OlapControl.postbackData = PostbackData.All;

                return(true);
            }
            if (eventArgument.StartsWith("execmdx|"))
            {
                var args = eventArgument.Split('|');
                fMDXQueryButton.MDX = args[1];

                var e = new ToolboxItemActionArgs(fMDXQueryButton);
                if (OnToolboxItemAction(e))
                {
                    callbackResult = e.ResultValue;
                    if (e.Handled)
                    {
                        return(true);
                    }
                }

                if (MDCube != null && OlapControl != null)
                {
                    MDCube.ExecuteMDX(args[1], OlapControl);
                }

                OlapControl.callbackData = CallbackData.Toolbox;
                OlapControl.postbackData = PostbackData.All;

                return(true);
            }

            var argss = eventArgument.Split('|');

            if (fToolItems.TryGetValue(argss[0], out btn))
            {
                var e = new ToolboxItemActionArgs(btn);
                if (OnToolboxItemAction(e))
                {
                    callbackResult = e.ResultValue;
                    if (e.Handled)
                    {
                        return(true);
                    }
                }

                if (OlapControl != null)
                {
                    if (argss.Length > 1 && argss[1].IsFill() && OlapControl != null)
                    {
                        var chartsTypesObj = JsonConvert.DeserializeObject <ChartTypesJson>(argss[1]);

                        if (chartsTypesObj != null && chartsTypesObj.chartTypes != null)
                        {
                            OlapControl.ChartsType = new SeriesType[chartsTypesObj.chartTypes.Length];

                            for (var i = 0; i < chartsTypesObj.chartTypes.Length; i++)
                            {
                                OlapControl.ChartsType[i] = (SeriesType)chartsTypesObj.chartTypes[i];
                            }
                        }
                    }
                    if (btn == fConnectButton && OlapControl != null)
                    {
                        return(true);
                    }
                    if (btn == fAllAreasButton && OlapControl != null)
                    {
                        OlapControl.ShowAreasMode = rsShowAreasOlapGrid.rsAll;
                        OlapControl.callbackData  = CallbackData.Toolbox;
                        OlapControl.postbackData  = PostbackData.OlapGridContainer;
                        return(true);
                    }
                    if (btn == fClearLayoutButton && OlapControl != null)
                    {
                        OlapControl.AxesLayout.Clear();
                        OlapControl.callbackData = CallbackData.Toolbox;
                        OlapControl.postbackData = PostbackData.OlapGridContainer;
                        return(true);
                    }
                    if (btn == fPivotAreaButton && OlapControl != null)
                    {
                        OlapControl.ShowAreasMode = rsShowAreasOlapGrid.rsPivot;
                        OlapControl.callbackData  = CallbackData.Toolbox;
                        OlapControl.postbackData  = PostbackData.OlapGridContainer;
                        return(true);
                    }
                    if (btn == fDataAreaButton && OlapControl != null)
                    {
                        OlapControl.ShowAreasMode = rsShowAreasOlapGrid.rsDataOnly;
                        OlapControl.callbackData  = CallbackData.Toolbox;
                        OlapControl.postbackData  = PostbackData.OlapGridContainer;
                        return(true);
                    }
                    if (btn == FModeButton && OlapControl != null)
                    {
                        OlapControl.BeginUpdate();

                        //OlapControl.AxesLayout.Clear();
                        //OlapControl.CellSet.ClearMembers();
                        //OlapControl.CellSet.FDrillActions.Clear();

                        OlapControl.ClearAxesLayout();
                        OlapControl.Active = false;
                        OlapControl.Active = true;

                        ((OlapAnalysis)OlapControl).HandleInitOlap();

                        OlapControl.EndUpdate();

                        OlapControl.AnalysisType = OlapControl.AnalysisType == AnalysisType.Chart
                            ? AnalysisType.Grid
                            : AnalysisType.Chart;
                        OlapControl.callbackData = CallbackData.Toolbox;
                        OlapControl.postbackData = PostbackData.OlapGridContainer;
                        ((OlapAnalysis)OlapControl)._needInitialization = true;
                        return(true);
                    }
                    //if ((btn == fChartModeButton) && (Grid != null))
                    //{
                    //    OlapControl.AnalysisType = AnalysisType.Chart;
                    //    //OlapControl.UpdateCellSet();
                    //    return;
                    //}

                    if (btn == fResizingButton && OlapControl != null)
                    {
                        OlapControl.AllowResizing = !OlapControl.AllowResizing;

                        if (OlapControl.AllowResizing)
                        {
                            OlapControl.UseFixedHeaders = false;
                        }

                        OlapControl.UpdateCellSet();
                        OlapControl.callbackData = CallbackData.Toolbox;
                        ((OlapAnalysis)OlapControl)._needInitialization = true;
                        OlapControl.postbackData = PostbackData.ToolboxData;
                        return(true);
                    }

                    if (btn == fDelayPivotingButton && OlapControl != null)
                    {
                        OlapControl.DelayPivoting = !OlapControl.DelayPivoting;
                        OlapControl.callbackData  = CallbackData.Toolbox;
                        OlapControl.postbackData  = PostbackData.ToolboxData;
                        return(true);
                    }
                }
            }

            return(false);
        }