private void Initialization() { if (tableDataSource == null) { DataTable filterRefTable = DataSourceHelper.GetDataTable(DataSource); // Initialization SessionWorker if (SessionWorker == null) { var sw = new SessionWorker { Key = Guid.NewGuid().ToString() }; sw.SetSession(HttpContext.Current.Session); sw.Object = filterRefTable.DataSet; SessionWorker = sw; } // Initialization tableDataSource Type tableAdapterType = TableAdapterTools.GetTableAdapterType(filterRefTable.GetType()); tableDataSource = new TableDataSource { ID = "tableDataSource_ID", TypeName = tableAdapterType.FullName, SelectMethod = this._storage.SelectMethod, FillType = TableDataSourceFillType.ParametersNotChanged, SessionWorker = this.SessionWorker, SetFilterByCustomConditions = false, }; tableDataSource.View.CustomConditions.AddRange(_storage.CustomConditions); } }
protected override void AddControls(BaseReportCondition[] conditions) { foreach (var condition in conditions) { var supportSessionWorker = condition.ColumnFilter as ISupportSessionWorker; if (supportSessionWorker == null) { continue; } var dataSource = GetDataTable(condition.ColumnFilter.GetStorage()); if (dataSource == null || _session == null) { supportSessionWorker.SessionWorker = _sessionWorker; } else { if (_dataSetSessions.ContainsKey(dataSource.DataSet)) { supportSessionWorker.SessionWorker = _dataSetSessions[dataSource.DataSet]; } else { string key = Plugin.GetType().Name + "_" + dataSource.DataSet.DataSetName; int i = 0; while (_sessionKeys.Contains(key)) { key = Plugin.GetType().Name + "_" + dataSource.DataSet.DataSetName + i++; } var sWorker = new SessionWorker(); sWorker.SetSession(_session); sWorker.Key = key; if (sWorker.Object == null || sWorker.Object.GetType() != dataSource.DataSet.GetType()) { sWorker.Object = dataSource.DataSet; } _sessionKeys.Add(key); _dataSetSessions.Add(dataSource.DataSet, sWorker); supportSessionWorker.SessionWorker = sWorker; } } } // _filters.AddRange(conditions); _requireNewControls = true; }