コード例 #1
0
 /// <summary>
 /// Inserts/Updates NWS_ContentProfile values into/on Database. Inserts if NWS_ContentProfile doesn't exist or Updates if NWS_ContentProfile 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_NWS_ContentProfile NWS_ContentProfile_in,
     bool forceUpdate_in
     )
 {
     return(setObject(
                NWS_ContentProfile_in,
                forceUpdate_in,
                null
                ));
 }
コード例 #2
0
        /// <summary>
        /// Selects NWS_ContentProfile values from Database and assigns them to the appropriate DO_NWS_ContentProfile property.
        /// </summary>
        /// <param name="IFContent_in">IFContent</param>
        /// <param name="IFProfile_in">IFProfile</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 NWS_ContentProfile doesn't exists at Database</returns>
        public static SO_NWS_ContentProfile getObject(
            long IFContent_in,
            long IFProfile_in,
            DBConnection dbConnection_in
            )
        {
            SO_NWS_ContentProfile _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("IFContent_", DbType.Int64, ParameterDirection.InputOutput, IFContent_in, 0),
                _connection.newDBDataParameter("IFProfile_", DbType.Int64, ParameterDirection.InputOutput, IFProfile_in, 0)
            };
            _connection.Execute_SQLFunction("sp0_NWS_ContentProfile_getObject", _dataparameters);
            if (dbConnection_in == null)
            {
                _connection.Dispose();
            }

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

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

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

            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Inserts/Updates NWS_ContentProfile values into/on Database. Inserts if NWS_ContentProfile doesn't exist or Updates if NWS_ContentProfile 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_NWS_ContentProfile NWS_ContentProfile_in,
            bool forceUpdate_in,
            DBConnection dbConnection_in
            )
        {
            bool ConstraintExist_out;

            if (forceUpdate_in || NWS_ContentProfile_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("IFContent_", DbType.Int64, ParameterDirection.Input, NWS_ContentProfile_in.IFContent, 0),
                    _connection.newDBDataParameter("IFProfile_", DbType.Int64, ParameterDirection.Input, NWS_ContentProfile_in.IFProfile, 0),

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

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

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

                return(false);
            }
        }
コード例 #4
0
        private static SO_NWS_ContentProfile[] getRecord(
            DataTable dataTable_in
            )
        {
            DataColumn _dc_ifcontent = null;
            DataColumn _dc_ifprofile = null;

            SO_NWS_ContentProfile[] _output
                = new SO_NWS_ContentProfile[dataTable_in.Rows.Count];
            for (int r = 0; r < dataTable_in.Rows.Count; r++)
            {
                if (r == 0)
                {
                    _dc_ifcontent = dataTable_in.Columns["IFContent"];
                    _dc_ifprofile = dataTable_in.Columns["IFProfile"];
                }

                _output[r] = new SO_NWS_ContentProfile();
                if (dataTable_in.Rows[r][_dc_ifcontent] == System.DBNull.Value)
                {
                    _output[r].IFContent = 0L;
                }
                else
                {
                    _output[r].IFContent = (long)dataTable_in.Rows[r][_dc_ifcontent];
                }
                if (dataTable_in.Rows[r][_dc_ifprofile] == System.DBNull.Value)
                {
                    _output[r].IFProfile = 0L;
                }
                else
                {
                    _output[r].IFProfile = (long)dataTable_in.Rows[r][_dc_ifprofile];
                }

                _output[r].HasChanges = false;
            }

            return(_output);
        }
コード例 #5
0
		/// <summary>
		/// Selects NWS_ContentProfile values from Database and assigns them to the appropriate DO_NWS_ContentProfile property.
		/// </summary>
		/// <param name="IFContent_in">IFContent</param>
		/// <param name="IFProfile_in">IFProfile</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 NWS_ContentProfile doesn't exists at Database</returns>
		public static SO_NWS_ContentProfile getObject(
			long IFContent_in, 
			long IFProfile_in, 
			DBConnection dbConnection_in
		) {
			SO_NWS_ContentProfile _output = null;

			DBConnection _connection = (dbConnection_in == null)
				? DO__utils.DBConnection_createInstance(
					DO__utils.DBServerType,
					DO__utils.DBConnectionstring,
					DO__utils.DBLogfile
				) 
				: dbConnection_in;
			IDbDataParameter[] _dataparameters = new IDbDataParameter[] {
				_connection.newDBDataParameter("IFContent_", DbType.Int64, ParameterDirection.InputOutput, IFContent_in, 0), 
				_connection.newDBDataParameter("IFProfile_", DbType.Int64, ParameterDirection.InputOutput, IFProfile_in, 0)
			};
			_connection.Execute_SQLFunction("sp0_NWS_ContentProfile_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

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

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

				_output.haschanges_ = false;
				return _output;
			}

			return null;
		}
コード例 #6
0
		private static SO_NWS_ContentProfile[] getRecord(
			DataTable dataTable_in
		) {
			DataColumn _dc_ifcontent = null;
			DataColumn _dc_ifprofile = null;

			SO_NWS_ContentProfile[] _output 
				= new SO_NWS_ContentProfile[dataTable_in.Rows.Count];
			for (int r = 0; r < dataTable_in.Rows.Count; r++) {
				if (r == 0) {
					_dc_ifcontent = dataTable_in.Columns["IFContent"];
					_dc_ifprofile = dataTable_in.Columns["IFProfile"];
				}

				_output[r] = new SO_NWS_ContentProfile();
				if (dataTable_in.Rows[r][_dc_ifcontent] == System.DBNull.Value) {
					_output[r].ifcontent_ = 0L;
				} else {
					_output[r].ifcontent_ = (long)dataTable_in.Rows[r][_dc_ifcontent];
				}
				if (dataTable_in.Rows[r][_dc_ifprofile] == System.DBNull.Value) {
					_output[r].ifprofile_ = 0L;
				} else {
					_output[r].ifprofile_ = (long)dataTable_in.Rows[r][_dc_ifprofile];
				}

				_output[r].haschanges_ = false;
			}

			return _output;
		}
コード例 #7
0
		/// <summary>
		/// Inserts/Updates NWS_ContentProfile values into/on Database. Inserts if NWS_ContentProfile doesn't exist or Updates if NWS_ContentProfile 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_NWS_ContentProfile NWS_ContentProfile_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			bool ConstraintExist_out;
			if (forceUpdate_in || NWS_ContentProfile_in.haschanges_) {
				DBConnection _connection = (dbConnection_in == null)
					? DO__utils.DBConnection_createInstance(
						DO__utils.DBServerType,
						DO__utils.DBConnectionstring,
						DO__utils.DBLogfile
					) 
					: dbConnection_in;
				IDbDataParameter[] _dataparameters = new IDbDataParameter[] {
					_connection.newDBDataParameter("IFContent_", DbType.Int64, ParameterDirection.Input, NWS_ContentProfile_in.IFContent, 0), 
					_connection.newDBDataParameter("IFProfile_", DbType.Int64, ParameterDirection.Input, NWS_ContentProfile_in.IFProfile, 0), 

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

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

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

				return  false;
			}
		}
コード例 #8
0
		/// <summary>
		/// Inserts/Updates NWS_ContentProfile values into/on Database. Inserts if NWS_ContentProfile doesn't exist or Updates if NWS_ContentProfile 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_NWS_ContentProfile NWS_ContentProfile_in, 
			bool forceUpdate_in
		) {
			return setObject(
				NWS_ContentProfile_in, 
				forceUpdate_in, 
				null
			);
		}