Example #1
0
        public static IDataManager CreateDataManager(IReportModel reportModel, ReportParameters reportParameters)
        {
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            IDataManager        dataManager      = null;
            ConnectionObject    connectionObject = null;
            IDataAccessStrategy accesStrategy    = null;

            if (reportParameters != null)
            {
                connectionObject = reportParameters.ConnectionObject;
            }

            if (connectionObject != null)
            {
                accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings, connectionObject);
            }
            else
            {
                accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings, null);
            }
            dataManager = DataManager.CreateInstance(reportModel.ReportSettings, accesStrategy);
            if (dataManager == null)
            {
                throw new MissingDataManagerException();
            }
            return(dataManager);
        }
Example #2
0
		private DataSet FillGrid() 
		{
			SqlQueryChecker.Check(model.ReportSettings.CommandType,
			                      model.ReportSettings.CommandText);
			
			DataSet dataSet = ResultPanel.CreateDataSet ();
			
			this.txtSqlString.Text = model.ReportSettings.CommandText;
			switch (model.ReportSettings.CommandType) {
				case CommandType.Text:
						this.connectionObject = CreateConnection ();
						var dataAccess = new SqlDataAccessStrategy(model.ReportSettings,connectionObject);
						dataSet = dataAccess.ReadData();
						dataSet.Tables[0].TableName = CreateTableName (reportStructure);
					break;
				case CommandType.StoredProcedure:
					dataSet = DatasetFromStoredProcedure();
					break;
				case CommandType.TableDirect:
					MessageService.ShowError("TableDirect is not suppurted at the moment");
					break;
				default:
					throw new Exception("Invalid value for CommandType");
			}
			return dataSet;
		}
		public static IDataManager CreateDataManager (IReportModel reportModel,ReportParameters reportParameters)
		{
			if (reportModel == null) {
				throw new ArgumentNullException("reportModel");
			}
			IDataManager dataManager = null;
			ConnectionObject connectionObject = null;
			IDataAccessStrategy accesStrategy = null;
			if (reportParameters != null) {
				connectionObject = reportParameters.ConnectionObject;
			}
			
			if (connectionObject != null) {
				accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings,connectionObject);
			} else {
				accesStrategy = new SqlDataAccessStrategy(reportModel.ReportSettings,null);
				
			}
			dataManager = DataManager.CreateInstance(reportModel.ReportSettings,accesStrategy);
			if (dataManager == null) {
				throw new MissingDataManagerException();
			}
			return dataManager;
		}	
Example #4
0
		DataSet DatasetFromStoredProcedure()
		{
			this.connectionObject = CreateConnection();
			DataSet dataSet = ResultPanel.CreateDataSet();
			IProcedure procedure = reportStructure.IDatabaseObjectBase as IProcedure;
			
			var paramCollection = CheckParameters(procedure);
			
			
			if (paramCollection.Count > 0) {
				FillParameters(paramCollection);
				reportStructure.SqlQueryParameters.AddRange(paramCollection);
			}
			
			var dataAccess = new SqlDataAccessStrategy(model.ReportSettings,connectionObject);
			dataSet = dataAccess.ReadData();
			dataSet.Tables[0].TableName = procedure.Name;
			
			return dataSet;
		}