public CollectParametersCommand (ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.reportSettings = reportSettings; }
private void CreateGrouping(ReportSettings settings) { if (!String.IsNullOrEmpty(this.Grouping)){ GroupColumn g = new GroupColumn(Grouping,1,System.ComponentModel.ListSortDirection.Ascending); settings.GroupColumnsCollection.Add(g); } }
public void ConstructorWithEmptyFileName () { ReportSettings rs = new ReportSettings (GlobalValues.DefaultPageSize,reportName,""); Assert.AreEqual(rs.ReportName,reportName,"Should be 'ReportName'"); FileInfo fileInfo = new System.IO.FileInfo(rs.FileName); Assert.AreEqual(GlobalValues.PlainFileName,fileInfo.Name,"Should be 'report1.srd'"); }
public void ConstructorWithEmptyReportName () { ReportSettings rs = new ReportSettings (GlobalValues.DefaultPageSize,"","FileName"); FileInfo fileInfo = new System.IO.FileInfo(rs.FileName); Assert.IsNotNull(rs,"Should not be null"); Assert.AreEqual(GlobalValues.DefaultReportName,rs.ReportName,"Should be 'Report1'"); Assert.AreEqual(fileName,fileInfo.Name); }
// private ListChangedEventArgs resetList = new ListChangedEventArgs(ListChangedType.Reset,-1,-1); // public event EventHandler <ListChangedEventArgs> ListChanged; // public event EventHandler <GroupChangedEventArgs> GroupChanged; #region Constructor protected BaseListStrategy(ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.reportSettings = reportSettings; this.indexList = new IndexList("IndexList"); }
public static ReportDataSource CreateInstance (object dataSource, ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } ReportDataSource instance = new ReportDataSource(dataSource,reportSettings); return instance; }
private DataManager (ReportSettings reportSettings,IDataAccessStrategy dataAccess) { DataSet dataSet = dataAccess.ReadData(); this.Init(reportSettings,dataSet.Tables[0]); this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, reportSettings); }
public TableStrategy(DataTable table,ReportSettings reportSettings):base(reportSettings) { if (table == null) { throw new ArgumentNullException("table"); } this.table = table; }
public void DefaultConstructor () { ReportSettings rs = new ReportSettings(); rs.ConnectionString = "goodConnection"; IDataAccessStrategy da = new MockDataAccessStrategy (rs); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(rs,da); Assert.IsNotNull (dm,"IDataManager should not be 'null"); }
public static ConnectionObject BuildConnectionObject (ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } return ConnectionObject.CreateInstance(reportSettings.ConnectionString, DbProviderFactories.GetFactory("System.Data.OleDb")); }
public void DefaultConstructureShouldReturnStandardValues() { ReportSettings rs = new ReportSettings(); Assert.IsNotNull(rs,"Should not be 'null'"); Assert.AreEqual(GlobalValues.DefaultReportName,rs.ReportName,"Should be 'Report1'"); FileInfo fileInfo = new System.IO.FileInfo(rs.FileName); Assert.AreEqual(GlobalValues.PlainFileName,fileInfo.Name,"Should be 'Report1.srd"); Assert.AreEqual(GlobalValues.DefaultPageSize,rs.PageSize); }
protected BaseListStrategy(ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.ReportSettings = reportSettings; this.IndexList = new IndexList("IndexList"); ExpressionEvaluator = new ExpressionEvaluatorFacade (null); }
public void DataNavigatorNotNull() { ReportSettings rs = new ReportSettings(); rs.ConnectionString = "goodConnection"; IDataAccessStrategy da = new MockDataAccessStrategy (rs); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(rs,da); IDataNavigator dataNav = dm.GetNavigator; Assert.IsNotNull(dataNav,"Navigator should not be 'null'"); }
private ReportDataSource(object dataSource, ReportSettings reportSettings) { this.dataSource = dataSource; this.reportSettings = reportSettings; if (!this.CheckDataSource()) { throw new MissingDataSourceException(); } if (this.reportSettings.DataModel != GlobalEnums.PushPullModel.PushData) { SqlQueryChecker.Check(this.reportSettings.CommandType,this.reportSettings.CommandText); } }
/// <summary> /// use this Constructor for PullDataReports /// </summary> /// <param name="connection">A valid connection</param> /// <param name="reportSettings">a <see cref="ReportSettings"></see></param> #region Constructores public static ReportDataSource CreateInstance (ConnectionObject connectionObject, ReportSettings reportSettings) { if (connectionObject == null) { throw new ArgumentNullException("connectionObject"); } if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } ReportDataSource instance = new ReportDataSource(connectionObject,reportSettings); return instance; }
public void TableCountEqualListCount () { ReportSettings rs = new ReportSettings(); rs.ConnectionString = "goodConnection"; IDataAccessStrategy da = new MockDataAccessStrategy (rs); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(rs,da); Assert.AreEqual(contributorsList.ContributorCollection.Count, dm.GetNavigator.Count, "TableCount should be equal listCount"); }
public CollectionStrategy(IList list,ReportSettings reportSettings):base(reportSettings) { if (list.Count > 0) { firstItem = list[0]; itemType = firstItem.GetType(); this.baseList = new DataCollection <object>(itemType); this.baseList.AddRange(list); } this.listProperties = this.baseList.GetItemProperties(null); }
private DataManager (ReportSettings reportSettings,IDataAccessStrategy dataAccess) { this.dataAccess = dataAccess; if (this.dataAccess.OpenConnection()) { DataSet t = this.dataAccess.ReadData(); this.Init(reportSettings,t.Tables[0]); this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, reportSettings); } }
public SqlDataAccessStrategy(ReportSettings reportSettings,ConnectionObject connectionObject) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.reportSettings = reportSettings; if (connectionObject == null) { this.connectionObject = ConnectionObjectFactory.BuildConnectionObject(reportSettings.ConnectionString); } else { this.connectionObject = connectionObject; } }
public static IDataManager CreateInstance (ReportSettings reportSettings ,IDataAccessStrategy dataAccess) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } if (dataAccess == null) { throw new ArgumentNullException("dataAccess"); } return new DataManager (reportSettings,dataAccess); }
public static IDataManager CreateInstance (IList dataSource, ReportSettings reportSettings) { if (dataSource == null) { throw new ArgumentNullException("dataSource"); } if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } IDataManager instance = new DataManager(dataSource,reportSettings); return instance ; }
protected AbstractRenderer(IReportModel reportModel,ReportDocument reportDocument,ILayouter layout) { if (reportModel == null) { throw new MissingModelException(); } if (reportDocument == null) { throw new ArgumentNullException("reportDocument"); } if (layout == null) { throw new ArgumentNullException("layout"); } this.reportModel = reportModel; this.reportSettings = reportModel.ReportSettings; this.reportDocument = reportDocument; this.layout = layout; this.sections = reportModel.SectionCollection; Init(); }
public void CheckDefaultCollections () { ReportSettings rs = new ReportSettings(); Assert.IsNotNull (rs.AvailableFieldsCollection); Assert.AreEqual (0,rs.AvailableFieldsCollection.Count); Assert.IsNotNull (rs.GroupColumnsCollection); Assert.AreEqual (0,rs.GroupColumnsCollection.Count); Assert.IsNotNull (rs.SortColumnsCollection); Assert.AreEqual (0,rs.SortColumnsCollection.Count); Assert.IsNotNull (rs.ParameterCollection); Assert.AreEqual (0,rs.ParameterCollection.Count); Assert.IsNotNull(rs.AvailableFieldsCollection); Assert.AreEqual(0,rs.AvailableFieldsCollection.Count); }
public static ConnectionObject PrepareConnectionFromParameters (ReportSettings settings, ReportParameters reportParameters) { if (settings == null) { throw new ArgumentNullException("settings"); } ConnectionObject conObj = null; if (reportParameters != null) { if (reportParameters.ConnectionObject != null) { conObj = reportParameters.ConnectionObject; } } if (!String.IsNullOrEmpty(settings.ConnectionString)) { conObj = ConnectionObjectFactory.BuildConnectionObject(settings.ConnectionString); } return conObj; }
public SectionBounds (ReportSettings reportSettings,bool firstPage) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } this.firstPage = firstPage; this.landscape = reportSettings.Landscape; this.PageSize = reportSettings.PageSize; this.printableArea = new Rectangle(reportSettings.LeftMargin,reportSettings.TopMargin, reportSettings.PageSize.Width - reportSettings.RightMargin, reportSettings.PageSize.Height - reportSettings.BottomMargin); this.marginBounds = new Rectangle(reportSettings.LeftMargin, reportSettings.TopMargin, reportSettings.PageSize.Width - reportSettings.LeftMargin - reportSettings.RightMargin, reportSettings.PageSize.Height - reportSettings.TopMargin - reportSettings.BottomMargin); }
private ReportDataSource(ConnectionObject connectionObject, ReportSettings reportSettings) { this.connectionObject = connectionObject; this.reportSettings = reportSettings; this.connection = connectionObject.Connection; if (this.connection.State == ConnectionState.Open) { this.connection.Close(); } if (this.reportSettings.DataModel != GlobalEnums.PushPullModel.PushData) { SqlQueryChecker.Check(this.reportSettings.CommandType,this.reportSettings.CommandText); } this.dataSource = this.FillDataSet().Tables[0]; CheckDataSource(); /* this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, reportSettings); this.dataViewStrategy.ListChanged += new EventHandler <ListChangedEventArgs> (NotifyListChanged); */ }
public static ConnectionObject PrepareConnectionFromParameters(ReportSettings settings, ReportParameters reportParameters) { if (settings == null) { throw new ArgumentNullException("settings"); } ConnectionObject conObj = null; if (reportParameters != null) { if (reportParameters.ConnectionObject != null) { conObj = reportParameters.ConnectionObject; } } if (!String.IsNullOrEmpty(settings.ConnectionString)) { conObj = ConnectionObjectFactory.BuildConnectionObject(settings.ConnectionString); } return(conObj); }
private ReportModel LoadObjectFromXmlDocument(XmlElement elem) { Console.WriteLine("LoadObjectFromXmlDocumen)"); //ReportSettings OpenedFile file =(OpenedFile) host.GetService(typeof(OpenedFile)); BaseItemLoader baseItemLoader = new BaseItemLoader(); XmlNodeList n = elem.FirstChild.ChildNodes; XmlElement rse = (XmlElement) n[0]; ReportModel model = ReportModel.Create(); // manipulate reportSettings if Filename differs this.reportSettings = baseItemLoader.Load(rse) as ReportSettings; if (this.reportSettings.FileName.CompareTo(file.FileName) != 0) { System.Diagnostics.Trace.WriteLine("LoadObjectFromXmlDocument - filename changed" ); this.reportSettings.FileName = file.FileName; } model.ReportSettings = this.reportSettings; host.Container.Add(this.reportSettings); //Move to SectionCollection XmlNodeList sectionList = elem.LastChild.ChildNodes; foreach (XmlNode sectionNode in sectionList) { try { object o = this.Load(sectionNode as XmlElement,null); BaseSection section = o as BaseSection; ConvertAbsolut2RelativePath(section.Controls,this.reportSettings.FileName); // ConvertAbsolut2RelativePath(section,this.reportSettings.FileName); host.Container.Add(section); } catch (Exception e) { MessageService.ShowException(e); } } return model; }
public void DataRowCountEqualListCount () { ReportSettings rs = new ReportSettings(); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection,rs); DataNavigator dataNav = dm.GetNavigator; int count = 0; while (dataNav.MoveNext()) { CurrentItemsCollection c = dataNav.GetDataRow(); if ( c != null) { count ++; } } Assert.AreEqual(this.contributorCollection.Count,count); }
public void CreatePlainDataRow () { ReportSettings rs = new ReportSettings(); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection,rs); DataNavigator dataNav = dm.GetNavigator; while (dataNav.MoveNext()) { CurrentItemsCollection c = dataNav.GetDataRow(); Assert.AreEqual(typeof(string),c[0].DataType); Assert.AreEqual(typeof(string),c[1].DataType); Assert.AreEqual(typeof(string),c[2].DataType); Assert.AreEqual(typeof(int),c[3].DataType); Assert.AreEqual(typeof(DateTime),c[4].DataType); } }
public void SortDescendingByOneColumn() { SortColumn sc = new SortColumn("Last",System.ComponentModel.ListSortDirection.Descending); ReportSettings rs = new ReportSettings(); rs.SortColumnCollection.Add(sc); IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection,rs); DataNavigator dataNav = dm.GetNavigator; string compareTo = "z"; while (dataNav.MoveNext()) { Contributor view = dataNav.Current as Contributor; string actual = view.Last; Assert.GreaterOrEqual(compareTo,actual); // string ss = String.Format("< {0} > <{1}>",compareTo,actual); // Console.WriteLine(ss); compareTo = actual; } Assert.IsTrue(dataNav.IsSorted); }
/// <summary> /// use this Constructor for PullDataReports /// </summary> /// <param name="connection">A valid connection</param> /// <param name="reportSettings">a <see cref="ReportSettings"></see></param> #region Constructores public static ReportDataSource CreateInstance(ConnectionObject connectionObject, ReportSettings reportSettings) { if (connectionObject == null) { throw new ArgumentNullException("connectionObject"); } if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } ReportDataSource instance = new ReportDataSource(connectionObject, reportSettings); return(instance); }
private DataManager(DataTable dataSource, ReportSettings reportSettings) { this.Init(reportSettings, dataSource); this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource, reportSettings); }
private void Init(ReportSettings reportSettings, object dataSource) { CheckReportSettings(reportSettings); CheckDataSource(dataSource); }
private DataManager(IList dataSource, ReportSettings reportSettings) { this.Init(reportSettings, dataSource); this.dataViewStrategy = new CollectionStrategy((IList)this.dataSource, reportSettings); }