示例#1
0
		public static DataTable getDataTable(
			SO_FRM_GroupQuestion[] serializableObjects_in
		) {
			DataTable _output = new DataTable();
			_output.Locale = System.Globalization.CultureInfo.CurrentCulture;
			DataRow _dr;

			DataColumn _dc_ifgroup = new DataColumn("IFGroup", typeof(long));
			_output.Columns.Add(_dc_ifgroup);
			DataColumn _dc_ifquestion = new DataColumn("IFQuestion", typeof(long));
			_output.Columns.Add(_dc_ifquestion);
			DataColumn _dc_order = new DataColumn("Order", typeof(int));
			_output.Columns.Add(_dc_order);
			DataColumn _dc_ifuser__audit = new DataColumn("IFUser__audit", typeof(long));
			_output.Columns.Add(_dc_ifuser__audit);
			DataColumn _dc_date__audit = new DataColumn("Date__audit", typeof(DateTime));
			_output.Columns.Add(_dc_date__audit);

			foreach (SO_FRM_GroupQuestion _serializableObject in serializableObjects_in) {
				_dr = _output.NewRow();

				_dr[_dc_ifgroup] = _serializableObject.IFGroup;
				_dr[_dc_ifquestion] = _serializableObject.IFQuestion;
				_dr[_dc_order] = _serializableObject.Order;
				_dr[_dc_ifuser__audit] = _serializableObject.IFUser__audit;
				_dr[_dc_date__audit] = _serializableObject.Date__audit;

				_output.Rows.Add(_dr);
			}

			return _output;
		}
示例#2
0
		/// <summary>
		/// Inserts/Updates FRM_GroupQuestion values into/on Database. Inserts if FRM_GroupQuestion doesn't exist or Updates if FRM_GroupQuestion already exists.
		/// </summary>
		/// <param name="forceUpdate_in">assign with True if you wish to force an Update (even if no changes have been made since last time getObject method was run) and False if not</param>
		/// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param>
		/// <returns>True if it didn't exist (INSERT), and False if it did exist (UPDATE)</returns>
		public static bool setObject(
			SO_FRM_GroupQuestion FRM_GroupQuestion_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			bool ConstraintExist_out;
			if (forceUpdate_in || FRM_GroupQuestion_in.HasChanges) {
				DBConnection _connection = (dbConnection_in == null)
					? DO__Utilities.DBConnection_createInstance(
						DO__Utilities.DBServerType,
						DO__Utilities.DBConnectionstring,
						DO__Utilities.DBLogfile
					) 
					: dbConnection_in;
				IDbDataParameter[] _dataparameters = new IDbDataParameter[] {
					_connection.newDBDataParameter("IFGroup_", DbType.Int64, ParameterDirection.Input, FRM_GroupQuestion_in.IFGroup, 0), 
					_connection.newDBDataParameter("IFQuestion_", DbType.Int64, ParameterDirection.Input, FRM_GroupQuestion_in.IFQuestion, 0), 
					_connection.newDBDataParameter("Order_", DbType.Int32, ParameterDirection.Input, FRM_GroupQuestion_in.Order_isNull ? null : (object)FRM_GroupQuestion_in.Order, 0), 
					_connection.newDBDataParameter("IFUser__audit_", DbType.Int64, ParameterDirection.Input, FRM_GroupQuestion_in.IFUser__audit, 0), 
					_connection.newDBDataParameter("Date__audit_", DbType.DateTime, ParameterDirection.Input, FRM_GroupQuestion_in.Date__audit, 0), 

					//_connection.newDBDataParameter("Exists", DbType.Boolean, ParameterDirection.Output, 0, 1)
					_connection.newDBDataParameter("Output_", DbType.Int32, ParameterDirection.Output, null, 0)
				};
				_connection.Execute_SQLFunction(
					"sp0_FRM_GroupQuestion_setObject", 
					_dataparameters
				);
				if (dbConnection_in == null) { _connection.Dispose(); }

				ConstraintExist_out = (((int)_dataparameters[5].Value & 2) == 1);
				if (!ConstraintExist_out) {
					FRM_GroupQuestion_in.HasChanges = false;
				}

				return (((int)_dataparameters[5].Value & 1) != 1);
			} else {
				ConstraintExist_out = false;

				return  false;
			}
		}
示例#3
0
		/// <summary>
		/// Selects FRM_GroupQuestion values from Database and assigns them to the appropriate DO_FRM_GroupQuestion property.
		/// </summary>
		/// <param name="IFGroup_in">IFGroup</param>
		/// <param name="IFQuestion_in">IFQuestion</param>
		/// <param name="dbConnection_in">Database connection, making the use of Database Transactions possible on a sequence of operations across the same or multiple DataObjects</param>
		/// <returns>null if FRM_GroupQuestion doesn't exists at Database</returns>
		public static SO_FRM_GroupQuestion getObject(
			long IFGroup_in, 
			long IFQuestion_in, 
			DBConnection dbConnection_in
		) {
			SO_FRM_GroupQuestion _output = null;

			DBConnection _connection = (dbConnection_in == null)
				? DO__Utilities.DBConnection_createInstance(
					DO__Utilities.DBServerType,
					DO__Utilities.DBConnectionstring,
					DO__Utilities.DBLogfile
				) 
				: dbConnection_in;
			IDbDataParameter[] _dataparameters = new IDbDataParameter[] {
				_connection.newDBDataParameter("IFGroup_", DbType.Int64, ParameterDirection.InputOutput, IFGroup_in, 0), 
				_connection.newDBDataParameter("IFQuestion_", DbType.Int64, ParameterDirection.InputOutput, IFQuestion_in, 0), 
				_connection.newDBDataParameter("Order_", DbType.Int32, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser__audit_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Date__audit_", DbType.DateTime, ParameterDirection.Output, null, 0)
			};
			_connection.Execute_SQLFunction("sp0_FRM_GroupQuestion_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

			if (_dataparameters[0].Value != DBNull.Value) {
				_output = new SO_FRM_GroupQuestion();

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IFGroup = 0L;
				} else {
					_output.IFGroup = (long)_dataparameters[0].Value;
				}
				if (_dataparameters[1].Value == System.DBNull.Value) {
					_output.IFQuestion = 0L;
				} else {
					_output.IFQuestion = (long)_dataparameters[1].Value;
				}
				if (_dataparameters[2].Value == System.DBNull.Value) {
					_output.Order_isNull = true;
				} else {
					_output.Order = (int)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.IFUser__audit = 0L;
				} else {
					_output.IFUser__audit = (long)_dataparameters[3].Value;
				}
				if (_dataparameters[4].Value == System.DBNull.Value) {
					_output.Date__audit = new DateTime(1900, 1, 1);
				} else {
					_output.Date__audit = (DateTime)_dataparameters[4].Value;
				}

				_output.HasChanges = false;
				return _output;
			}

			return null;
		}
示例#4
0
		/// <summary>
		/// Inserts/Updates FRM_GroupQuestion values into/on Database. Inserts if FRM_GroupQuestion doesn't exist or Updates if FRM_GroupQuestion already exists.
		/// </summary>
		/// <param name="forceUpdate_in">assign with True if you wish to force an Update (even if no changes have been made since last time getObject method was run) and False if not</param>
		/// <returns>True if it didn't exist (INSERT), and False if it did exist (UPDATE)</returns>
		public static bool setObject(
			SO_FRM_GroupQuestion FRM_GroupQuestion_in, 
			bool forceUpdate_in
		) {
			return setObject(
				FRM_GroupQuestion_in, 
				forceUpdate_in, 
				null
			);
		}