Exemplo n.º 1
0
		/// <summary>
		/// Selects LOG_Log values from Database and assigns them to the appropriate DO_LOG_Log property.
		/// </summary>
		/// <param name="IDLog_in">IDLog</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_Log doesn't exists at Database</returns>
		public static SO_LOG_Log getObject(
			long IDLog_in, 
			DBConnection dbConnection_in
		) {
			SO_LOG_Log _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("IDLog_", DbType.Int64, ParameterDirection.InputOutput, IDLog_in, 0), 
				_connection.newDBDataParameter("IFLogtype_", DbType.Int32, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFUser__read_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFErrortype_", DbType.Int32, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Stamp_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Stamp__read_", DbType.DateTime, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("Message_", DbType.AnsiString, ParameterDirection.Output, null, 4000), 
				_connection.newDBDataParameter("IFPermition_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFBrowser__OPT_", DbType.Int64, ParameterDirection.Output, null, 0)
			};
			_connection.Execute_SQLFunction("sp0_LOG_Log_getObject", _dataparameters);
			if (dbConnection_in == null) { _connection.Dispose(); }

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

				if (_dataparameters[0].Value == System.DBNull.Value) {
					_output.IDLog = 0L;
				} else {
					_output.IDLog = (long)_dataparameters[0].Value;
				}
				if (_dataparameters[1].Value == System.DBNull.Value) {
					_output.IFLogtype = 0;
				} else {
					_output.IFLogtype = (int)_dataparameters[1].Value;
				}
				if (_dataparameters[2].Value == System.DBNull.Value) {
					_output.IFUser_isNull = true;
				} else {
					_output.IFUser = (long)_dataparameters[2].Value;
				}
				if (_dataparameters[3].Value == System.DBNull.Value) {
					_output.IFUser__read_isNull = true;
				} else {
					_output.IFUser__read = (long)_dataparameters[3].Value;
				}
				if (_dataparameters[4].Value == System.DBNull.Value) {
					_output.IFErrortype_isNull = true;
				} else {
					_output.IFErrortype = (int)_dataparameters[4].Value;
				}
				if (_dataparameters[5].Value == System.DBNull.Value) {
					_output.Stamp = new DateTime(1900, 1, 1);
				} else {
					_output.Stamp = (DateTime)_dataparameters[5].Value;
				}
				if (_dataparameters[6].Value == System.DBNull.Value) {
					_output.Stamp__read_isNull = true;
				} else {
					_output.Stamp__read = (DateTime)_dataparameters[6].Value;
				}
				if (_dataparameters[7].Value == System.DBNull.Value) {
					_output.Message = string.Empty;
				} else {
					_output.Message = (string)_dataparameters[7].Value;
				}
				if (_dataparameters[8].Value == System.DBNull.Value) {
					_output.IFPermition_isNull = true;
				} else {
					_output.IFPermition = (long)_dataparameters[8].Value;
				}
				if (_dataparameters[9].Value == System.DBNull.Value) {
					_output.IFApplication_isNull = true;
				} else {
					_output.IFApplication = (int)_dataparameters[9].Value;
				}
				if (_dataparameters[10].Value == System.DBNull.Value) {
					_output.IFBrowser__OPT_isNull = true;
				} else {
					_output.IFBrowser__OPT = (long)_dataparameters[10].Value;
				}

				_output.haschanges_ = false;
				return _output;
			}

			return null;
		}
Exemplo n.º 2
0
		/// <summary>
		/// Updates LOG_Log 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_LOG_Log LOG_Log_in, 
			bool forceUpdate_in, 
			DBConnection dbConnection_in
		) {
			if (forceUpdate_in || LOG_Log_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("IDLog_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IDLog, 0), 
					_connection.newDBDataParameter("IFLogtype_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFLogtype, 0), 
					_connection.newDBDataParameter("IFUser_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFUser_isNull ? null : (object)LOG_Log_in.IFUser, 0), 
					_connection.newDBDataParameter("IFUser__read_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFUser__read_isNull ? null : (object)LOG_Log_in.IFUser__read, 0), 
					_connection.newDBDataParameter("IFErrortype_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFErrortype_isNull ? null : (object)LOG_Log_in.IFErrortype, 0), 
					_connection.newDBDataParameter("Stamp_", DbType.DateTime, ParameterDirection.Input, LOG_Log_in.Stamp, 0), 
					_connection.newDBDataParameter("Stamp__read_", DbType.DateTime, ParameterDirection.Input, LOG_Log_in.Stamp__read_isNull ? null : (object)LOG_Log_in.Stamp__read, 0), 
					_connection.newDBDataParameter("Message_", DbType.AnsiString, ParameterDirection.Input, LOG_Log_in.Message, 4000), 
					_connection.newDBDataParameter("IFPermition_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFPermition_isNull ? null : (object)LOG_Log_in.IFPermition, 0), 
					_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFApplication_isNull ? null : (object)LOG_Log_in.IFApplication, 0), 
					_connection.newDBDataParameter("IFBrowser__OPT_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFBrowser__OPT_isNull ? null : (object)LOG_Log_in.IFBrowser__OPT, 0)
				};
				_connection.Execute_SQLFunction(
					"sp0_LOG_Log_updObject", 
					_dataparameters
				);
				if (dbConnection_in == null) { _connection.Dispose(); }
				LOG_Log_in.haschanges_ = false;
			}
		}
Exemplo n.º 3
0
		private static SO_LOG_Log[] getRecord(
			DataTable dataTable_in
		) {
			DataColumn _dc_idlog = null;
			DataColumn _dc_iflogtype = null;
			DataColumn _dc_ifuser = null;
			DataColumn _dc_ifuser__read = null;
			DataColumn _dc_iferrortype = null;
			DataColumn _dc_stamp = null;
			DataColumn _dc_stamp__read = null;
			DataColumn _dc_message = null;
			DataColumn _dc_ifpermition = null;
			DataColumn _dc_ifapplication = null;
			DataColumn _dc_ifbrowser__opt = null;

			SO_LOG_Log[] _output 
				= new SO_LOG_Log[dataTable_in.Rows.Count];
			for (int r = 0; r < dataTable_in.Rows.Count; r++) {
				if (r == 0) {
					_dc_idlog = dataTable_in.Columns["IDLog"];
					_dc_iflogtype = dataTable_in.Columns["IFLogtype"];
					_dc_ifuser = dataTable_in.Columns["IFUser"];
					_dc_ifuser__read = dataTable_in.Columns["IFUser__read"];
					_dc_iferrortype = dataTable_in.Columns["IFErrortype"];
					_dc_stamp = dataTable_in.Columns["Stamp"];
					_dc_stamp__read = dataTable_in.Columns["Stamp__read"];
					_dc_message = dataTable_in.Columns["Message"];
					_dc_ifpermition = dataTable_in.Columns["IFPermition"];
					_dc_ifapplication = dataTable_in.Columns["IFApplication"];
					_dc_ifbrowser__opt = dataTable_in.Columns["IFBrowser__OPT"];
				}

				_output[r] = new SO_LOG_Log();
				if (dataTable_in.Rows[r][_dc_idlog] == System.DBNull.Value) {
					_output[r].idlog_ = 0L;
				} else {
					_output[r].idlog_ = (long)dataTable_in.Rows[r][_dc_idlog];
				}
				if (dataTable_in.Rows[r][_dc_iflogtype] == System.DBNull.Value) {
					_output[r].iflogtype_ = 0;
				} else {
					_output[r].iflogtype_ = (int)dataTable_in.Rows[r][_dc_iflogtype];
				}
				if (dataTable_in.Rows[r][_dc_ifuser] == System.DBNull.Value) {
					_output[r].IFUser_isNull = true;
				} else {
					_output[r].ifuser_ = (long)dataTable_in.Rows[r][_dc_ifuser];
				}
				if (dataTable_in.Rows[r][_dc_ifuser__read] == System.DBNull.Value) {
					_output[r].IFUser__read_isNull = true;
				} else {
					_output[r].ifuser__read_ = (long)dataTable_in.Rows[r][_dc_ifuser__read];
				}
				if (dataTable_in.Rows[r][_dc_iferrortype] == System.DBNull.Value) {
					_output[r].IFErrortype_isNull = true;
				} else {
					_output[r].iferrortype_ = (int)dataTable_in.Rows[r][_dc_iferrortype];
				}
				if (dataTable_in.Rows[r][_dc_stamp] == System.DBNull.Value) {
					_output[r].stamp_ = new DateTime(1900, 1, 1);
				} else {
					_output[r].stamp_ = (DateTime)dataTable_in.Rows[r][_dc_stamp];
				}
				if (dataTable_in.Rows[r][_dc_stamp__read] == System.DBNull.Value) {
					_output[r].Stamp__read_isNull = true;
				} else {
					_output[r].stamp__read_ = (DateTime)dataTable_in.Rows[r][_dc_stamp__read];
				}
				if (dataTable_in.Rows[r][_dc_message] == System.DBNull.Value) {
					_output[r].message_ = string.Empty;
				} else {
					_output[r].message_ = (string)dataTable_in.Rows[r][_dc_message];
				}
				if (dataTable_in.Rows[r][_dc_ifpermition] == System.DBNull.Value) {
					_output[r].IFPermition_isNull = true;
				} else {
					_output[r].ifpermition_ = (long)dataTable_in.Rows[r][_dc_ifpermition];
				}
				if (dataTable_in.Rows[r][_dc_ifapplication] == System.DBNull.Value) {
					_output[r].IFApplication_isNull = true;
				} else {
					_output[r].ifapplication_ = (int)dataTable_in.Rows[r][_dc_ifapplication];
				}
				if (dataTable_in.Rows[r][_dc_ifbrowser__opt] == System.DBNull.Value) {
					_output[r].IFBrowser__OPT_isNull = true;
				} else {
					_output[r].ifbrowser__opt_ = (long)dataTable_in.Rows[r][_dc_ifbrowser__opt];
				}

				_output[r].haschanges_ = false;
			}

			return _output;
		}
Exemplo n.º 4
0
		/// <summary>
		/// Updates LOG_Log 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_LOG_Log LOG_Log_in, 
			bool forceUpdate_in
		) {
			updObject(
				LOG_Log_in, 
				forceUpdate_in, 
				null
			);
		}
Exemplo n.º 5
0
		/// <summary>
		/// Inserts LOG_Log 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>
		/// <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>insertion sequence/identity seed</returns>
		public static long insObject(
			SO_LOG_Log LOG_Log_in, 
			bool selectIdentity_in, 
			DBConnection dbConnection_in
		) {
			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("IDLog_", DbType.Int64, ParameterDirection.Output, null, 0), 
				_connection.newDBDataParameter("IFLogtype_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFLogtype, 0), 
				_connection.newDBDataParameter("IFUser_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFUser_isNull ? null : (object)LOG_Log_in.IFUser, 0), 
				_connection.newDBDataParameter("IFUser__read_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFUser__read_isNull ? null : (object)LOG_Log_in.IFUser__read, 0), 
				_connection.newDBDataParameter("IFErrortype_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFErrortype_isNull ? null : (object)LOG_Log_in.IFErrortype, 0), 
				_connection.newDBDataParameter("Stamp_", DbType.DateTime, ParameterDirection.Input, LOG_Log_in.Stamp, 0), 
				_connection.newDBDataParameter("Stamp__read_", DbType.DateTime, ParameterDirection.Input, LOG_Log_in.Stamp__read_isNull ? null : (object)LOG_Log_in.Stamp__read, 0), 
				_connection.newDBDataParameter("Message_", DbType.AnsiString, ParameterDirection.Input, LOG_Log_in.Message, 4000), 
				_connection.newDBDataParameter("IFPermition_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFPermition_isNull ? null : (object)LOG_Log_in.IFPermition, 0), 
				_connection.newDBDataParameter("IFApplication_", DbType.Int32, ParameterDirection.Input, LOG_Log_in.IFApplication_isNull ? null : (object)LOG_Log_in.IFApplication, 0), 
				_connection.newDBDataParameter("IFBrowser__OPT_", DbType.Int64, ParameterDirection.Input, LOG_Log_in.IFBrowser__OPT_isNull ? null : (object)LOG_Log_in.IFBrowser__OPT, 0), 

				_connection.newDBDataParameter("SelectIdentity_", DbType.Boolean, ParameterDirection.Input, selectIdentity_in, 1)
			};
			_connection.Execute_SQLFunction(
				"sp0_LOG_Log_insObject", 
				_dataparameters
			);
			if (dbConnection_in == null) { _connection.Dispose(); }

			LOG_Log_in.IDLog = (long)_dataparameters[0].Value;LOG_Log_in.haschanges_ = false;
			

			return LOG_Log_in.IDLog;
		}
Exemplo n.º 6
0
		/// <summary>
		/// Inserts LOG_Log 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_LOG_Log LOG_Log_in, 
			bool selectIdentity_in
		) {
			return insObject(
				LOG_Log_in, 
				selectIdentity_in, 
				null
			);
		}
Exemplo n.º 7
0
		public static DataTable getDataTable(
			SO_LOG_Log[] serializableobjects_in
		) {
			DataTable _output = new DataTable();
			DataRow _dr;

			DataColumn _dc_idlog = new DataColumn("IDLog", typeof(long));
			_output.Columns.Add(_dc_idlog);
			DataColumn _dc_iflogtype = new DataColumn("IFLogtype", typeof(int));
			_output.Columns.Add(_dc_iflogtype);
			DataColumn _dc_ifuser = new DataColumn("IFUser", typeof(long));
			_output.Columns.Add(_dc_ifuser);
			DataColumn _dc_ifuser__read = new DataColumn("IFUser__read", typeof(long));
			_output.Columns.Add(_dc_ifuser__read);
			DataColumn _dc_iferrortype = new DataColumn("IFErrortype", typeof(int));
			_output.Columns.Add(_dc_iferrortype);
			DataColumn _dc_stamp = new DataColumn("Stamp", typeof(DateTime));
			_output.Columns.Add(_dc_stamp);
			DataColumn _dc_stamp__read = new DataColumn("Stamp__read", typeof(DateTime));
			_output.Columns.Add(_dc_stamp__read);
			DataColumn _dc_message = new DataColumn("Message", typeof(string));
			_output.Columns.Add(_dc_message);
			DataColumn _dc_ifpermition = new DataColumn("IFPermition", typeof(long));
			_output.Columns.Add(_dc_ifpermition);
			DataColumn _dc_ifapplication = new DataColumn("IFApplication", typeof(int));
			_output.Columns.Add(_dc_ifapplication);
			DataColumn _dc_ifbrowser__opt = new DataColumn("IFBrowser__OPT", typeof(long));
			_output.Columns.Add(_dc_ifbrowser__opt);

			foreach (SO_LOG_Log _serializableobject in serializableobjects_in) {
				_dr = _output.NewRow();

				_dr[_dc_idlog] = _serializableobject.IDLog;
				_dr[_dc_iflogtype] = _serializableobject.IFLogtype;
				_dr[_dc_ifuser] = _serializableobject.IFUser;
				_dr[_dc_ifuser__read] = _serializableobject.IFUser__read;
				_dr[_dc_iferrortype] = _serializableobject.IFErrortype;
				_dr[_dc_stamp] = _serializableobject.Stamp;
				_dr[_dc_stamp__read] = _serializableobject.Stamp__read;
				_dr[_dc_message] = _serializableobject.Message;
				_dr[_dc_ifpermition] = _serializableobject.IFPermition;
				_dr[_dc_ifapplication] = _serializableobject.IFApplication;
				_dr[_dc_ifbrowser__opt] = _serializableobject.IFBrowser__OPT;

				_output.Rows.Add(_dr);
			}

			return _output;
		}
Exemplo n.º 8
0
		internal static void log(
			Sessionuser usersession_in,

			int logtype_in,
			int errortype_in,
			long idPermition_in, 

			int idApplication_in,

			string format_in,
			params string[] args_in
		) {
			SO_LOG_Log _log = new SO_LOG_Log();

			#region _log.Message = ...;
			_log.Message = string.Format(format_in, args_in);
			if (_log.Message.Length > MessageSize) {
				_log.Message = _log.Message.Substring(0, MessageSize);
			}
			#endregion
			#region _log.IDUser = ...;
			if (
				(usersession_in == null)
				||
				(usersession_in.IDUser <= 0)
			) {
				_log.IFUser_isNull = true;
			} else {
				_log.IFUser = usersession_in.IDUser;
			}
			#endregion
			_log.IFLogtype = logtype_in;
			#region _log.IDErrortype = ...;
			if (errortype_in == ErrorType.no_error) {
				_log.IFErrortype_isNull = true;
			} else {
				_log.IFErrortype = errortype_in;
			} 
			#endregion
			#region _log.IFPermition = ...;
			if (idPermition_in <= 0) {
				_log.IFPermition_isNull = true;
			} else {
				_log.IFPermition = idPermition_in;
			}
			#endregion
			_log.Stamp = DateTime.Now;
			_log.IFUser__read_isNull = true;
			_log.Stamp__read_isNull = true;
			#region _log.IFApplication = ...;
			if (idApplication_in <= 0) {
				_log.IFApplication_isNull = true;
			} else {
				_log.IFApplication = idApplication_in;
			} 
			#endregion

			DO_LOG_Log.insObject(
				_log,
				false,
				null
			);


#if DEBUG
			Console.WriteLine(
			    ".--- Log ---\n{0}{1}{2}|message: {3}\n'-----------",
				LogType.Items.ContainsKey(logtype_in) ? string.Format(
					"|log type: {0}\n", 
					LogType.Items[logtype_in].Name
				) : "", 
				ErrorType.Items.ContainsKey(errortype_in) ? string.Format(
					"|error type: {0}\n", 
					ErrorType.Items[errortype_in].Name
				) : "", 
				!_log.IFUser_isNull ? string.Format(
					"|user: {0}\n", 
					_log.IFUser.ToString()
				) : "", 
				_log.Message
			);
#endif
		}