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

			DataColumn _dc_idmessage = new DataColumn("IDMessage", typeof(long));
			_output.Columns.Add(_dc_idmessage);
			DataColumn _dc_ifmessage__parent = new DataColumn("IFMessage__parent", typeof(long));
			_output.Columns.Add(_dc_ifmessage__parent);
			DataColumn _dc_issticky = new DataColumn("IsSticky", typeof(bool));
			_output.Columns.Add(_dc_issticky);
			DataColumn _dc_subject = new DataColumn("Subject", typeof(string));
			_output.Columns.Add(_dc_subject);
			DataColumn _dc_message__small = new DataColumn("Message__small", typeof(string));
			_output.Columns.Add(_dc_message__small);
			DataColumn _dc_message__large = new DataColumn("Message__large", typeof(string));
			_output.Columns.Add(_dc_message__large);
			DataColumn _dc_ifuser__publisher = new DataColumn("IFUser__Publisher", typeof(long));
			_output.Columns.Add(_dc_ifuser__publisher);
			DataColumn _dc_publish_date = new DataColumn("Publish_date", typeof(DateTime));
			_output.Columns.Add(_dc_publish_date);
			DataColumn _dc_ifapplication = new DataColumn("IFApplication", typeof(int));
			_output.Columns.Add(_dc_ifapplication);

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

				_dr[_dc_idmessage] = _serializableObject.IDMessage;
				_dr[_dc_ifmessage__parent] = _serializableObject.IFMessage__parent;
				_dr[_dc_issticky] = _serializableObject.IsSticky;
				_dr[_dc_subject] = _serializableObject.Subject;
				_dr[_dc_message__small] = _serializableObject.Message__small;
				_dr[_dc_message__large] = _serializableObject.Message__large;
				_dr[_dc_ifuser__publisher] = _serializableObject.IFUser__Publisher;
				_dr[_dc_publish_date] = _serializableObject.Publish_date;
				_dr[_dc_ifapplication] = _serializableObject.IFApplication;

				_output.Rows.Add(_dr);
			}

			return _output;
		}
Example #2
0
		/// <summary>
		/// Selects FOR_Message values from Database and assigns them to the appropriate DO_FOR_Message property.
		/// </summary>
		/// <param name="IDMessage_in">IDMessage</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 FOR_Message doesn't exists at Database</returns>
		public static SO_FOR_Message getObject(
			long IDMessage_in, 
			DBConnection dbConnection_in
		) {
			SO_FOR_Message _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("IDMessage_", DbType.Int64, ParameterDirection.InputOutput, IDMessage_in, 0), 
				_connection.newDBDataParameter("IFMessage__parent_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IsSticky_", DbType.Boolean, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Subject_", DbType.AnsiString, ParameterDirection.Output, null, 255), 
				_connection.newDBDataParameter("Message__small_", DbType.AnsiString, ParameterDirection.Output, null, 8000), 
				_connection.newDBDataParameter("Message__large_", DbType.AnsiString, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser__Publisher_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Publish_date_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0)
			};
			_connection.Execute_SQLFunction("sp0_FOR_Message_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

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

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IDMessage = 0L;
				} else {
					_output.IDMessage = (long)_dataparameters[0].Value;
				}
				if (_dataparameters[1].Value == System.DBNull.Value) {
					_output.IFMessage__parent_isNull = true;
				} else {
					_output.IFMessage__parent = (long)_dataparameters[1].Value;
				}
				if (_dataparameters[2].Value == System.DBNull.Value) {
					_output.IsSticky = false;
				} else {
					_output.IsSticky = (bool)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.Subject_isNull = true;
				} else {
					_output.Subject = (string)_dataparameters[3].Value;
				}
				if (_dataparameters[4].Value == System.DBNull.Value) {
					_output.Message__small_isNull = true;
				} else {
					_output.Message__small = (string)_dataparameters[4].Value;
				}
				if (_dataparameters[5].Value == System.DBNull.Value) {
					_output.Message__large_isNull = true;
				} else {
					_output.Message__large = (string)_dataparameters[5].Value;
				}
				if (_dataparameters[6].Value == System.DBNull.Value) {
					_output.IFUser__Publisher_isNull = true;
				} else {
					_output.IFUser__Publisher = (long)_dataparameters[6].Value;
				}
				if (_dataparameters[7].Value == System.DBNull.Value) {
					_output.Publish_date = new DateTime(1900, 1, 1);
				} else {
					_output.Publish_date = (DateTime)_dataparameters[7].Value;
				}
				if (_dataparameters[8].Value == System.DBNull.Value) {
					_output.IFApplication_isNull = true;
				} else {
					_output.IFApplication = (int)_dataparameters[8].Value;
				}

				_output.HasChanges = false;
				return _output;
			}

			return null;
		}
Example #3
0
		/// <summary>
		/// Updates FOR_Message values on Database.
		/// </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>
		public static void updObject(
			SO_FOR_Message FOR_Message_in, 
			bool forceUpdate_in
		) {
			updObject(
				FOR_Message_in, 
				forceUpdate_in, 
				null
			);
		}
Example #4
0
		/// <summary>
		/// Updates FOR_Message values on Database.
		/// </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>
		public static void updObject(
			SO_FOR_Message FOR_Message_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			if (forceUpdate_in || FOR_Message_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("IDMessage_", DbType.Int64, ParameterDirection.Input, FOR_Message_in.IDMessage, 0), 
					_connection.newDBDataParameter("IFMessage__parent_", DbType.Int64, ParameterDirection.Input, FOR_Message_in.IFMessage__parent_isNull ? null : (object)FOR_Message_in.IFMessage__parent, 0), 
					_connection.newDBDataParameter("IsSticky_", DbType.Boolean, ParameterDirection.Input, FOR_Message_in.IsSticky, 0), 
					_connection.newDBDataParameter("Subject_", DbType.AnsiString, ParameterDirection.Input, FOR_Message_in.Subject_isNull ? null : (object)FOR_Message_in.Subject, 255), 
					_connection.newDBDataParameter("Message__small_", DbType.AnsiString, ParameterDirection.Input, FOR_Message_in.Message__small_isNull ? null : (object)FOR_Message_in.Message__small, 8000), 
					_connection.newDBDataParameter("Message__large_", DbType.AnsiString, ParameterDirection.Input, FOR_Message_in.Message__large_isNull ? null : (object)FOR_Message_in.Message__large, 0), 
					_connection.newDBDataParameter("IFUser__Publisher_", DbType.Int64, ParameterDirection.Input, FOR_Message_in.IFUser__Publisher_isNull ? null : (object)FOR_Message_in.IFUser__Publisher, 0), 
					_connection.newDBDataParameter("Publish_date_", DbType.DateTime, ParameterDirection.Input, FOR_Message_in.Publish_date, 0), 
					_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, FOR_Message_in.IFApplication_isNull ? null : (object)FOR_Message_in.IFApplication, 0)
				};
				_connection.Execute_SQLFunction(
					"sp0_FOR_Message_updObject", 
					_dataparameters
				);
				if (dbConnection_in == null) { _connection.Dispose(); }
				FOR_Message_in.HasChanges = false;
			}
		}
Example #5
0
		/// <summary>
		/// Inserts FOR_Message values into Database.
		/// </summary>
		/// <param name="selectIdentity_in">assign with True if you wish to retrieve insertion sequence/identity seed and with False if not</param>
		/// <returns>insertion sequence/identity seed</returns>
		public static long insObject(
			SO_FOR_Message FOR_Message_in, 
			bool selectIdentity_in
		) {
			return insObject(
				FOR_Message_in, 
				selectIdentity_in, 
				null
			);
		}