Пример #1
0
		public override void Run()
		{
			ReportExplorerPad pad = this.Owner as ReportExplorerPad;
			if (pad != null) {
				ParameterCollection par = pad.ReportModel.ReportSettings.ParameterCollection;
				
				using (ParameterDialog paramDialog = new ParameterDialog(par)) {
					paramDialog.ShowDialog();
					if (paramDialog.DialogResult == System.Windows.Forms.DialogResult.OK) {
						/*
						foreach (BasicParameter bp in e.Collection as ParameterCollection){
							r.ReportModel.ReportSettings.ParameterCollection.Add (bp);
						}
						*/
						foreach (BasicParameter bp in new System.Collections.ArrayList(paramDialog.Collection))
						{
							if (bp.ParameterName != null) 
							{
								pad.ReportModel.ReportSettings.ParameterCollection.Add (bp);
							}
						}
						pad.RefreshParameters();
					}
				}
			}
		}
Пример #2
0
		public override void Run()
		{
			if (model.ReportSettings.ParameterCollection != null && model.ReportSettings.ParameterCollection.Count > 0) {
				using (ParameterDialog dlg = new ParameterDialog(model.ReportSettings.ParameterCollection)){
					dlg.ShowDialog();
				}
			}
		}
Пример #3
0
		public override void Run()
		{
			ReportExplorerPad r = this.Owner as ReportExplorerPad;
			if (r != null) {
				ParameterCollection par = r.ReportModel.ReportSettings.ParameterCollection;
				
				using (ParameterDialog e = new ParameterDialog(par)) {
					e.ShowDialog();
					if (e.DialogResult == System.Windows.Forms.DialogResult.OK) {
						foreach (BasicParameter bp in e.Collection as ParameterCollection){
							r.ReportModel.ReportSettings.ParameterCollection.Add (bp);
						}
						r.RefreshParameters();
					}
				}
			}
		}
Пример #4
0
		private DataSet ExecuteStoredProc (SharpQueryProcedure procedure)
		{
			
			SharpQuerySchemaClassCollection tmp = procedure.GetSchemaParameters();
			this.sqlParamsCollection = new ParameterCollection();
			SqlParameterConverter converter = new SqlParameterConverter();
			
			if (converter.CanConvertFrom(typeof(SharpQuerySchemaClassCollection))) {
				if (converter.CanConvertTo(null,typeof(ParameterCollection))){
					sqlParamsCollection = (ParameterCollection)converter.ConvertTo(null,
					                                                                   CultureInfo.InstalledUICulture,
					                                                                   tmp,
					                                                                   typeof(ParameterCollection));
				}
			}
			
			if (sqlParamsCollection.Count > 0){
				using (ParameterDialog inputform = new ParameterDialog(sqlParamsCollection)) {
					if ( inputform.ShowDialog() != DialogResult.OK ){
						return null;
					}
					else
					{
						IDbCommand command = this.BuildCommand();
						DbDataAdapter adapter = this.BuildAdapter();
						DataSet dataSet = ResultPanel.CreateDataSet();
						try {
							SqlDataAccessStrategy.BuildQueryParameters(command,sqlParamsCollection);
							adapter.SelectCommand = (DbCommand)command;
							
							adapter.Fill (dataSet);
							return dataSet;
						} catch (Exception e) {	
							MessageService.ShowError(e.Message);
						} finally {
							if (adapter.SelectCommand.Connection.State == ConnectionState.Open) {
								adapter.SelectCommand.Connection.Close();
							}
						}
					}
				}
			}
			return null;
		}