예제 #1
0
 /// <summary>
 /// Inserts/Updates LOG_Error values into/on Database. Inserts if LOG_Error doesn't exist or Updates if LOG_Error 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_LOG_Error LOG_Error_in,
     bool forceUpdate_in
     )
 {
     return(setObject(
                LOG_Error_in,
                forceUpdate_in,
                null
                ));
 }
예제 #2
0
		/// <summary>
		/// Selects LOG_Error values from Database and assigns them to the appropriate DO_LOG_Error property.
		/// </summary>
		/// <param name="IDError_in">IDError</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 LOG_Error doesn't exists at Database</returns>
		public static SO_LOG_Error getObject(
			int IDError_in, 
			DBConnection dbConnection_in
		) {
			SO_LOG_Error _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("IDError_", DbType.Int32, ParameterDirection.InputOutput, IDError_in, 0), 
				_connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Output, null, 255), 
				_connection.newDBDataParameter("Description_", DbType.AnsiString, ParameterDirection.Output, null, 2048), 
				_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0)
			};
			_connection.Execute_SQLFunction("sp0_LOG_Error_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

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

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IDError = 0;
				} else {
					_output.IDError = (int)_dataparameters[0].Value;
				}
				if (_dataparameters[1].Value == System.DBNull.Value) {
					_output.Name = string.Empty;
				} else {
					_output.Name = (string)_dataparameters[1].Value;
				}
				if (_dataparameters[2].Value == System.DBNull.Value) {
					_output.Description_isNull = true;
				} else {
					_output.Description = (string)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.IFApplication_isNull = true;
				} else {
					_output.IFApplication = (int)_dataparameters[3].Value;
				}

				_output.HasChanges = false;
				return _output;
			}

			return null;
		}
예제 #3
0
        /// <summary>
        /// Inserts/Updates LOG_Error values into/on Database. Inserts if LOG_Error doesn't exist or Updates if LOG_Error 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_LOG_Error LOG_Error_in,
            bool forceUpdate_in,
            DBConnection dbConnection_in
            )
        {
            bool ConstraintExist_out;

            if (forceUpdate_in || LOG_Error_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("IDError_", DbType.Int32, ParameterDirection.Input, LOG_Error_in.IDError, 0),
                    _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, LOG_Error_in.Name, 255),
                    _connection.newDBDataParameter("Description_", DbType.AnsiString, ParameterDirection.Input, LOG_Error_in.Description_isNull ? null : (object)LOG_Error_in.Description, 2048),
                    _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, LOG_Error_in.IFApplication_isNull ? null : (object)LOG_Error_in.IFApplication, 0),

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

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

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

                return(false);
            }
        }
예제 #4
0
		/// <summary>
		/// Inserts/Updates LOG_Error values into/on Database. Inserts if LOG_Error doesn't exist or Updates if LOG_Error 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_LOG_Error LOG_Error_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			bool ConstraintExist_out;
			if (forceUpdate_in || LOG_Error_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("IDError_", DbType.Int32, ParameterDirection.Input, LOG_Error_in.IDError, 0), 
					_connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Input, LOG_Error_in.Name, 255), 
					_connection.newDBDataParameter("Description_", DbType.AnsiString, ParameterDirection.Input, LOG_Error_in.Description_isNull ? null : (object)LOG_Error_in.Description, 2048), 
					_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, LOG_Error_in.IFApplication_isNull ? null : (object)LOG_Error_in.IFApplication, 0), 

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

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

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

				return  false;
			}
		}
예제 #5
0
		/// <summary>
		/// Inserts/Updates LOG_Error values into/on Database. Inserts if LOG_Error doesn't exist or Updates if LOG_Error 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_LOG_Error LOG_Error_in, 
			bool forceUpdate_in
		) {
			return setObject(
				LOG_Error_in, 
				forceUpdate_in, 
				null
			);
		}
예제 #6
0
        /// <summary>
        /// Selects LOG_Error values from Database and assigns them to the appropriate DO_LOG_Error property.
        /// </summary>
        /// <param name="IDError_in">IDError</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 LOG_Error doesn't exists at Database</returns>
        public static SO_LOG_Error getObject(
            int IDError_in,
            DBConnection dbConnection_in
            )
        {
            SO_LOG_Error _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("IDError_", DbType.Int32, ParameterDirection.InputOutput, IDError_in, 0),
                _connection.newDBDataParameter("Name_", DbType.AnsiString, ParameterDirection.Output, null, 255),
                _connection.newDBDataParameter("Description_", DbType.AnsiString, ParameterDirection.Output, null, 2048),
                _connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0)
            };
            _connection.Execute_SQLFunction("sp0_LOG_Error_getObject", _dataparameters);
            if (dbConnection_in == null)
            {
                _connection.Dispose();
            }

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

                if (_dataparameters[0].Value == System.DBNull.Value)
                {
                    _output.IDError = 0;
                }
                else
                {
                    _output.IDError = (int)_dataparameters[0].Value;
                }
                if (_dataparameters[1].Value == System.DBNull.Value)
                {
                    _output.Name = string.Empty;
                }
                else
                {
                    _output.Name = (string)_dataparameters[1].Value;
                }
                if (_dataparameters[2].Value == System.DBNull.Value)
                {
                    _output.Description_isNull = true;
                }
                else
                {
                    _output.Description = (string)_dataparameters[2].Value;
                }
                if (_dataparameters[3].Value == System.DBNull.Value)
                {
                    _output.IFApplication_isNull = true;
                }
                else
                {
                    _output.IFApplication = (int)_dataparameters[3].Value;
                }

                _output.HasChanges = false;
                return(_output);
            }

            return(null);
        }