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; } } }
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); }
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(); }
private String ExportToExcel(String schema) { InvokeResultDescriptor result = new InvokeResultDescriptor(); String res = String.Empty; try { String sessionId = String.Empty; String connection = String.Empty; try { MdxQueryArgs args = XmlSerializationUtility.XmlStr2Obj <MdxQueryArgs>(schema); if (args != null) { sessionId = args.SessionId; connection = args.Connection; DefaultQueryExecuter queryExecuter = new DefaultQueryExecuter(GetConnection(args.Connection)); if (args.Queries.Count > 0) { res = queryExecuter.GetCellSetDescription(args.Queries[0], ref sessionId); } } } catch (AdomdConnectionException connection_ex) { result.Content = connection_ex.Message; result.ContentType = InvokeContentType.Error; } catch (AdomdErrorResponseException response_ex) { result.Content = response_ex.Message; result.ContentType = InvokeContentType.Error; } catch (AdomdUnknownResponseException unknown_ex) { result.Content = unknown_ex.Message; result.ContentType = InvokeContentType.Error; } catch (InvalidOperationException invalid_ex) { result.Content = invalid_ex.Message; result.ContentType = InvokeContentType.Error; } if (!String.IsNullOrEmpty(res)) { CellSetData cs = CellSetData.Deserialize(res); PivotDataProvider pivotProvider = new PivotDataProvider(new CellSetDataProvider(cs)); res = ExportHelper.ExportToExcel(pivotProvider); } result.Content = res; if (UseCompress) { // Архивация строки String compesed = ZipCompressor.CompressAndConvertToBase64String(res); result.Content = compesed; result.IsArchive = true; } result.ContentType = InvokeContentType.MultidimData; result.Headers.Add(new Header(InvokeResultDescriptor.SESSION_ID, sessionId)); result.Headers.Add(new Header(InvokeResultDescriptor.CONNECTION_ID, connection)); } catch (Exception) { throw; } return(InvokeResultDescriptor.Serialize(result)); }