internal virtual void Restore(OlapControl grid) { if (grid.IsRestored) { return; } var rc = grid.Cube; if (rc == null) { return; } rc.RestoreCube(); grid.Cube = rc; grid.BeginUpdate(); try { ms.Position = 0; var ds = new DeflateStream(ms, CompressionMode.Decompress); var b = new byte[length + 4096]; var br = ReadAllBytesFromStream(ds, b); var tmp = new MemoryStream(b); tmp.Position = 0; var reader = new BinaryReader(tmp); (grid as IStreamedObject).ReadStream(reader, null); grid.FLayout.fGrid = grid; if (grid.FCellSet != null) { grid.FCellSet.FGrid = grid; grid.FCellSet.RestoreAfterSerialization(grid); } if (grid.FCellSet != null) { var i = grid.CellSet.FValueSortedColumn; if (i >= 0) { grid.CellSet.Rebuild(); grid.CellSet.ValueSortedColumn = i; } } grid.IsRestored = true; } #if DEBUG catch (Exception e) { } #endif finally { grid.EndUpdate(); } }
internal virtual void LoadTo(OlapControl aGrid) { DebugLogging.WriteLine("OlapAxisLayoutSerializer.LoadTo"); if (!aGrid.Active) { return; } aGrid.FEmptyDataString = EmptyDataString; aGrid.FCurrencyFormatString = CurrencyFormatString; aGrid.BeginUpdate(); Clear(aGrid); if (AxesLayout != null) { aGrid.FLayout.fMeasureLayout = AxesLayout.MeasureLayout; aGrid.FLayout.fMeasurePosition = AxesLayout.MeasurePosition; aGrid.FLayout.fHideMeasureIfPossible = AxesLayout.HideMeasureIfPossible; aGrid.FLayout.fHideMeasureModesIfPossible = AxesLayout.HideMeasureModesIfPossible; aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection; aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn; } var assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList(); LoadMeasuresXandY(aGrid, assignedMeasures); LoadHierarchies(aGrid, assignedMeasures); aGrid.FCellSet.Rebuild(); LoadMeasures(aGrid); assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList(); aGrid.FCellSet.Rebuild(); if (AxesLayout != null) { aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection; aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn; } foreach (var item in assignedMeasures) { aGrid.Pivoting(item, LayoutArea.laRow, null, LayoutArea.laNone); } LoadComments(aGrid); LoadColumnsWidth(aGrid); aGrid.EndUpdate(); }
internal virtual void ReadXMLInner(Stream stream) { DebugLogging.WriteLine("OlapAxisLayoutSerializer.ReadXMLInner"); if (fGrid != null) { fGrid.BeforLoad(fGrid, EventArgs.Empty); } #region code of old vertions file (web saving) // define signal string // content of web-versions file: // #1: <?xml version="1.0"?> // #2: <OlapGridSerializer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> // # etc ... // stream.Position = 0; var sr = new StreamReader(stream, Encoding.UTF8); stream.Position = 0; var alldata = sr.ReadToEnd(); // its Web-like saved !!! //if ((!string.IsNullOrEmpty(lines[1])) && (string.Compare(lines[1], signalstr) == 0)) if (alldata.Contains(_signalstr)) { stream.Position = 0; sr = new StreamReader(stream, Encoding.UTF8); alldata = alldata.Replace(_signalstr, @"<OlapAxisLayoutSerializer>"); alldata = alldata.Replace(@"</OlapGridSerializer>", @"</OlapAxisLayoutSerializer>"); var ms = new MemoryStream(); var sw = new StreamWriter(ms); sw.Write(alldata); sw.Flush(); var bf = XmlSerializator.GetXmlSerializer(typeof(OlapAxisLayoutSerializer)); #if OLAPWINFORMS if (fGrid != null) { fGrid.Cursor = System.Windows.Forms.Cursors.WaitCursor; } #endif ms.Position = 0; var g = (OlapAxisLayoutSerializer)bf.Deserialize(ms); if (fGrid != null) { g.fGrid = fGrid; g.LoadTo(fGrid); #if OLAPWINFORMS fGrid.Cursor = System.Windows.Forms.Cursors.Default; #endif fGrid.AfterLoad(fGrid, new OnSerializeArgs(g)); } return; } #endregion end of web-xml reading _SOLAPGrid = fGrid; var bf1 = XmlSerializator.GetXmlSerializer(GetType()); stream.Flush(); stream.Position = 0; if (fGrid != null) { var g1 = (OlapGridSerializer)bf1.Deserialize(stream); g1.fGrid = fGrid; g1.SuppressSaveOLAPSlices = SuppressSaveOLAPSlices; fGrid._IsReadXMLProcessing = true; if (!fGrid.IsUpdating) { fGrid.BeginUpdate(); g1.LoadTo(fGrid); fGrid.EndUpdate(); } else { g1.LoadTo(fGrid); } fGrid.AfterLoad(fGrid, new OnSerializeArgs(g1)); fGrid._IsReadXMLProcessing = false; } _SOLAPGrid = null; }
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); }