Example #1
0
 /// <summary>
 /// Inserts/Updates DIC_User values into/on Database. Inserts if DIC_User doesn't exist or Updates if DIC_User 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_DIC_User DIC_User_in,
     bool forceUpdate_in
     )
 {
     return(setObject(
                DIC_User_in,
                forceUpdate_in,
                null
                ));
 }
Example #2
0
        /// <summary>
        /// Selects DIC_User values from Database and assigns them to the appropriate DO_DIC_User property.
        /// </summary>
        /// <param name="IFUser_in">IFUser</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 DIC_User doesn't exists at Database</returns>
        public static SO_DIC_User getObject(
            long IFUser_in,
            DBConnection dbConnection_in
            )
        {
            SO_DIC_User _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("IFUser_", DbType.Int64, ParameterDirection.InputOutput, IFUser_in, 0),
                _connection.newDBDataParameter("IFLanguage_", DbType.Int32, ParameterDirection.Output, null, 0)
            };
            _connection.Execute_SQLFunction("sp0_DIC_User_getObject", _dataparameters);
            if (dbConnection_in == null)
            {
                _connection.Dispose();
            }

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

                if (_dataparameters[0].Value == System.DBNull.Value)
                {
                    _output.IFUser = 0L;
                }
                else
                {
                    _output.IFUser = (long)_dataparameters[0].Value;
                }
                if (_dataparameters[1].Value == System.DBNull.Value)
                {
                    _output.IFLanguage = 0;
                }
                else
                {
                    _output.IFLanguage = (int)_dataparameters[1].Value;
                }

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

            return(null);
        }
Example #3
0
        /// <summary>
        /// Inserts/Updates DIC_User values into/on Database. Inserts if DIC_User doesn't exist or Updates if DIC_User 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_DIC_User DIC_User_in,
            bool forceUpdate_in,
            DBConnection dbConnection_in
            )
        {
            bool ConstraintExist_out;

            if (forceUpdate_in || DIC_User_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("IFUser_", DbType.Int64, ParameterDirection.Input, DIC_User_in.IFUser, 0),
                    _connection.newDBDataParameter("IFLanguage_", DbType.Int32, ParameterDirection.Input, DIC_User_in.IFLanguage, 0),

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

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

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

                return(false);
            }
        }